Package eu.bandm.tools.util.classes
Class DynamicEnum.Coproduct<T>
java.lang.Object
eu.bandm.tools.util.classes.DynamicEnum<Map.Entry<Integer,T>>
eu.bandm.tools.util.classes.DynamicEnum.Coproduct<T>
- All Implemented Interfaces:
Index<DynamicEnum.Item<Map.Entry<Integer,
,T>>> Serializable
,Iterable<DynamicEnum.Item<Map.Entry<Integer,
T>>>
- Enclosing class:
- DynamicEnum<T>
An enumeration type which comprises all items from a set of underlying enumeration types.
Every emtry of this coproduct enumeration is implemented by a Map.Entry of
the underlying enumeration (given as an integer index) and a value of this enumeration.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class eu.bandm.tools.util.classes.DynamicEnum
DynamicEnum.Coproduct<T>, DynamicEnum.Item<T>, DynamicEnum.Product<T>
-
Constructor Summary
ConstructorDescriptionCoproduct
(List<? extends DynamicEnum<? extends T>> cases) Construct a coproduct enumeration from a list of DynamicEnum, which define the items by joining in the given sequential order. -
Method Summary
Modifier and TypeMethodDescriptioninjection
(int index, DynamicEnum.Item<? extends T> item) Deliver the item of the coproduct enumeration which corresponds to the givne item of one of the underlying enumerations.Methods inherited from class eu.bandm.tools.util.classes.DynamicEnum
add, contains, containsSemichecked, containsUnchecked, get, indexOf, indexOfUnchecked, items, iterator, seal, size
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface eu.bandm.tools.ops.Index
comparator, enumerate, isEmpty
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
Coproduct
Construct a coproduct enumeration from a list of DynamicEnum, which define the items by joining in the given sequential order.
-
-
Method Details
-
injection
public DynamicEnum.Item<Map.Entry<Integer,T>> injection(int index, DynamicEnum.Item<? extends T> item) Deliver the item of the coproduct enumeration which corresponds to the givne item of one of the underlying enumerations.- Parameters:
index
- identifies the underlying enumeration, in the sequential order of the constructor argumentsitem
- must be contained in the selected underlying enumeration.- Throws:
IllegalArgumentException
- if the given item is not in the underlying enumeration (given by index)
-