|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
Part of the PrologJ java API. This interface is implemented by objects encapsulating a Prolog term, together with the names and bound values (if any) of variables occurring in it.
| Method Summary | |
java.lang.Object |
getBinding(int number)
Accessor for the binding of a variable specified by relative position |
java.lang.Object |
getBinding(java.lang.String name)
Accessor for the binding of a variable specified by name |
int |
getNumberOfVariables()
Accessor for the number of variables in the encapsulated term |
java.lang.Object |
getTerm()
Accessor for the encapsulated term. |
void |
setVariable(int number,
java.lang.Object value)
Set a variable to a particular value before using the term encapsulated in this in a computation. |
void |
setVariable(java.lang.String name,
java.lang.Object value)
Set a variable to a particular value before using the term encapsulated in this in a computation. |
| Method Detail |
public int getNumberOfVariables()
public java.lang.Object getBinding(java.lang.String name)
throws java.lang.IllegalArgumentException
name - the name of the variable
java.lang.IllegalArgumentException - if the parameter is "_", or no
variable of the specified name occurs in the term.
public java.lang.Object getBinding(int number)
throws java.lang.ArrayIndexOutOfBoundsException
number - the number of the variable. Named variables are numbered
0, 1 ... in the order of first occurrence in the term. The
anonymous variable (_) is given a new number each time it occurs.
java.lang.ArrayIndexOutOfBoundsException - if number does not lie in
0 .. number of variables in the term - 1
public void setVariable(java.lang.String name,
java.lang.Object value)
throws java.lang.IllegalArgumentException
name - the name of the variablevalue - the value to set it to. "Setting" a value to null restores
it to the unset state.
java.lang.IllegalArgumentException - if the parameter is "_", or no
variable of the specified name occurs in the term.
public void setVariable(int number,
java.lang.Object value)
throws java.lang.ArrayIndexOutOfBoundsException
number - the number of the variable. Named variables are numbered
0, 1 ... in the order of first occurrence in the term. The
anonymous variable (_) is given a new number each time it occurs.value - the value to set it to. "Setting" a value to null restores
it to the unset state.
java.lang.ArrayIndexOutOfBoundsException - if number does not lie in
0 .. number of variables in the term - 1.public java.lang.Object getTerm()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||