|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Terms are Java representations of Prolog terms.
See SPTerm
for more information on the
implementation.
Field Summary | |
static int |
TYPE_ATOM
The term is an atom. |
static int |
TYPE_COMPOUND
The term is a compound term. |
static int |
TYPE_FLOAT
The term is a float. |
static int |
TYPE_INTEGER
The term is an integer. |
static int |
TYPE_VARIABLE
The term is a variable. |
Method Summary | |
int |
compare(Term with)
Compares two terms according to standard order. |
void |
delete()
Invalidates the Term object and make the SP_term_ref available for re-use. |
Term |
getArg(int i,
Term arg)
Gets an argument from a compound term. |
double |
getDouble()
Obtains the value of the Prolog float. |
int |
getFunctorArity()
Obtains the arity of a functor. |
java.lang.String |
getFunctorName()
Obtains the name of a functor. |
long |
getInteger()
Obtains the integer value of the Prolog term. |
Term |
getList(Term head,
Term tail)
Gets the head and tail of a Prolog list. |
java.lang.String |
getListChars()
Obtains the value of a list of characters as a string. |
java.lang.String |
getNumberChars()
Obtains the value of a Prolog number as a string. |
java.lang.Object |
getObject()
Not yet implemented in Multi threaded Jasper. |
java.lang.String |
getString()
Obtains the value of the Prolog atom as a string. |
boolean |
isAtom()
Tests if the term is an atom. |
boolean |
isAtomic()
Tests if the term is atomic. |
boolean |
isCompound()
Tests if the term is a compound term. |
boolean |
isEmptyList()
Tests if the term is the empty list. |
boolean |
isFloat()
Tests if the term is a float. |
boolean |
isInteger()
Tests if the term is an integer. |
boolean |
isList()
Tests if the term is a list cell. |
boolean |
isNumber()
Tests if the term is a number. |
boolean |
isValid()
Tests if the Prolog term referenced is still accessible through this object. |
boolean |
isVariable()
Tests if the term is a variable. |
Term[] |
toPrologTermArray()
Converts a list to an array of Terms. |
java.lang.String |
toString()
Returns a string-respresentation of a term. |
java.lang.String |
toString(Term options)
Returns a string-respresentation of a term. |
int |
type()
Returns the type of this term. |
boolean |
unify(Term with)
Unifies the term with another term. |
Field Detail |
public static final int TYPE_VARIABLE
type()
public static final int TYPE_INTEGER
type()
public static final int TYPE_ATOM
type()
public static final int TYPE_FLOAT
type()
public static final int TYPE_COMPOUND
type()
Method Detail |
public int compare(Term with) throws IllegalTermException, java.lang.Exception
with
- The term to compare with.x < y
, 0 if x == y
, and 1 if
x > y
.public void delete() throws java.lang.Exception
public Term getArg(int i, Term arg) throws java.lang.InterruptedException, java.lang.Exception
arg/3
with the third argument unbound.i
- The number of the argument.arg
- The term to which the i
th argument will
be assigned.public double getDouble() throws ConversionFailedException, IllegalTermException, java.lang.Exception
double
.ConversionFailedException
- The term could not be
converted to a double.public int getFunctorArity() throws ConversionFailedException, IllegalTermException, java.lang.Exception
int
.ConversionFailedException
- The term could not be
converted to the arity of a functor.public java.lang.String getFunctorName() throws ConversionFailedException, IllegalTermException, java.lang.Exception
String
.ConversionFailedException
- The term could not be
converted to the name of a functor.public long getInteger() throws java.lang.Exception
long
.public Term getList(Term head, Term tail) throws java.lang.InterruptedException, java.lang.Exception
head
- The term which will be assigned the headtail
- The term which will be assigned the tailpublic java.lang.String getListChars() throws java.lang.Exception
String
.public java.lang.String getNumberChars() throws java.lang.Exception
String
.public java.lang.Object getObject() throws java.lang.Exception
See SPTerm.getObject()
for documentation on
the single threaded implementation.
public java.lang.String getString() throws java.lang.Exception
String
.public boolean isAtom() throws java.lang.Exception
true
if the term is an atom; false
otherwisepublic boolean isAtomic() throws java.lang.Exception
true
if the term is atomic; false
otherwisepublic boolean isCompound() throws java.lang.Exception
true
if the term is a compound term;
false
otherwisepublic boolean isEmptyList() throws java.lang.Exception
true
if the term is the atom []
; false
otherwisepublic boolean isFloat() throws java.lang.Exception
true
if the term is a float; false
otherwisepublic boolean isInteger() throws java.lang.Exception
true
if the term is an integer; false
otherwisepublic boolean isList() throws java.lang.Exception
isList(T) :- nonvar(T), T=[_|_].
true
if the term is a list cell; false
otherwisepublic boolean isNumber() throws java.lang.Exception
true
if the term is a number; false
otherwisepublic boolean isValid() throws java.lang.Exception
delete
, closing,
cutting or asking for the nextSolution of an enclosing SPQuery.true
if still valid; false
otherwise.public boolean isVariable() throws java.lang.Exception
true
if the term is a variable; false
otherwisepublic java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String toString(Term options) throws SPException, java.lang.Exception
public Term[] toPrologTermArray() throws java.lang.Exception
public int type() throws java.lang.Exception
TYPE_INTEGER
, TYPE_FLOAT
,
TYPE_ATOM
, TYPE_VARIABLE
,
and TYPE_COMPOUND
TYPE_INTEGER
,
TYPE_ATOM
,
TYPE_FLOAT
,
TYPE_VARIABLE
,
TYPE_COMPOUND
,
isVariable()
,
isInteger()
,
isAtom()
,
isFloat()
,
isCompound()
,
isList()
,
isAtomic()
,
isNumber()
public boolean unify(Term with) throws java.lang.Exception
with
- The term with which to unify.
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |