uk.ac.man.cs.rainbow.datamodel
Class Data.Word
java.lang.Object
|
+--uk.ac.man.cs.rainbow.rapa.data.Expression
|
+--uk.ac.man.cs.rainbow.datamodel.Data
|
+--uk.ac.man.cs.rainbow.datamodel.Data.Word
- All Implemented Interfaces:
- Argument, Data.Comparable, Serializable, Value, VariableContainer
- Enclosing class:
- Data
- public static class Data.Word
- extends Data
- implements Serializable, Data.Comparable
Basic "word" datatypes.
- See Also:
Data
,
Type
,
Type.Boolean
,
Type.Integer
,
Type.Enum
, Serialized Form
Inner Class Summary |
static interface |
Data.Word.RestrictingT
Some word types can restrict the range of the underlying word. |
static interface |
Data.Word.T
What special operations must the type of a word implement? |
Field Summary |
protected int |
value
|
Constructor Summary |
Data.Word(boolean value)
Create a new word whose type is that of an boolean. |
Data.Word(int value)
Create a new word whose type is that of an integer. |
Data.Word(int value,
Type type)
Create a new word whose type is that specified. |
Methods inherited from class uk.ac.man.cs.rainbow.datamodel.Data |
apply, equals, equals, getResultType, getType, hasVariable, main, occurs, parse, parse, subst, typedString, unify |
value
protected int value
Data.Word
public Data.Word(int value)
- Create a new word whose type is that of an integer.
Data.Word
public Data.Word(boolean value)
- Create a new word whose type is that of an boolean.
Data.Word
public Data.Word(int value,
Type type)
throws TypeException
- Create a new word whose type is that specified.
toString
public String toString()
- Description copied from class:
Data
- Print the data value.
- Overrides:
toString
in class Data
getValue
public int getValue()
setType
protected void setType(Type t)
throws TypeException
equals
public boolean equals(Data d)
- Description copied from class:
Data
- Standardised equality defined over data values with equal
types. Implemented by concrete subclasses.
- Overrides:
equals
in class Data
cast
public Data cast(Type t)
throws TypeException
- Description copied from class:
Data
- Return a new data value that has the given type.
- Overrides:
cast
in class Data
- Following copied from class:
uk.ac.man.cs.rainbow.datamodel.Data
- Throws:
TypeException
- Thrown if the data value being cast from (or some part of it)
disgrees with the type (or type component) that is being
specified for it.
hashCode
public int hashCode()
- Description copied from class:
Data
- Hash-code generator. Implemented so that data values that print
the same way have the same hashCode (and ought to satisfy
equals() too...)
- Overrides:
hashCode
in class Data
compare
public int compare(Data.Comparable d)
throws TypeException
- Description copied from interface:
Data.Comparable
- Check for relative ordering with respect to this object.
- Specified by:
compare
in interface Data.Comparable
- Following copied from interface:
uk.ac.man.cs.rainbow.datamodel.Data.Comparable
- Parameters:
otherComparable
- Comparable object to compare with.- Returns:
- Negative if this object is less, positive if this
object is more, and zero if this object is the same.
Zero should only be returned if
equals
would return
true. - Throws:
TypeException
- If the objects are not of a similar-enough type to compare.