uk.ac.man.cs.rainbow.rapa.data
Class Variable

java.lang.Object
  |
  +--uk.ac.man.cs.rainbow.rapa.data.Expression
        |
        +--uk.ac.man.cs.rainbow.rapa.data.Variable
All Implemented Interfaces:
Argument, Serializable, Value, VariableContainer
Direct Known Subclasses:
Variable.Named

public class Variable
extends Expression

See Also:
Serialized Form

Inner Class Summary
static class Variable.Named
           
 
Constructor Summary
Variable()
           
Variable(Type type)
           
 
Method Summary
 Value apply(Unifier u)
          Apply a unifier to this value to get a new value.
 void compatableWith(Argument arg)
          Check that this value is compatable with the argument.
 boolean equals(Value e)
           
 Type getResultType()
           
 boolean hasVariable()
           
 boolean occurs(Substitution s, Variable v)
          Check whether the variable occurs in this value under the given substitution.
 Value subst(Substitution s)
          Apply a substitution to this value to get a new value.
 String toString()
           
 Substitution unify(Substitution s, Value e)
          Get the substitution which unifies this value with the given value, after applying the given substitution.
 
Methods inherited from class uk.ac.man.cs.rainbow.rapa.data.Expression
equals, evaluate, getNodeType, subst
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Variable

public Variable()

Variable

public Variable(Type type)
Method Detail

toString

public String toString()
Overrides:
toString in class Object

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 Expression

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 Expression

unify

public Substitution unify(Substitution s,
                          Value e)
                   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 Expression
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.

hasVariable

public boolean hasVariable()

equals

public boolean equals(Value e)
Overrides:
equals in class Expression

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 Expression

compatableWith

public void compatableWith(Argument arg)
Description copied from interface: Value
Check that this value is compatable with the argument.
Overrides:
compatableWith in class Expression
Following copied from interface: uk.ac.man.cs.rainbow.rapa.data.Value
See Also:
GeneralSubstitution

getResultType

public Type getResultType()
Overrides:
getResultType in class Expression