|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectCiaoJava.PLTerm
CiaoJava.PLList
Java representation of a Prolog list. Contains a representation
of a Prolog list using the same head/tail structure of the Prolog lists
The last element of the list must be an empty list.
The empty list must be referred as the PLTerm.nil
static
field, due to the serialization mechanism of Prolog terms, that
represents the empty list as an atom, not a list.
Field Summary |
Fields inherited from class CiaoJava.PLTerm |
fail, nil, success |
Constructor Summary | |
PLList(PLTerm[] list)
Given a Java list, creates a Java PLList object containing the objects included in the Java list. |
|
PLList(PLTerm h,
PLTerm t)
Given a head and a tail, creates a Java PLList object. |
|
PLList(java.lang.String s)
Given a Java string, creates a Java PLList object containing the characters included in the Java string. |
Method Summary | |
void |
add(PLTerm term)
Adds a term as the tail of a PLList object. |
void |
append(PLTerm tail)
Appends the list given as argument as the tail of this PLList. |
PLTerm |
copy()
Makes a full copy of this PLList Prolog list
object. |
boolean |
equals(PLTerm t)
Compares the PLList object with the PLTerm given as argument. |
PLTerm |
getHead()
Gets the head of a PLList object. |
PLTerm |
getTail()
Gets the tail of a PLList object. |
boolean |
isRunnable()
Execution test on Prolog objects. |
java.lang.Object |
javaRepr(CiaoJava.PLInterpreter i)
Java representation of a PLList. |
int |
length()
Returns the number of elements of this PLList . |
java.lang.String |
toString()
String representation of a Java PLList object. |
boolean |
unify(PLTerm term)
Term unification. |
Methods inherited from class CiaoJava.PLTerm |
isInteger, isList, isNil, isString, isStructure, isVariable |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public PLList(PLTerm h, PLTerm t) throws PLException
PLList
.
h
- First element of the list. Can be any Prolog term.t
- Rest of the list. Must be nil (if the list contains
just one element), or another PLList
object.public PLList(PLTerm[] list) throws PLException
list
- Java list that contains the elements that must be
included in the Prolog list.public PLList(java.lang.String s) throws PLException
s
- Java string that contains the characters that must be
included in the Prolog list as elements.Method Detail |
public java.lang.String toString()
toString
in class PLTerm
public java.lang.Object javaRepr(CiaoJava.PLInterpreter i)
javaRepr
in class PLTerm
i
- PLInterpreter
object used to do
the interpretation. Included here only for
compatibility purposes with the PLTerm
abstract class.
Object
array.public boolean isRunnable()
PLTerm
class.
isRunnable
in class PLTerm
false
.public PLTerm getHead()
public PLTerm getTail()
public void add(PLTerm term) throws PLException
term
- PLTerm
object to be appended at the
end of this list.
PLException
public void append(PLTerm tail) throws PLException
PLException
public boolean equals(PLTerm t)
equals
in class PLTerm
t
- Prolog term to be compared to.
true
if this term is equal to
the term received as argument;
false
otherwise.public PLTerm copy()
PLList
Prolog list
object. Recursively clones the elements of this term, in order to
return a separated copy of all the elements included
in this list.
copy
in class PLTerm
PLTerm
object that is a full
copy of this list. All the elements of this list
are copied in turn.public boolean unify(PLTerm term)
unify
in class PLTerm
term
- Term to unify with.
true
if the unification is successful;
false
otherwise.public int length()
PLList
.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |