Modifier and Type | Field and Description |
---|---|
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.
|
Modifier and Type | Method and Description |
---|---|
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.
|
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 Valuesint 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
- an illegal term was detectedjava.lang.Exception
- something went wrongvoid delete() throws java.lang.Exception
java.lang.Exception
- something went wrongTerm 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
- the thread was interruptedjava.lang.Exception
- something went wrongdouble getDouble() throws ConversionFailedException, IllegalTermException, java.lang.Exception
double
.ConversionFailedException
- The term could not be converted to a double.IllegalTermException
- an illegal term was detectedjava.lang.Exception
- something went wrongint getFunctorArity() throws ConversionFailedException, IllegalTermException, java.lang.Exception
int
.ConversionFailedException
- The term could not be converted to the arity of a functor.IllegalTermException
- an illegal term was detectedjava.lang.Exception
- something went wrongjava.lang.String getFunctorName() throws ConversionFailedException, IllegalTermException, java.lang.Exception
String
.ConversionFailedException
- The term could not be converted to the name of a functor.IllegalTermException
- an illegal term was detectedjava.lang.Exception
- something went wronglong getInteger() throws java.lang.Exception
long
.java.lang.Exception
- something went wrongTerm 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 tailjava.lang.InterruptedException
- the thread was interruptedjava.lang.Exception
- something went wrongjava.lang.String getListChars() throws java.lang.Exception
String
.java.lang.Exception
- something went wrongjava.lang.String getNumberChars() throws java.lang.Exception
String
.java.lang.Exception
- something went wrongjava.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
- something went wrongjava.lang.String getString() throws java.lang.Exception
String
.java.lang.Exception
- something went wrongboolean isAtom() throws java.lang.Exception
true
if the term is an atom; false
otherwisejava.lang.Exception
- something went wrongboolean isAtomic() throws java.lang.Exception
true
if the term is atomic; false
otherwisejava.lang.Exception
- something went wrongboolean isCompound() throws java.lang.Exception
true
if the term is a compound term;
false
otherwisejava.lang.Exception
- something went wrongboolean isEmptyList() throws java.lang.Exception
true
if the term is the atom []
;
false
otherwisejava.lang.Exception
- something went wrongboolean isFloat() throws java.lang.Exception
true
if the term is a float; false
otherwisejava.lang.Exception
- something went wrongboolean isInteger() throws java.lang.Exception
true
if the term is an integer; false
otherwisejava.lang.Exception
- something went wrongboolean isList() throws java.lang.Exception
isList(T) :- nonvar(T), T=[_|_].
true
if the term is a list cell; false
otherwisejava.lang.Exception
- something went wrongboolean isNumber() throws java.lang.Exception
true
if the term is a number; false
otherwisejava.lang.Exception
- something went wrongboolean 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
- something went wrongboolean isVariable() throws java.lang.Exception
true
if the term is a variable; false
otherwisejava.lang.Exception
- something went wrongjava.lang.String toString()
toString
in class java.lang.Object
java.lang.String toString(Term options) throws SPException, java.lang.Exception
options
- the options that are passet do write_term/3SPException
- A Prolog exception was thrown.java.lang.Exception
- something went wrongTerm[] toPrologTermArray() throws java.lang.Exception
java.lang.Exception
- something went wrongint type() throws java.lang.Exception
TYPE_INTEGER
, TYPE_FLOAT
,
TYPE_ATOM
, TYPE_VARIABLE
, and
TYPE_COMPOUND
java.lang.Exception
- something went wrongTYPE_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
- something went wrong