Package eu.bandm.tools.ops
Class DynamicEnum<T>
java.lang.Object
eu.bandm.tools.ops.DynamicEnum<T>
- All Implemented Interfaces:
Index<DynamicEnum.Item<T>>,Serializable,Iterable<DynamicEnum.Item<T>>
- Direct Known Subclasses:
DynamicEnum.Coproduct,DynamicEnum.Product
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classAn enumeration type which comprises all items from a set of underlying enumeration types.static classWrapper for one single data item added to the enumeration.static classThe product of multiple DynamicEnum realized as one DynamicEnum of tuples. -
Constructor Summary
ConstructorsConstructorDescriptionConstructor for an emtpy enumeration.DynamicEnum(Collection<? extends @Opt T> items) Constructor for an enumeration with fixed content.DynamicEnum(T... items) Constructor for an enumeration with fixed content. -
Method Summary
Modifier and TypeMethodDescriptionAdd one item.booleanReturns whether the argument is contained in this enumeration.booleanReturns whether the argument is contained in this enumeration.booleanReturns whether the argument is contained in this enumeration.get(int i) Returns the added item by its position number, or null if no such found.intindexOf(DynamicEnum.Item<T> i) Returns the number of the item in this enumeration, or -1 if not contained.intReturns the number of the item in this enumeration, or -1 if not contained.items()evidentiterator()voidseal()Set the sealed flag to indicate that the definition is complete.intsize()Returns the number of objects in this index.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface eu.bandm.tools.ops.Index
comparator, enumerate, isEmptyMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
DynamicEnum
public DynamicEnum()Constructor for an emtpy enumeration. Must be filled by successive calls toadd( T). -
DynamicEnum
Constructor for an enumeration with fixed content. No further addtions may happen. -
DynamicEnum
Constructor for an enumeration with fixed content. No further addtions may happen.
-
-
Method Details
-
add
Add one item.- Throws:
IllegalStateException- if sealed flag is set.
-
seal
public void seal()Set the sealed flag to indicate that the definition is complete. Must be called after the last call toadd(T). -
size
public int size()Description copied from interface:IndexReturns the number of objects in this index. This number is nonnegative. -
iterator
-
items
evident -
get
Returns the added item by its position number, or null if no such found. -
indexOf
Returns the number of the item in this enumeration, or -1 if not contained. -
indexOfUnchecked
Returns the number of the item in this enumeration, or -1 if not contained.- Specified by:
indexOfUncheckedin interfaceIndex<T>
-
contains
Returns whether the argument is contained in this enumeration. -
containsSemichecked
Returns whether the argument is contained in this enumeration. -
containsUnchecked
Returns whether the argument is contained in this enumeration.- Specified by:
containsUncheckedin interfaceIndex<T>
-