Package com.luciad.util.enumeration
Class TLcdMorphedEnumeration
java.lang.Object
com.luciad.util.enumeration.TLcdMorphedEnumeration
- All Implemented Interfaces:
ILcdAutoCloseableEnumeration
,AutoCloseable
,Enumeration
This class generates a modified
Enumeration
from a given Enumeration
, by
applying a given transformation to each of the elements before returning it.
Example applications:
- The transformation can return a property or field of each element,
- It can decode the element to a proper format and return that,
- It can return the element itself, and just execute a side effect.
-
Constructor Summary
ConstructorDescriptionTLcdMorphedEnumeration
(Enumeration aEnumeration, ILcdMorphingFunction aMorphingFunction) Constructs a newEnumeration
from the givenEnumeration
with a given transformation. -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
This close method does not throw checked exceptions.boolean
ImplementsEnumeration.hasMoreElements()
.ImplementsEnumeration.nextElement()
.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.util.Enumeration
asIterator
-
Constructor Details
-
TLcdMorphedEnumeration
Constructs a newEnumeration
from the givenEnumeration
with a given transformation. For each originally enumerated element, the result of the transformation is returned instead of the element itself.- Parameters:
aEnumeration
- the basicEnumeration
that will be returned.aMorphingFunction
- the function that is applied to each of the elements.
-
-
Method Details
-
hasMoreElements
public boolean hasMoreElements()ImplementsEnumeration.hasMoreElements()
.- Specified by:
hasMoreElements
in interfaceEnumeration
-
nextElement
ImplementsEnumeration.nextElement()
.- Specified by:
nextElement
in interfaceEnumeration
-
close
public void close()Description copied from interface:ILcdAutoCloseableEnumeration
This close method does not throw checked exceptions.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceILcdAutoCloseableEnumeration
-