|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--edu.stanford.rt.datatype.DataType | +--edu.stanford.rt.datatype.SimpleType | +--edu.stanford.rt.datatype.OrderedType | +--edu.stanford.rt.datatype.EnumType
EnumType
element in DomainSpecification.
Each EnumType
declaration object knows its legal values
and the ordering of the values if the values are ordered.Field Summary | |
private boolean |
ignoreCase
are values case-sensitive? |
private boolean |
ordered
are values ordered in any way? |
private int |
size
the number of values this type has |
private java.util.ArrayList |
values
the list of values in their natural order, i.e. |
private java.util.HashSet |
valuesCopy
We also store the values in a hash set to speed up membership tests. |
private DataType |
valueType
Defines the ordering of values. |
Fields inherited from class edu.stanford.rt.datatype.DataType |
|
Constructor Summary | |
EnumType(java.lang.String name,
DataType valueType,
OrderedMap enumValues,
boolean ignoreCase,
boolean ordered,
int size)
Constructor for EnumType. |
Method Summary | |
int |
compares(DataValue value1,
DataValue value2)
Method compares. |
boolean |
contains(java.lang.String value)
Method contains. |
int |
getSize()
Method getSize. |
java.util.List |
getValues()
Method getValues. |
DataType |
getValueType()
Method getValueType. |
boolean |
isIgnoreCase()
Method isIgnoreCase. |
boolean |
isOrdered()
Method isOrdered. |
boolean |
isValidValue(DataValue v)
Check if the DataValue o is a legal value for its type. |
void |
setValueType(DataType type)
Method setValueType. |
java.lang.String |
toString(java.lang.String indent)
Method toString. |
Methods inherited from class edu.stanford.rt.datatype.DataType |
getName, toString |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
private int size
private DataType valueType
private boolean ignoreCase
private boolean ordered
private java.util.ArrayList values
private java.util.HashSet valuesCopy
Constructor Detail |
public EnumType(java.lang.String name, DataType valueType, OrderedMap enumValues, boolean ignoreCase, boolean ordered, int size) throws java.lang.IllegalArgumentException
Method Detail |
public void setValueType(DataType type)
type
- public DataType getValueType()
public java.util.List getValues()
returns an unmodifiable view of the legal values.
public boolean contains(java.lang.String value)
checks whether the given value is part of the legal values.
value
-
public int getSize()
returns the actual number of legal values defined for this type.
public boolean isIgnoreCase()
public boolean isOrdered()
public boolean isValidValue(DataValue v)
SimpleType
isValidValue
in class SimpleType
public int compares(DataValue value1, DataValue value2)
OrderedType
compares
in class OrderedType
value1
- value2
-
public java.lang.String toString(java.lang.String indent)
DataType
toString
in class DataType
indent
-
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |