com.ifcomputer.minerva
Class MinervaTerm

java.lang.Object
  |
  +--com.ifcomputer.minerva.MinervaTerm
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
MinervaAtom, MinervaNumber, MinervaObject, MinervaStruct, MinervaVariable

public abstract class MinervaTerm
extends java.lang.Object
implements java.io.Serializable

The class MinervaTerm and its subclasses are used for representing Minerva terms. With this classes you can pass terms from Java to Minerva and vice versa. However, this term representation is not used by the Minerva kernel. It will be transformed in a more compact format, which can be handled more efficiently by the Minerva engine.

See Also:
Serialized Form

Field Summary
static int ATOM
          Constant used to specify an Minerva atom
static int COMPOUND
          Constant used to specify an Minerva compound term (except lists)
static int DOUBLE
          Constant used to specify an Minerva floating point value
static int LIST
          Constant used to specify an Minerva list.
static int LONG
          Constant used to specify an Minerva integer value
static int OBJECT
          Constant used to specify an Java Object wrapped by a Minerva term
static int VARIABLE
          Constant used to specify an Minerva variable
 
Constructor Summary
MinervaTerm()
           
 
Method Summary
 java.util.Enumeration getEnumeration()
          This functions returns an enumeration for the elements of a Minerva list.
 int getListLength()
          This function returns the length of a Minerva list.
 java.lang.String[] getStringArray()
          If this is a Minerva list, then the function returns a list of strings, representing each element of the list.
 com.ifcomputer.minerva.MinervaTerm[] getTermArray()
          If this is a Minerva list, then the function returns a list of Minerva terms, containing all elements of the list.
 boolean isList()
          This function returns true if this is a Minerva list or a Minerva atom with value [].
 void reset()
          This function is used to unbind all variables (MinervaVariable) in this term.
 com.ifcomputer.minerva.MinervaTerm resolve()
          This function is used to create a copy of this term, where all bound variable will be replaced by the term to which they are bound
 void setValue(com.ifcomputer.minerva.MinervaTerm term)
          This function is only applicable on Minerva variables.
abstract  int typeOf()
          This function returns the type (VARIABLE, ATOM, etc.) of this term.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

VARIABLE

public static final int VARIABLE
Constant used to specify an Minerva variable

See Also:
typeOf(), Constant Field Values

ATOM

public static final int ATOM
Constant used to specify an Minerva atom

See Also:
typeOf(), Constant Field Values

LONG

public static final int LONG
Constant used to specify an Minerva integer value

See Also:
typeOf(), Constant Field Values

DOUBLE

public static final int DOUBLE
Constant used to specify an Minerva floating point value

See Also:
typeOf(), Constant Field Values

OBJECT

public static final int OBJECT
Constant used to specify an Java Object wrapped by a Minerva term

See Also:
typeOf(), Constant Field Values

COMPOUND

public static final int COMPOUND
Constant used to specify an Minerva compound term (except lists)

See Also:
typeOf(), Constant Field Values

LIST

public static final int LIST
Constant used to specify an Minerva list. Be aware that the type of an empty list [] is not List but ATOM

See Also:
typeOf(), Constant Field Values
Constructor Detail

MinervaTerm

public MinervaTerm()
Method Detail

typeOf

public abstract int typeOf()
This function returns the type (VARIABLE, ATOM, etc.) of this term.

See Also:
VARIABLE, ATOM, LONG, DOUBLE, OBJECT, COMPOUND, LIST

reset

public void reset()
This function is used to unbind all variables (MinervaVariable) in this term.

See Also:
MinervaVariable.setValue(com.ifcomputer.minerva.MinervaTerm)

setValue

public void setValue(com.ifcomputer.minerva.MinervaTerm term)
              throws java.lang.IllegalArgumentException
This function is only applicable on Minerva variables.

java.lang.IllegalArgumentException
See Also:
MinervaVariable.setValue(com.ifcomputer.minerva.MinervaTerm)

resolve

public com.ifcomputer.minerva.MinervaTerm resolve()
This function is used to create a copy of this term, where all bound variable will be replaced by the term to which they are bound

See Also:
MinervaVariable.setValue(com.ifcomputer.minerva.MinervaTerm), reset()

isList

public boolean isList()
This function returns true if this is a Minerva list or a Minerva atom with value [].


getEnumeration

public java.util.Enumeration getEnumeration()
                                     throws java.lang.IllegalArgumentException
This functions returns an enumeration for the elements of a Minerva list. If this is not a Minerva list then the function throws an IllegalArgumentException.

java.lang.IllegalArgumentException

getStringArray

public java.lang.String[] getStringArray()
                                  throws java.lang.IllegalArgumentException
If this is a Minerva list, then the function returns a list of strings, representing each element of the list. If this is not a Minerva list, then the function throws an IllegalArgumentException.

java.lang.IllegalArgumentException

getTermArray

public com.ifcomputer.minerva.MinervaTerm[] getTermArray()
                                                  throws java.lang.IllegalArgumentException
If this is a Minerva list, then the function returns a list of Minerva terms, containing all elements of the list. If this is not a Minerva list, then the function throws an IllegalArgumentException.

java.lang.IllegalArgumentException

getListLength

public int getListLength()
                  throws java.lang.IllegalArgumentException
This function returns the length of a Minerva list. If this is not a valid Minerva list, the function throws an IllegalArgumentException.

java.lang.IllegalArgumentException