org.codehaus.janino.util.enumerator
public class EnumeratorSet extends Object
Its main features are its constructor, which initializes the object from a clear-text string, and its toString method, which reconstructs the clear text values.
Sample code can be found in the documentation of Enumerator.
Constructor Summary | |
---|---|
EnumeratorSet(Class enumeratorClass)
Construct an empty set for values of the given Enumerator-derived type. | |
EnumeratorSet(Class enumeratorClass, boolean full)
Construct a set for values of the given Enumerator-derived type. | |
EnumeratorSet(Class enumeratorClass, String s)
Construct a set for values of the given Enumerator-derived type and initialize it
from a string.
| |
EnumeratorSet(Class enumeratorClass, String s, String delimiter)
Construct a set for values of the given Enumerator-derived type and initialize it
from a string.
| |
EnumeratorSet(EnumeratorSet that)
Construct a copy of the given set. |
Method Summary | |
---|---|
EnumeratorSet | add(Enumerator value)
Add the given value to the set.
|
EnumeratorSet | add(EnumeratorSet that)
Add the values of the given set to this set.
|
boolean | contains(Enumerator value)
Check whether this set contains the given value
|
boolean | containsAllOf(EnumeratorSet that)
Check if this set contains all values of the given set.
|
boolean | containsAnyOf(EnumeratorSet that)
Check if this set contains any of the values of the given set.
|
boolean | equals(Object that)
Check the values' identity. |
int | hashCode() |
EnumeratorSet | remove(Enumerator value) |
EnumeratorSet | remove(EnumeratorSet that) |
EnumeratorSet | setName(String optionalName)
An EnumeratorSet can optionally be assigned a name, which is used by
toString.
|
String | toString()
Convert an EnumeratorSet to a clear-text string.
|
String | toString(String delimiter)
Convert an EnumeratorSet into a clear-text string.
|
full
flag is true
, all possible values are added to the set.
Equivalent to EnumeratorSet(enumeratorClass, s, ",")
.
The given string is parsed into tokens; each token is converted into a value as
Enumerator does and added to this set. Named EnumeratorSets
declared in the enumeratorClass
are also recognized and added. If the string names exactly one
of those EnumeratorSets declared in the enumeratorClass
, then the resulting set
inherits the name of theat EnumeratorSet.
Throws: EnumeratorFormatException if a token cannot be identified
Throws: EnumeratorSetTypeException if this set was constructed for a different Enumerator-derived type
Throws: EnumeratorSetTypeException if this set was constructed for a different Enumerator-derived type
Throws: EnumeratorSetTypeException if this set was constructed for a different Enumerator-derived type
Throws: EnumeratorSetTypeException if this set was constructed for a different Enumerator-derived type
Returns false
if either of the two sets is empty.
Throws: EnumeratorSetTypeException if this set was constructed for a different Enumerator-derived type
value
, return an
EnumeratorSet that lacks the value
. Otherwise, return this
EnumeratorSet.
Returns: the reduced set
Throws: EnumeratorSetTypeException if this set was constructed for a different Enumerator-derived type
that
EnumeratorSet.
Returns: the reduced set
Throws: EnumeratorSetTypeException if this set was constructed for a different Enumerator-derived type
Identical with toString(",")
.
If this EnumeratorSet has a name (see setName, then this name is returned.
Otherwise, if this EnumeratorSet is empty, an empty String is returned.
Otherwise, the values' names are concatenated, separated by the given delimiter, and returned.