|
janino.net | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.codehaus.janino.util.enumerator.EnumeratorSet
public class EnumeratorSet
A class that represents an immutable set of Enumerator
s.
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(java.lang.Class enumeratorClass)
Construct an empty set for values of the given Enumerator -derived type. |
|
EnumeratorSet(java.lang.Class enumeratorClass,
boolean full)
Construct a set for values of the given Enumerator -derived type. |
|
EnumeratorSet(java.lang.Class enumeratorClass,
java.lang.String s)
Construct a set for values of the given Enumerator -derived type and initialize it
from a string. |
|
EnumeratorSet(java.lang.Class enumeratorClass,
java.lang.String s,
java.lang.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(java.lang.Object that)
Check the values' identity. |
int |
hashCode()
|
EnumeratorSet |
remove(Enumerator value)
If this EnumeratorSet contains the given value , return an
EnumeratorSet that lacks the value . |
EnumeratorSet |
remove(EnumeratorSet that)
Return this EnumeratorSet less that EnumeratorSet . |
EnumeratorSet |
setName(java.lang.String optionalName)
An EnumeratorSet can optionally be assigned a name, which is used by
toString() . |
java.lang.String |
toString()
Convert an EnumeratorSet to a clear-text string. |
java.lang.String |
toString(java.lang.String delimiter)
Convert an EnumeratorSet into a clear-text string. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public EnumeratorSet(java.lang.Class enumeratorClass)
Enumerator
-derived type.
public EnumeratorSet(java.lang.Class enumeratorClass, boolean full)
Enumerator
-derived type. If the
full
flag is true
, all possible values are added to the set.
public EnumeratorSet(java.lang.Class enumeratorClass, java.lang.String s) throws EnumeratorFormatException
Enumerator
-derived type and initialize it
from a string.
Equivalent to EnumeratorSet(enumeratorClass, s, ",")
.
EnumeratorFormatException
public EnumeratorSet(java.lang.Class enumeratorClass, java.lang.String s, java.lang.String delimiter) throws EnumeratorFormatException
Enumerator
-derived type and initialize it
from a string.
The given string is parsed into tokens; each token is converted into a value as
Enumerator.fromString(String, Class)
does and added to this set. Named EnumeratorSet
s
declared in the enumeratorClass
are also recognized and added. If the string names exactly one
of those EnumeratorSet
s declared in the enumeratorClass
, then the resulting set
inherits the name of theat EnumeratorSet
.
EnumeratorFormatException
- if a token cannot be identifiedpublic EnumeratorSet(EnumeratorSet that)
Method Detail |
---|
public EnumeratorSet add(Enumerator value)
EnumeratorSetTypeException
- if this set was constructed for a different Enumerator
-derived typepublic EnumeratorSet add(EnumeratorSet that)
EnumeratorSetTypeException
- if this set was constructed for a different Enumerator
-derived typepublic EnumeratorSet remove(Enumerator value)
EnumeratorSet
contains the given value
, return an
EnumeratorSet
that lacks the value
. Otherwise, return this
EnumeratorSet
.
EnumeratorSetTypeException
- if this set was constructed for a different Enumerator
-derived typepublic EnumeratorSet remove(EnumeratorSet that)
EnumeratorSet
less that
EnumeratorSet
.
EnumeratorSetTypeException
- if this set was constructed for a different Enumerator
-derived typepublic boolean contains(Enumerator value)
EnumeratorSetTypeException
- if this set was constructed for a different Enumerator
-derived typepublic boolean containsAnyOf(EnumeratorSet that)
Returns false
if either of the two sets is empty.
EnumeratorSetTypeException
- if this set was constructed for a different Enumerator
-derived typepublic boolean containsAllOf(EnumeratorSet that)
EnumeratorSetTypeException
- if this set was constructed for a different Enumerator
-derived typepublic EnumeratorSet setName(java.lang.String optionalName)
EnumeratorSet
can optionally be assigned a name, which is used by
toString()
.
public boolean equals(java.lang.Object that)
setName(String)
is
not considered.
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public java.lang.String toString()
EnumeratorSet
to a clear-text string.
Identical with toString(",")
.
toString
in class java.lang.Object
public java.lang.String toString(java.lang.String delimiter)
EnumeratorSet
into a clear-text string.
If this EnumeratorSet
has a name (see setName(String)
, 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.
|
janino.net | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |