se.sics.prologbeans
Class PBCompound
java.lang.Object
|
+--se.sics.prologbeans.Term
|
+--se.sics.prologbeans.PBCompound
- Direct Known Subclasses:
- PBList
- public class PBCompound
- extends Term
PBCompound
is the Java representation of Prolog compound
terms and atoms (such as the empty list).
Fields inherited from class se.sics.prologbeans.Term |
name |
Method Summary |
Term |
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
term is not a compound term. |
boolean |
isAtom()
Returns true if this term is an atom and
false otherwise. |
boolean |
isAtomic()
Returns true if this term is a constant
(e.g. |
java.lang.String |
toString()
Returns a string description of this term. |
Methods inherited from class se.sics.prologbeans.Term |
doubleValue, floatValue, getName, intValue, isCompound, isFloat, isInteger, isList, isString, isVariable, longValue, stuffAtom |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
arguments
protected final Term[] arguments
isAtom
public boolean isAtom()
- Description copied from class:
Term
- Returns
true
if this term is an atom and
false
otherwise.
- Overrides:
isAtom
in class Term
isAtomic
public boolean isAtomic()
- Description copied from class:
Term
- Returns
true
if this term is a constant
(e.g. integer, floating-point number, or atom) and
false
if this term is a compound term or variable.
- Overrides:
isAtomic
in class Term
getArgument
public Term getArgument(int index)
- Description copied from class:
Term
- Returns the argument at the specified index. Only compound terms
have arguments. Note: the arguments are indexed from 1 to arity.
- Overrides:
getArgument
in class Term
- Following copied from class:
se.sics.prologbeans.Term
- Parameters:
index
- the (one based) index of the argument- Returns:
- the argument as a Term
- Throws:
java.lang.IllegalStateException
- if this term is not compound
getArity
public int getArity()
- Description copied from class:
Term
- Returns the number of arguments of this compound term or 0 if this
term is not a compound term.
- Overrides:
getArity
in class Term
toString
public java.lang.String toString()
- Description copied from class:
Term
- Returns a string description of this term.
- Overrides:
toString
in class Term