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

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

public class Application
extends Expression

See Also:
Serialized Form

Field Summary
protected  Value[] args
           
protected  String name
           
protected  Type resultType
           
 
Constructor Summary
Application(Application prototype, Value[] args)
           
Application(String name, int arglen, Type resultType)
           
Application(String name, Value[] args, Type resultType)
           
Application(String name, Value arg, Type resultType)
           
Application(String name, Value arg1, Value arg2, Type resultType)
           
 
Method Summary
 Value apply(Unifier u)
          Apply a unifier to this value to get a new value.
 boolean equals(Value v)
           
 ValueWhite[] evaluate(Map funcs, Map regs, HashMap whiteboard)
          Evaluate the expression/value under the given substitution over functions and valuation of register contents.
 Value getArg(int i)
           
 String getName()
           
 Type getNodeType()
           
 Type getResultType()
           
 int hashCode()
           
 boolean hasVariable()
           
 int numArguments()
           
 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.
 Value subst(Substitution s)
          Apply a substitution to this value to get a new value.
 String toString()
           
 Substitution unify(Substitution s, Value v)
          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
compatableWith, equals
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

args

protected Value[] args

name

protected String name

resultType

protected Type resultType
Constructor Detail

Application

public Application(String name,
                   Value[] args,
                   Type resultType)

Application

public Application(String name,
                   int arglen,
                   Type resultType)

Application

public Application(String name,
                   Value arg,
                   Type resultType)

Application

public Application(String name,
                   Value arg1,
                   Value arg2,
                   Type resultType)

Application

public Application(Application prototype,
                   Value[] args)
Method Detail

numArguments

public int numArguments()

getName

public String getName()

getArg

public Value getArg(int i)

toString

public String toString()
Overrides:
toString in class Object

getResultType

public Type getResultType()
Overrides:
getResultType in class Expression

getNodeType

public Type getNodeType()
Overrides:
getNodeType in class Expression

hasVariable

public boolean hasVariable()

hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

public boolean equals(Value v)
Overrides:
equals 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 v)
                   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.

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

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

subst

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

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.
Overrides:
evaluate in class Expression