PBTerm
is the .NET representations of Prolog terms.
Field Summary | |
---|---|
public static final PBTerm |
NIL
|
protected final string |
name
|
Method Summary | |
---|---|
public bool |
isAtom()
Returns true if this PBTerm is an atom and
false otherwise. |
public bool |
isAtomic()
Returns 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 bool |
isNumber()
Returns true if this PBTerm is a number and
false otherwise. |
public bool |
isInteger()
Returns true if this PBTerm is an integer and
false otherwise. |
public bool |
isBignum()
Returns true if this PBTerm is an bignum
integer and false otherwise. |
public bool |
isFloat()
Returns true if this PBTerm is a
floating-point number and false otherwise. |
public bool |
isCompound()
Returns true if this PBTerm is a compund
term and false otherwise. |
public bool |
isListCell()
Returns true if this PBTerm is a list cell,
i.e. a compound term with the functor ./2, and false
otherwise. |
public bool |
isProperList()
Returns true if this PBTerm is a proper list
and false otherwise. |
public bool |
isEmptyList()
Returns true if this PBTerm is the empty list
and false otherwise. |
public bool |
isString()
Returns true if this PBTerm is a proper
list and all of its elements are character codes or one character atoms. |
public PBTerm |
head()
Returns the head of this PBTerm if it is a list cell, i.e. |
public PBTerm |
tail()
Returns the tail of this PBTerm if it is a list cell, i.e. |
public bool |
isVariable()
Returns true if this PBTerm is a variable and
false otherwise. |
public string |
getName()
Returns the name of this constant or compound term. |
public PBTerm |
getArgument(int index)
Returns the argument at the specified index. |
public int |
length()
If this PBTerm is a proper list, returns its length. |
public int |
getArity()
Returns the number of arguments of this compound term or 0 if this PBTerm is not a compound term. |
public long |
intValue()
Returns the integer value of this PBTerm . |
public BigInteger |
bigIntegerValue()
Returns the BigInteger value of this PBTerm . |
public double |
floatValue()
Returns the floating-point value of this PBTerm. |
public string |
getString()
If this PBTerm is a proper list and all its elements are
small integers (less than 256), returns a string with the list elements
as the character codes of the string. |
public abstract string |
toString()
Returns a string description of this term. |
public static PBTerm |
makeTerm(float value)
Creates a new PBTerm instance representing a float value. |
public static PBTerm |
makeTerm(double value)
Creates a new PBTerm instance representing a double value. |
public static PBTerm |
makeTerm(int value)
Creates a new PBTerm instance representing an int value. |
public static PBTerm |
makeTerm(long value)
Creates a new PBTerm instance representing a long value. |
public static PBTerm |
makeTerm(BigInteger value)
Creates a new PBTerm instance representing a BigInteger
value. |
public static PBTerm |
makeTerm(string value)
Creates a new PBTerm instance representing a list with
the characters, as integer values, in the string argument as its
elements. |
public static PBTerm |
makeTerm(string name, PBTerm[] arguments)
Creates a new PBTerm instance representing a compound
term. |
public static PBTerm |
makeTerm(PBTerm head, PBTerm tail)
Creates a new PBTerm instance representing a list cell. |
public static PBTerm |
makeAtom(string value)
Creates a new PBTerm instance representing an atom. |
protected string |
stuffAtom(string atom)
|
Field Detail |
---|
public static final PBTerm NIL
PBTerm
NIL
, with the printname "[]",
represents the empty list.
protected final string name
Method Detail |
---|
public bool isAtom()
true
if this PBTerm
is an atom and
false
otherwise.
public bool 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 bool isNumber()
true
if this PBTerm
is a number and
false
otherwise.
public bool isInteger()
true
if this PBTerm
is an integer and
false
otherwise.
public bool isBignum()
true
if this PBTerm
is an bignum
integer and false
otherwise.
public bool isFloat()
true
if this PBTerm
is a
floating-point number and false
otherwise.
public bool isCompound()
true
if this PBTerm
is a compund
term and false
otherwise.
public bool isListCell()
true
if this PBTerm
is a list cell,
i.e. a compound term with the functor ./2, and false
otherwise.
public bool isProperList()
true
if this PBTerm
is a proper list
and false
otherwise.
public bool isEmptyList()
true
if this PBTerm
is the empty list
and false
otherwise.
public bool 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.
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.
PBTerm
is
not a list cell.public bool isVariable()
true
if this PBTerm
is a variable and
false
otherwise.
public string getName()
public PBTerm getArgument(int index)
index
- the (one based) index of the argumentpublic int length()
PBTerm
is a proper list, returns its length.
PBTerm
is
not a proper list.public int getArity()
PBTerm
is not a compound term.
public long intValue()
PBTerm
.
PBTerm
is
not an integer.public BigInteger bigIntegerValue()
BigInteger
value of this PBTerm
.
PBTerm
is
not a bignum integer.public double floatValue()
PBTerm
is
not a number.public string getString()
PBTerm
is a proper list and all its elements are
small integers (less than 256), returns a string with the list elements
as the character codes of the string.
PBTerm
is
not a proper list.public abstract string toString()
public static PBTerm makeTerm(float value)
PBTerm
instance representing a float value.
public static PBTerm makeTerm(double value)
PBTerm
instance representing a double value.
public static PBTerm makeTerm(int value)
PBTerm
instance representing an int value.
public static PBTerm makeTerm(long value)
PBTerm
instance representing a long value.
public static PBTerm makeTerm(BigInteger value)
PBTerm
instance representing a BigInteger
value.
public static PBTerm makeTerm(string value)
PBTerm
instance representing a list with
the characters, as integer values, in the string argument as its
elements.
public static PBTerm makeTerm(string name, PBTerm[] arguments)
PBTerm
instance representing a compound
term.
public static PBTerm makeTerm(PBTerm head, PBTerm tail)
PBTerm
instance representing a list cell.
public static PBTerm makeAtom(string value)
PBTerm
instance representing an atom.
protected string stuffAtom(string atom)