|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectJSHOP2.CompileTimeObject
JSHOP2.Predicate
public class Predicate
Each predicate, both at compile time and at run time, is an instance of this class.
Field Summary | |
---|---|
private int |
head
The index of the constant symbol that is the head of this predicate. |
private int |
ID
|
private Term |
param
The argument list of this predicate. |
private static int |
staticID
A unique ID to identify this predicate. |
private int |
varCount
The number of variables in this predicate. |
private int |
varIdx
In case this predicate is a variable symbol and not a real atom, this represents its index. |
Fields inherited from class JSHOP2.CompileTimeObject |
---|
endl |
Constructor Summary | |
---|---|
Predicate(int varIdxIn,
int varCountIn)
To initialize this predicate when it is not a real predicate but a variable symbol. |
|
Predicate(int headIn,
int varCountIn,
Term paramIn)
To initialize this predicate. |
Method Summary | |
---|---|
Predicate |
applySubstitution(Term[] bindings)
To apply a binding to this predicate. |
boolean |
equals(Term t)
Whether or not the argument list of another predicate is equal to the the argument list of this predicate. |
Term[] |
findUnifier(Term t)
To find a unifier that unifies the argument list of another predicate with the argument list of this predicate. |
int |
getHead()
To get the head of this predicate. |
int |
getID()
Returns the unique identifier for this predicate |
Term |
getParam()
To get the parameter list of this predicate. |
int |
getVarCount()
To get the number of variables for this predicate. |
boolean |
isGround()
To check if this predicate is ground (i.e., has no variables). |
boolean |
isVar()
To check if this predicate is a variable symbol or a real predicate. |
void |
print()
This function is used to print this predicate. |
void |
print(java.lang.String[] constants)
This function is used to print this predicate. |
void |
setVarCount(int varCountIn)
To set the number of variables for this predicate. |
java.lang.String |
toCode()
This function produces Java code to create this predicate. |
java.lang.String |
toString()
This function returns a printable String representation of
this predicate. |
java.lang.String |
toString(java.lang.String[] constants)
This function returns a printable String representation of
this predicate. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
private int head
private Term param
private int varCount
private int varIdx
private static int staticID
private int ID
Constructor Detail |
---|
public Predicate(int headIn, int varCountIn, Term paramIn)
headIn
- the head of the predicate.varCountIn
- number of the variables of the predicate.paramIn
- the argument list of the predicate.public Predicate(int varIdxIn, int varCountIn)
varIdxIn
- the index of the variable symbol that represents this predicate.varCountIn
- number of the variables of the predicate.Method Detail |
---|
public Predicate applySubstitution(Term[] bindings)
bindings
- the binding to be applied.
public boolean equals(Term t)
t
- the argument list of the other predicate.
true
if the two argument lists are equal,
false
otherwise.public Term[] findUnifier(Term t)
t
- the argument list of the other predicate.
null
otherwise.public int getHead()
public Term getParam()
public int getVarCount()
public boolean isGround()
true
if this predicate is ground, false
otherwise.public boolean isVar()
true
if this predicate is a variable symbol,
false
if it is a real predicate.public void print()
public void print(java.lang.String[] constants)
constants
- what String
should each constant symbol be mapped
to.public void setVarCount(int varCountIn)
varCountIn
- the number of variables for this predicate.public java.lang.String toCode()
toCode
in class CompileTimeObject
String
.public java.lang.String toString()
String
representation of
this predicate. This function is used to print the predicates known to be
logical atoms, because the indexes in this predicate representing
constant symbols are mapped back by default to String
representations of the constant symbols in logical atoms.
toString
in class java.lang.Object
String
representation of this predicate.public java.lang.String toString(java.lang.String[] constants)
String
representation of
this predicate. This function is used to print predicates other than
logical atoms (such as task atoms).
constants
- what String
should each constant symbol be mapped
to.
String
representation of this predicate.public int getID()
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |