uk.ac.man.cs.rainbow.datamodel
Class Type.Enum
java.lang.Object
|
+--uk.ac.man.cs.rainbow.datamodel.Type
|
+--uk.ac.man.cs.rainbow.datamodel.Type.Enum
- All Implemented Interfaces:
- Argument, Data.Word.RestrictingT, Data.Word.T, Serializable, Type
- Enclosing class:
- Type
- public static class Type.Enum
- extends Type
- implements Data.Word.RestrictingT
The class of types of enumerations.
- See Also:
Data.Word
, Serialized Form
Field Summary |
protected String[] |
idents
The (ordered) list of identifiers that make up the members of
the enumeration. |
Method Summary |
boolean |
equals(Type t)
Equality defined between enumerations and other types. |
int |
lookup(String name)
Map from strings to integers. |
String |
render(int value)
How to display a value of this enumeration type. |
int |
restrict(int value)
Value range restriction operation. |
String |
toString()
How to display an instance of an enumeration. |
idents
protected String[] idents
- The (ordered) list of identifiers that make up the members of
the enumeration.
Type.Enum
public Type.Enum(String[] names)
throws TypeException
- Create a new enumeration.
toString
public String toString()
- How to display an instance of an enumeration.
- Overrides:
toString
in class Type
render
public String render(int value)
- How to display a value of this enumeration type.
- Specified by:
render
in interface Data.Word.T
restrict
public int restrict(int value)
- Value range restriction operation. When converting some
other word-type to a Enumeration, this makes sure that the
value used internally to represent the Enumeration value is
legal.
- Specified by:
restrict
in interface Data.Word.RestrictingT
equals
public boolean equals(Type t)
- Equality defined between enumerations and other types.
- Overrides:
equals
in class Type
lookup
public int lookup(String name)
throws TypeException
- Map from strings to integers. Given a string that contains
the textual representation of an enumeration value, return
a number that indicates which value was represented by that
value.