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

java.lang.Object
  |
  +--uk.ac.man.cs.rainbow.rapa.data.Expression
All Implemented Interfaces:
Argument, Serializable, Value, VariableContainer
Direct Known Subclasses:
Application, Bool, Constant, Data, Number, Register, TupleExpression, Variable

public abstract class Expression
extends Object
implements Serializable, Value

Implementations of some methods for values in RAPA and GCL.

See Also:
Serialized Form

Constructor Summary
Expression()
           
 
Method Summary
abstract  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(Object o)
           
abstract  boolean equals(Value val)
           
 ValueWhite[] evaluate(Map funcs, Map regs, HashMap whiteboard)
          Evaluate the expression/value under the given substitution over functions and valuation of register contents.
 Type getNodeType()
           
abstract  Type getResultType()
           
abstract  boolean occurs(Substitution s, Variable v)
          Check whether the variable occurs in this value under the given substitution.
 Value subst(GeneralSubstitution s)
          Apply a substitution to this value to get a new value.
abstract  Value subst(Substitution s)
          Apply a substitution to this value to get a new value.
abstract  Substitution unify(Substitution s, Value val)
          Get the substitution which unifies this value with the given value, after applying the given substitution.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface uk.ac.man.cs.rainbow.rapa.data.VariableContainer
hasVariable
 

Constructor Detail

Expression

public Expression()
Method Detail

apply

public abstract Value apply(Unifier u)
Description copied from interface: Value
Apply a unifier to this value to get a new value.
Specified by:
apply in interface Value

subst

public abstract Value subst(Substitution s)
Description copied from interface: Value
Apply a substitution to this value to get a new value.
Specified by:
subst in interface Value

occurs

public abstract boolean occurs(Substitution s,
                               Variable v)
Description copied from interface: Value
Check whether the variable occurs in this value under the given substitution.
Specified by:
occurs in interface Value

unify

public abstract Substitution unify(Substitution s,
                                   Value val)
                            throws NotUnifiable
Description copied from interface: Value
Get the substitution which unifies this value with the given value, after applying the given substitution.
Specified by:
unify in interface Value
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.

equals

public abstract boolean equals(Value val)

compatableWith

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

subst

public Value subst(GeneralSubstitution s)
Description copied from interface: Value
Apply a substitution to this value to get a new value.
Specified by:
subst in interface Value

equals

public boolean equals(Object o)
Overrides:
equals in class Object

getResultType

public abstract Type getResultType()

getNodeType

public Type getNodeType()

evaluate

public ValueWhite[] evaluate(Map funcs,
                             Map regs,
                             HashMap whiteboard)
Description copied from interface: Value
Evaluate the expression/value under the given substitution over functions and valuation of register contents. May return multiple values if there are several possible valuations of the given expression.
Specified by:
evaluate in interface Value