|
JTP API Documentation | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Object | +--jtp.fol.Variable
A Variable can be bound to (substituted with) some other Object.
| Nested Class Summary | |
static class |
Variable.NameComparator
|
| Constructor Summary | |
Variable(String s)
Creates a Variable with name s. |
|
Variable(String name,
long serialNumber)
|
|
| Method Summary | |
int |
compareTo(Object o)
|
boolean |
contains(Variable v)
Determines whether or not v is contained within this
Variable. |
String |
debugPrintout()
|
Object |
deReferenceVariables()
Returns the Object that this Variable is bound to. |
String |
getName()
Name used primarily for printing purposes. |
long |
getSerialNumber()
|
Collection |
getVariables(Collection c)
Retrieves the variables in this Unifyable and places them into a provided target collection. |
void |
setValue(Object val)
Bind this variable to val. |
Object |
substitute(Map h)
|
String |
toString()
|
void |
unbind()
Set the bound value of this Variable to null. |
boolean |
unify(Object o,
List bindings)
Attempts to unify this with o. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
public Variable(String s)
s.
s - name of the Variable to be created.
public Variable(String name,
long serialNumber)
| Method Detail |
public String getName()
public long getSerialNumber()
public void setValue(Object val)
val.
val - an Object that this Variable is to be bound to
IllegalStateException - If this Variable is already bound to a different value
Error - If binding to val results in a circular dependency, i.e., val is a Variable that is itself bound to this, possibly nestedpublic void unbind()
public String toString()
toString in class Objectpublic String debugPrintout()
public boolean contains(Variable v)
v is contained within this
Variable.
contains in interface Unifyablev - a Variable
v is == to this or if
the bound value of this Variable is a Unifyable that contains vpublic Object deReferenceVariables()
this. If
the bound value of this is a Unifyable, call
deReferenceVariables() on it to get return value.
Otherwise, return getValue().
deReferenceVariables in interface UnifyableVariable
public boolean unify(Object o,
List bindings)
this with o.
Performs occurs check.
unify in interface Unifyableo - the object to unify with.bindings - the variable stack
public Object substitute(Map h)
public Collection getVariables(Collection c)
Unifyable
getVariables in interface Unifyablec - the collection to which the variables are added. If null, and this Unifyable
contains variables, a new collection is created.
public int compareTo(Object o)
compareTo in interface Comparable
|
JTP API Documentation | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||