|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectJSHOP2.CompileTimeObject
JSHOP2.Term
JSHOP2.TermVariable
public class TermVariable
Each variable symbol both at compile time and at run time, is an instance of this class.
Field Summary | |
---|---|
private int |
index
Variable symbols are mapped to integers at compile time, and these integers are used thereafter to represent the variable symbols. |
private static TermVariable[] |
variables
To represent the variable symbols that we know occur in the domain description, so that there will be no duplicate copies of those symbols. |
Fields inherited from class JSHOP2.CompileTimeObject |
---|
endl |
Constructor Summary | |
---|---|
TermVariable(int indexIn)
To initialize this variable symbol. |
Method Summary | |
---|---|
Term |
bind(Term[] binding)
Since this term is a variable symbol, binding it basically means finding out whether or not this variable is already mapped to something in the input, and if so, returning the value this variable is mapped to. |
boolean |
equals(Term t)
This function returns false . |
boolean |
findUnifier(Term t,
Term[] binding)
Find a unifier between this variable symbol and another given term. |
int |
getIndex()
To get the index for this variable symbol. |
static TermVariable |
getVariable(int index)
To return the correponding existing variable symbol. |
static void |
initialize(int size)
To initialize an array of variable symbols that we know occur in the domain description, so that there will be no duplicate copies of those symbols. |
boolean |
isGround()
This function always returns false because a variable symbol
is never ground by definition. |
java.lang.String |
toCode()
This function produces Java code to create this variable symbol as a term. |
java.lang.String |
toString()
This function is used to print this variable symbol. |
Methods inherited from class JSHOP2.Term |
---|
isNil, merge, merge, print |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
private int index
private static TermVariable[] variables
Constructor Detail |
---|
public TermVariable(int indexIn)
indexIn
- the integer associated with this variable symbol.Method Detail |
---|
public Term bind(Term[] binding)
bind
in class Term
binding
- an array of terms, indexed by the integers associated with
variable symbols.
public boolean equals(Term t)
false
.
equals
in class Term
t
- the term being compared to this term.
true
if the two terms are equal, false
otherwise.public boolean findUnifier(Term t, Term[] binding)
findUnifier
in class Term
t
- the term with which we are finding a unifier.binding
- the unifier to be returned.
false
if the two terms can not be unified,
true
otherwise.public int getIndex()
public static TermVariable getVariable(int index)
index
- the index of the variable symbol to be returned.
public static void initialize(int size)
size
- the number of existing variable symbols.public boolean isGround()
false
because a variable symbol
is never ground by definition.
isGround
in class Term
true
if this term is ground, false
otherwise.public java.lang.String toCode()
toCode
in class CompileTimeObject
String
.public java.lang.String toString()
toString
in class Term
String
that shows the value of this
term.
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |