|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface Term
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()
Returns the object encapsulated in the Prolog term. |
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-representation of a term. |
int |
type()
Returns the type of this term. |
boolean |
unify(Term with)
Unifies the term with another term. |
Field Detail |
---|
static final int TYPE_VARIABLE
type()
,
Constant Field Valuesstatic final int TYPE_INTEGER
type()
,
Constant Field Valuesstatic final int TYPE_ATOM
type()
,
Constant Field Valuesstatic final int TYPE_FLOAT
type()
,
Constant Field Valuesstatic final int TYPE_COMPOUND
type()
,
Constant Field ValuesMethod Detail |
---|
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
.
IllegalTermException
java.lang.Exception
void delete() throws java.lang.Exception
java.lang.Exception
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.
java.lang.InterruptedException
java.lang.Exception
double getDouble() throws ConversionFailedException, IllegalTermException, java.lang.Exception
double
.
ConversionFailedException
- The term could not be
converted to a double.
IllegalTermException
java.lang.Exception
int getFunctorArity() throws ConversionFailedException, IllegalTermException, java.lang.Exception
int
.
ConversionFailedException
- The term could not be
converted to the arity of a functor.
IllegalTermException
java.lang.Exception
java.lang.String getFunctorName() throws ConversionFailedException, IllegalTermException, java.lang.Exception
String
.
ConversionFailedException
- The term could not be
converted to the name of a functor.
IllegalTermException
java.lang.Exception
long getInteger() throws java.lang.Exception
long
.
java.lang.Exception
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 tail
java.lang.InterruptedException
java.lang.Exception
java.lang.String getListChars() throws java.lang.Exception
String
.
java.lang.Exception
java.lang.String getNumberChars() throws java.lang.Exception
String
.
java.lang.Exception
java.lang.Object getObject() throws java.lang.Exception
Prolog.newObjectTerm(java.lang.Object)
.
See SPTerm.getObject()
for documentation on
the single threaded implementation.
java.lang.Exception
java.lang.String getString() throws java.lang.Exception
String
.
java.lang.Exception
boolean isAtom() throws java.lang.Exception
true
if the term is an atom; false
otherwise
java.lang.Exception
boolean isAtomic() throws java.lang.Exception
true
if the term is atomic; false
otherwise
java.lang.Exception
boolean isCompound() throws java.lang.Exception
true
if the term is a compound term;
false
otherwise
java.lang.Exception
boolean isEmptyList() throws java.lang.Exception
true
if the term is the atom []
; false
otherwise
java.lang.Exception
boolean isFloat() throws java.lang.Exception
true
if the term is a float; false
otherwise
java.lang.Exception
boolean isInteger() throws java.lang.Exception
true
if the term is an integer; false
otherwise
java.lang.Exception
boolean isList() throws java.lang.Exception
isList(T) :- nonvar(T), T=[_|_].
true
if the term is a list cell; false
otherwise
java.lang.Exception
boolean isNumber() throws java.lang.Exception
true
if the term is a number; false
otherwise
java.lang.Exception
boolean isValid() throws java.lang.Exception
delete
, closing,
cutting or asking for the nextSolution of an enclosing SPQuery.
true
if still valid; false
otherwise.
java.lang.Exception
boolean isVariable() throws java.lang.Exception
true
if the term is a variable; false
otherwise
java.lang.Exception
java.lang.String toString()
toString
in class java.lang.Object
java.lang.String toString(Term options) throws SPException, java.lang.Exception
SPException
java.lang.Exception
Term[] toPrologTermArray() throws java.lang.Exception
java.lang.Exception
int type() throws java.lang.Exception
TYPE_INTEGER
, TYPE_FLOAT
,
TYPE_ATOM
, TYPE_VARIABLE
,
and TYPE_COMPOUND
java.lang.Exception
TYPE_INTEGER
,
TYPE_ATOM
,
TYPE_FLOAT
,
TYPE_VARIABLE
,
TYPE_COMPOUND
,
isVariable()
,
isInteger()
,
isAtom()
,
isFloat()
,
isCompound()
,
isList()
,
isAtomic()
,
isNumber()
boolean unify(Term with) throws java.lang.Exception
with
- The term with which to unify.
java.lang.Exception
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |