public abstract class PBTerm
extends java.lang.Object
Modifier and Type | Field | Description |
---|---|---|
protected java.lang.String |
name |
|
static PBTerm |
NIL |
The
PBTerm NIL , with the print name "[]", represents the
empty list. |
Modifier and Type | Method | Description |
---|---|---|
java.math.BigInteger |
bigIntegerValue() |
Returns the
BigInteger value of this
PBTerm . |
double |
floatValue() |
Returns the floating-point value of this PBTerm.
|
PBTerm |
getArgument(int index) |
Returns the argument at the specified index.
|
int |
getArity() |
Returns the number of arguments of this compound term or 0 if this
PBTerm is not a compound term. |
java.lang.String |
getName() |
Returns the name of this constant or compound term.
|
java.lang.String |
getString() |
If this
PBTerm is a proper list and all its elements are Unicode
character codes, either as integers or as one-character atoms, returns a
String with the list elements as the character codes of the
String . |
PBTerm |
head() |
Returns the head of this
PBTerm if it is a list cell, i.e. a compound
term with the functor ./2. |
long |
intValue() |
Returns the integer value of this
PBTerm . |
boolean |
isAtom() |
|
boolean |
isAtomic() |
|
boolean |
isBignum() |
|
boolean |
isCompound() |
|
boolean |
isEmptyList() |
|
boolean |
isFloat() |
|
boolean |
isInteger() |
|
boolean |
isListCell() |
Returns
true if this PBTerm is a list cell, i.e. a
compound term with the functor ./2, and false otherwise. |
boolean |
isNumber() |
|
boolean |
isProperList() |
|
boolean |
isString() |
Returns
true if this PBTerm is a proper list and all of
its elements are character codes or one character atoms. |
boolean |
isVariable() |
|
int |
length() |
If this
PBTerm is a proper list, returns its length. |
static PBTerm |
makeAtom(java.lang.String value) |
Creates a new
PBTerm instance representing an atom. |
static PBTerm |
makeTerm(double value) |
Creates a new
PBTerm instance representing a double value. |
static PBTerm |
makeTerm(float value) |
Creates a new
PBTerm instance representing a float value. |
static PBTerm |
makeTerm(int value) |
Creates a new
PBTerm instance representing an int value. |
static PBTerm |
makeTerm(long value) |
Creates a new
PBTerm instance representing a long value. |
static PBTerm |
makeTerm(java.lang.String value) |
Creates a new
PBTerm instance representing a list with the
characters, as integer values, in the string argument as its elements. |
static PBTerm |
makeTerm(java.lang.String name,
PBTerm[] arguments) |
Creates a new
PBTerm instance representing a compound term. |
static PBTerm |
makeTerm(java.math.BigInteger value) |
Creates a new
PBTerm instance representing a BigInteger value. |
static PBTerm |
makeTerm(PBTerm head,
PBTerm tail) |
Creates a new
PBTerm instance representing a list cell. |
protected java.lang.String |
stuffAtom(java.lang.String atom) |
|
PBTerm |
tail() |
Returns the tail of this
PBTerm if it is a list cell, i.e. a compound
term with the functor ./2. |
abstract java.lang.String |
toString() |
Returns a string description of this term.
|
public static final PBTerm NIL
PBTerm
NIL
, with the print name "[]", represents the
empty list.protected final java.lang.String name
public boolean isAtom()
public boolean isAtomic()
true
if this PBTerm
is a constant (e.g. integer,
floating-point number, or atom) and false
if this PBTerm
is a compound term or variable.public boolean isNumber()
public boolean isInteger()
public boolean isBignum()
public boolean isFloat()
public boolean isCompound()
public boolean isListCell()
true
if this PBTerm
is a list cell, i.e. a
compound term with the functor ./2, and false
otherwise.public boolean isProperList()
public boolean isEmptyList()
public boolean isString()
true
if this PBTerm
is a proper list and all of
its elements are character codes or one character atoms. Returns
false
otherwise.public PBTerm head()
PBTerm
if it is a list cell, i.e. a compound
term with the functor ./2.java.lang.IllegalStateException
- if this PBTerm
is not a list cell.public PBTerm tail()
PBTerm
if it is a list cell, i.e. a compound
term with the functor ./2.java.lang.IllegalStateException
- if this PBTerm
is not a list cell.public boolean isVariable()
public java.lang.String getName()
public PBTerm getArgument(int index)
index
- the (one based) index of the argumentPBTerm
java.lang.IllegalStateException
- if this term is not compoundpublic int length()
PBTerm
is a proper list, returns its length.java.lang.IllegalStateException
- if this PBTerm
is not a proper list.public int getArity()
PBTerm
is not a compound term.public long intValue()
PBTerm
.java.lang.IllegalStateException
- if this PBTerm
is not an integer.public java.math.BigInteger bigIntegerValue()
BigInteger
value of this
PBTerm
.java.lang.IllegalStateException
- if this PBTerm
is not a bignum integer.BigInteger
public double floatValue()
java.lang.IllegalStateException
- if this PBTerm
is not a number.public java.lang.String getString()
PBTerm
is a proper list and all its elements are Unicode
character codes, either as integers or as one-character atoms, returns a
String
with the list elements as the character codes of the
String
.String
corresponding to this listjava.lang.IllegalStateException
- if this PBTerm
is not a proper list.public abstract java.lang.String toString()
toString
in class java.lang.Object
public static PBTerm makeTerm(float value)
PBTerm
instance representing a float value.value
- should be finitepublic static PBTerm makeTerm(double value)
PBTerm
instance representing a double value.value
- should be finitepublic static PBTerm makeTerm(int value)
PBTerm
instance representing an int value.value
- the value to representpublic static PBTerm makeTerm(long value)
PBTerm
instance representing a long value.value
- the value to representpublic static PBTerm makeTerm(java.math.BigInteger value)
PBTerm
instance representing a BigInteger value.value
- the non-null value to representpublic static PBTerm makeTerm(java.lang.String value)
PBTerm
instance representing a list with the
characters, as integer values, in the string argument as its elements.value
- the non-null value to representpublic static PBTerm makeTerm(java.lang.String name, PBTerm[] arguments)
PBTerm
instance representing a compound term.name
- the name of the termarguments
- the, non-empty, arguments of the termpublic static PBTerm makeTerm(PBTerm head, PBTerm tail)
PBTerm
instance representing a list cell.head
- the first argument of the list celltail
- the second argument of the list cellpublic static PBTerm makeAtom(java.lang.String value)
PBTerm
instance representing an atom.value
- the non-null name of the atomprotected java.lang.String stuffAtom(java.lang.String atom)