|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectJSHOP2.CompileTimeObject
JSHOP2.List
public class List
Each list, both at compile time and at run time, is an instance of this
class. Lists are represented the same way they are represented in
LISP
, i.e., as a structure consisting of two
CONS
, where each CONS
can be a list itself.
Field Summary | |
---|---|
private Term |
head
The head of this list, a term. |
private Term |
tail
The tail of this list, a term. |
Fields inherited from class JSHOP2.CompileTimeObject |
---|
endl |
Constructor Summary | |
---|---|
List(Term headIn,
Term tailIn)
To initialize this list. |
Method Summary | |
---|---|
List |
append(Term t)
To append another term to the end of this list. |
List |
bindList(Term[] binding)
To apply a given binding to this list. |
boolean |
equals(List t)
Whether or not another list is equivalent to the this list. |
boolean |
findUnifierList(List l,
Term[] binding)
Find a unifier that will bind this list to another given list. |
Term |
getHead()
To get the head of this list, a term. |
List |
getRest()
To get the tail of this list as another list, assuming that the tail is indeed a list. |
Term |
getTail()
To get the tail of this list, a term. |
boolean |
isGroundList()
Is this list ground (i.e., has no variables)? |
static List |
MakeList(java.util.LinkedList<Term> listIn)
This function gets a LinkedList of terms as input and
returns a list the elements of which are the terms in the input
LinkedList in the reverse order. |
void |
print()
This function is used to print this list. |
java.lang.String |
toCode()
This function is used at compile time to produce Java code that when run, will create this list. |
java.lang.String |
toString()
This function is used to print the value of this list. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
private Term head
private Term tail
Constructor Detail |
---|
public List(Term headIn, Term tailIn)
headIn
- the term to be the head of this list.tailIn
- the term to be the tail of this list.Method Detail |
---|
public List append(Term t)
t
- the term to be appended to this list.
public List bindList(Term[] binding)
binding
- an array of terms, indexed by the integers associated with
variable symbols.
public boolean equals(List t)
t
- the list being compared to the this list.
true
if the two lists are equal, false
otherwise.public boolean findUnifierList(List l, Term[] binding)
l
- the list with which we are finding a unifier.binding
- the unifier to be returned.
false
if the two lists can not be unified,
true
otherwise.public Term getHead()
public List getRest()
public Term getTail()
public boolean isGroundList()
true
if this list is ground, false
otherwise.public static List MakeList(java.util.LinkedList<Term> listIn)
LinkedList
of terms as input and
returns a list the elements of which are the terms in the input
LinkedList
in the reverse order.
listIn
- the input LinkedList
.
public void print()
public java.lang.String toCode()
toCode
in class CompileTimeObject
String
.public java.lang.String toString()
toString
in class java.lang.Object
String
that shows the value of this
list.
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |