|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object
|
+--com.ifcomputer.minerva.MinervaTerm
|
+--com.ifcomputer.minerva.MinervaStruct
|
+--com.ifcomputer.minerva.MinervaList
The class MinervaList is used to represent a
Minerva list term.
| Field Summary |
| Fields inherited from class com.ifcomputer.minerva.MinervaTerm |
ATOM, COMPOUND, DOUBLE, LIST, LONG, OBJECT, VARIABLE |
| Constructor Summary | |
MinervaList()
Constructs a Minerva list with undefined head and tail (use 'new MinervaAtom("[]")' to construct an empty list). |
|
MinervaList(com.ifcomputer.minerva.MinervaTerm head,
com.ifcomputer.minerva.MinervaTerm tail)
Constructs a Minerva list (use 'new MinervaAtom("[]")' to construct an empty list) |
|
| Method Summary | |
static com.ifcomputer.minerva.MinervaTerm |
create(com.ifcomputer.minerva.MinervaTerm[] args)
Constructs a Minerva list, where the list arguments are extracted from the int array 'args'. |
static com.ifcomputer.minerva.MinervaTerm |
create(com.ifcomputer.minerva.MinervaTerm[] args,
int off,
int len)
Constructs a Minerva list, where the list arguments are extracted from the int array 'args'. |
static com.ifcomputer.minerva.MinervaTerm |
create(java.lang.String[] args)
Constructs a Minerva list, where the list arguments are atoms. |
static com.ifcomputer.minerva.MinervaTerm |
create(java.lang.String[] args,
int off,
int len)
Constructs a Minerva list, where the list arguments are atoms. |
boolean |
equals(java.lang.Object other)
This function returns true, if 'other' is a list and the arguments of 'other' and 'this' are equal. |
com.ifcomputer.minerva.MinervaTerm |
getArg(int i)
This function returns the i-th argument (0 <= i < 2) of a list, where argument 0 is the head of a list and argument 1 is the tail of the list |
int |
getArity()
This function returns the arity of a list term (2) |
java.util.Enumeration |
getEnumeration()
This functions returns an enumeration for the elements of a Minerva list. |
java.lang.String |
getFunctor()
This function returns the functor of a list term (".") |
com.ifcomputer.minerva.MinervaTerm |
getHead()
This function returns the head of the list. |
int |
getListLength()
This function returns the length of a Minerva list. |
java.lang.String[] |
getStringArray()
If this is a Minerva list, then the function
returns a list of strings, representing each element of
the list. |
com.ifcomputer.minerva.MinervaTerm |
getTail()
This function returns the tail of the list. |
com.ifcomputer.minerva.MinervaTerm[] |
getTermArray()
If this is a Minerva list, then the function
returns a list of Minerva terms, containing all elements of
the list. |
int |
hashCode()
This function calculates a hashcode for a list term. |
boolean |
isList()
This function returns true if this is
a Minerva list or a Minerva atom with value []. |
void |
reset()
This function is used to unbind all variables ( MinervaVariable) in this term. |
com.ifcomputer.minerva.MinervaTerm |
resolve()
This function is used to create a copy of this term,
where all bound variable will be replaced by the term to which
they are bound |
void |
setArg(int i,
com.ifcomputer.minerva.MinervaTerm term)
This function replaces the i-th argument of a compound term by 'term' (argument 0 is the head of the list; argument 1 is the tail of the list). |
void |
setHead(com.ifcomputer.minerva.MinervaTerm term)
This function replaces the head of the list by 'term'. |
void |
setTail(com.ifcomputer.minerva.MinervaTerm term)
This function replaces the head of the list by 'term'. |
java.lang.String |
toString()
Stringifies a list term. |
int |
typeOf()
This function returns the type ( VARIABLE,
ATOM, etc.) of this term. |
| Methods inherited from class com.ifcomputer.minerva.MinervaTerm |
setValue |
| Methods inherited from class java.lang.Object |
getClass, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
public MinervaList(com.ifcomputer.minerva.MinervaTerm head,
com.ifcomputer.minerva.MinervaTerm tail)
head - the head of the listtail - the tail of the listpublic MinervaList()
| Method Detail |
public static com.ifcomputer.minerva.MinervaTerm create(java.lang.String[] args)
args - the arguments of the list
public static com.ifcomputer.minerva.MinervaTerm create(java.lang.String[] args,
int off,
int len)
args - the arguments of the listoff - the offset of the first argument in args that should
be used as list argument.len - len-1 is the index of the last argument in args that
should be used as list argument.public static com.ifcomputer.minerva.MinervaTerm create(com.ifcomputer.minerva.MinervaTerm[] args)
args - the arguments of the list
public static com.ifcomputer.minerva.MinervaTerm create(com.ifcomputer.minerva.MinervaTerm[] args,
int off,
int len)
args - the arguments of the listoff - the offset of the first argument in args that should
be used as list argument.len - len-1 is the index of the last argument in args that
should be used as list argument.public void reset()
MinervaTermMinervaVariable) in this term.
reset in class MinervaTermMinervaVariable.setValue(com.ifcomputer.minerva.MinervaTerm)public com.ifcomputer.minerva.MinervaTerm resolve()
MinervaTermthis term,
where all bound variable will be replaced by the term to which
they are bound
resolve in class MinervaTermMinervaVariable.setValue(com.ifcomputer.minerva.MinervaTerm),
MinervaTerm.reset()public java.lang.String getFunctor()
getFunctor in class MinervaStructpublic int getArity()
getArity in class MinervaStructpublic com.ifcomputer.minerva.MinervaTerm getArg(int i)
getArg in class MinervaStructi - argument index
public void setArg(int i,
com.ifcomputer.minerva.MinervaTerm term)
setArg in class MinervaStructi - argument index (0 <= index < 2)term - term by which the selected argument has to be replacedpublic com.ifcomputer.minerva.MinervaTerm getHead()
public com.ifcomputer.minerva.MinervaTerm getTail()
public void setHead(com.ifcomputer.minerva.MinervaTerm term)
public void setTail(com.ifcomputer.minerva.MinervaTerm term)
public boolean equals(java.lang.Object other)
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Objectpublic java.lang.String toString()
toString in class java.lang.Objectpublic int typeOf()
MinervaTermVARIABLE,
ATOM, etc.) of this term.
typeOf in class MinervaTermMinervaTerm.VARIABLE,
MinervaTerm.ATOM,
MinervaTerm.LONG,
MinervaTerm.DOUBLE,
MinervaTerm.OBJECT,
MinervaTerm.COMPOUND,
MinervaTerm.LISTpublic boolean isList()
MinervaTermtrue if this is
a Minerva list or a Minerva atom with value [].
isList in class MinervaTerm
public java.util.Enumeration getEnumeration()
throws java.lang.IllegalArgumentException
MinervaTermthis is not a Minerva list then
the function throws an IllegalArgumentException.
getEnumeration in class MinervaTermjava.lang.IllegalArgumentException
public java.lang.String[] getStringArray()
throws java.lang.IllegalArgumentException
MinervaTermthis is a Minerva list, then the function
returns a list of strings, representing each element of
the list. If this is not a Minerva list, then
the function throws an IllegalArgumentException.
getStringArray in class MinervaTermjava.lang.IllegalArgumentException
public com.ifcomputer.minerva.MinervaTerm[] getTermArray()
throws java.lang.IllegalArgumentException
MinervaTermthis is a Minerva list, then the function
returns a list of Minerva terms, containing all elements of
the list. If this is not a Minerva list, then
the function throws an IllegalArgumentException.
getTermArray in class MinervaTermjava.lang.IllegalArgumentException
public int getListLength()
throws java.lang.IllegalArgumentException
MinervaTermthis is not a valid Minerva list, the
function throws an IllegalArgumentException.
getListLength in class MinervaTermjava.lang.IllegalArgumentException
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||