uk.ac.man.cs.rainbow.datamodel
Class Data.Union
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.Union
- All Implemented Interfaces:
- Argument, Serializable, Value, VariableContainer
- Enclosing class:
- Data
- public static class Data.Union
- extends Data
- implements Serializable
Union datatypes.
- See Also:
Data
,
Type
,
Type.Union
, Serialized Form
Inner Class Summary |
static interface |
Data.Union.T
What special operations must the type of a union implement? |
contents
protected Expression contents
index
protected int index
Data.Union
public Data.Union(Type t,
Expression d,
int idx)
throws TypeException
Data.Union
public Data.Union(Type t,
Expression d,
String idx)
throws TypeException
Data.Union
public Data.Union(Type t,
Expression d,
Data.Word idx)
throws TypeException
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.
toString
public String toString()
- Description copied from class:
Data
- Print the data value.
- Overrides:
toString
in class Data
getContents
public Expression getContents()
getIndex
public Data.Word getIndex()
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
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
apply
public Value apply(Unifier u)
- Description copied from interface:
Value
- Apply a unifier to this value to get a new value.
- Overrides:
apply
in class Data
subst
public Value subst(Substitution s)
- Description copied from interface:
Value
- Apply a substitution to this value to get a new value.
- Overrides:
subst
in class Data
hasVariable
public boolean hasVariable()
- Overrides:
hasVariable
in class Data
occurs
public boolean occurs(Substitution s,
Variable v)
- Description copied from interface:
Value
- Check whether the variable occurs in this value under the given
substitution.
- Overrides:
occurs
in class Data
unify
public Substitution unify(Substitution s,
Value ex)
throws NotUnifiable
- Description copied from interface:
Value
- Get the substitution which unifies this value with the given
value, after applying the given substitution.
- Overrides:
unify
in class Data
- Following copied from interface:
uk.ac.man.cs.rainbow.rapa.data.Value
- Parameters:
subst
- The substitution to apply first.val
- The value to unify with this value.- Returns:
- The substitution that is the combination of the given
substitution and whatever extra substitutions are necessary to
unify the two values.
- Throws:
NotUnifiable
- If the two values cannot be unified.