public class PLList extends PLTerm
PLTerm.nil
static
field, due to the serialization mechanism of Prolog terms, that
represents the empty list as an atom, not a list.Constructor and Description |
---|
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.
|
Modifier and Type | Method and Description |
---|---|
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.
|
isAtom, isFloat, isInteger, isList, isNil, isString, isStructure, isVariable
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.PLException
public PLList(PLTerm[] list) throws PLException
list
- Java list that contains the elements that must be
included in the Prolog list.PLException
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.PLException
public java.lang.String toString()
public java.lang.Object javaRepr(CiaoJava.PLInterpreter i)
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
tail
- PLList
object or
PLTerm.nil
to be appended at the
end of this list.PLException
public boolean equals(PLTerm t)
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.public boolean unify(PLTerm term)
public int length()
PLList
.