com.ifcomputer.minerva
Class MinervaCompound

java.lang.Object
  |
  +--com.ifcomputer.minerva.MinervaTerm
        |
        +--com.ifcomputer.minerva.MinervaStruct
              |
              +--com.ifcomputer.minerva.MinervaCompound
All Implemented Interfaces:
java.io.Serializable

public class MinervaCompound
extends MinervaStruct
implements java.io.Serializable

The class MinervaCompound is used to represent a Minerva compound term.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class com.ifcomputer.minerva.MinervaTerm
ATOM, COMPOUND, DOUBLE, LIST, LONG, OBJECT, VARIABLE
 
Constructor Summary
MinervaCompound(java.lang.String functor, int arity)
          Constructs a Minerva compound term, where all arguments are undefined.
MinervaCompound(java.lang.String functor, com.ifcomputer.minerva.MinervaTerm a1)
          Constructs a compound term with arity 1.
MinervaCompound(java.lang.String functor, com.ifcomputer.minerva.MinervaTerm[] args)
          Constructs a Minerva compound term.
MinervaCompound(java.lang.String functor, com.ifcomputer.minerva.MinervaTerm a1, com.ifcomputer.minerva.MinervaTerm a2)
          Constructs a compound term with arity 2.
MinervaCompound(java.lang.String functor, com.ifcomputer.minerva.MinervaTerm a1, com.ifcomputer.minerva.MinervaTerm a2, com.ifcomputer.minerva.MinervaTerm a3)
          Constructs a compound term with arity 3.
MinervaCompound(java.lang.String functor, com.ifcomputer.minerva.MinervaTerm a1, com.ifcomputer.minerva.MinervaTerm a2, com.ifcomputer.minerva.MinervaTerm a3, com.ifcomputer.minerva.MinervaTerm a4)
          Constructs a compound term with arity 4.
MinervaCompound(java.lang.String functor, com.ifcomputer.minerva.MinervaTerm a1, com.ifcomputer.minerva.MinervaTerm a2, com.ifcomputer.minerva.MinervaTerm a3, com.ifcomputer.minerva.MinervaTerm a4, com.ifcomputer.minerva.MinervaTerm a5)
          Constructs a compound term with arity 5.
MinervaCompound(java.lang.String functor, com.ifcomputer.minerva.MinervaTerm a1, com.ifcomputer.minerva.MinervaTerm a2, com.ifcomputer.minerva.MinervaTerm a3, com.ifcomputer.minerva.MinervaTerm a4, com.ifcomputer.minerva.MinervaTerm a5, com.ifcomputer.minerva.MinervaTerm a6)
          Constructs a compound term with arity 6.
 
Method Summary
 boolean equals(java.lang.Object other)
          This function returns true, if 'this' and 'other' are identical terms, i.e. if both are compound terms with identical functor, arity and arguments.
 com.ifcomputer.minerva.MinervaTerm getArg(int i)
          This function retrieves the i-th argument of a compound term.
 int getArity()
          This function retrieves the arity of a compound term.
 java.lang.String getFunctor()
          This function retrieves the functor of a compound term.
 int hashCode()
          This function calculates a hashcode for a compoundterm.
 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 setArg(int i, com.ifcomputer.minerva.MinervaTerm term)
          This function replaces the i-th argument of a compound term by 'term'.
 java.lang.String toString()
          Stringifies a compound term.
 int typeOf()
          This function returns the type (VARIABLE, ATOM, etc.) of this term.
 
Methods inherited from class com.ifcomputer.minerva.MinervaTerm
getEnumeration, getListLength, getStringArray, getTermArray, isList, setValue
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MinervaCompound

public MinervaCompound(java.lang.String functor,
                       com.ifcomputer.minerva.MinervaTerm[] args)
Constructs a Minerva compound term.

Parameters:
functor - functor of the compound term
args - arguments of the compound term (args.length is the arity of the compound term; the arity must be greater than 0)

MinervaCompound

public MinervaCompound(java.lang.String functor,
                       int arity)
Constructs a Minerva compound term, where all arguments are undefined. The arguments must be set with the setArg function before the compound term may be passed to Minerva.

Parameters:
functor - functor of the compound term
arity - arity of the compound term
See Also:
setArg(int, com.ifcomputer.minerva.MinervaTerm)

MinervaCompound

public MinervaCompound(java.lang.String functor,
                       com.ifcomputer.minerva.MinervaTerm a1)
Constructs a compound term with arity 1.

Parameters:
functor - the functor of the compound term
a1 - the argument of the compound term

MinervaCompound

public MinervaCompound(java.lang.String functor,
                       com.ifcomputer.minerva.MinervaTerm a1,
                       com.ifcomputer.minerva.MinervaTerm a2)
Constructs a compound term with arity 2.

Parameters:
functor - the functor of the compound term
a1 - the 1st argument of the compound term
a2 - the 2nd argument of the compound term

MinervaCompound

public MinervaCompound(java.lang.String functor,
                       com.ifcomputer.minerva.MinervaTerm a1,
                       com.ifcomputer.minerva.MinervaTerm a2,
                       com.ifcomputer.minerva.MinervaTerm a3)
Constructs a compound term with arity 3.

Parameters:
functor - the functor of the compound term
a1 - the 1st argument of the compound term
a2 - the 2nd argument of the compound term
a3 - the 3th argument of the compound term

MinervaCompound

public MinervaCompound(java.lang.String functor,
                       com.ifcomputer.minerva.MinervaTerm a1,
                       com.ifcomputer.minerva.MinervaTerm a2,
                       com.ifcomputer.minerva.MinervaTerm a3,
                       com.ifcomputer.minerva.MinervaTerm a4)
Constructs a compound term with arity 4.

Parameters:
functor - the functor of the compound term
a1 - the 1st argument of the compound term
a2 - the 2nd argument of the compound term
a3 - the 3th argument of the compound term
a4 - the 4th argument of the compound term

MinervaCompound

public MinervaCompound(java.lang.String functor,
                       com.ifcomputer.minerva.MinervaTerm a1,
                       com.ifcomputer.minerva.MinervaTerm a2,
                       com.ifcomputer.minerva.MinervaTerm a3,
                       com.ifcomputer.minerva.MinervaTerm a4,
                       com.ifcomputer.minerva.MinervaTerm a5)
Constructs a compound term with arity 5.

Parameters:
functor - the functor of the compound term
a1 - the 1st argument of the compound term
a2 - the 2nd argument of the compound term
a3 - the 3th argument of the compound term
a4 - the 4th argument of the compound term
a5 - the 5th argument of the compound term

MinervaCompound

public MinervaCompound(java.lang.String functor,
                       com.ifcomputer.minerva.MinervaTerm a1,
                       com.ifcomputer.minerva.MinervaTerm a2,
                       com.ifcomputer.minerva.MinervaTerm a3,
                       com.ifcomputer.minerva.MinervaTerm a4,
                       com.ifcomputer.minerva.MinervaTerm a5,
                       com.ifcomputer.minerva.MinervaTerm a6)
Constructs a compound term with arity 6.

Parameters:
functor - the functor of the compound term
a1 - the 1st argument of the compound term
a2 - the 2nd argument of the compound term
a3 - the 3th argument of the compound term
a4 - the 4th argument of the compound term
a5 - the 5th argument of the compound term
a6 - the 6th argument of the compound term
Method Detail

reset

public void reset()
Description copied from class: MinervaTerm
This function is used to unbind all variables (MinervaVariable) in this term.

Overrides:
reset in class MinervaTerm
See Also:
MinervaVariable.setValue(com.ifcomputer.minerva.MinervaTerm)

resolve

public com.ifcomputer.minerva.MinervaTerm resolve()
Description copied from class: MinervaTerm
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

Overrides:
resolve in class MinervaTerm
See Also:
MinervaVariable.setValue(com.ifcomputer.minerva.MinervaTerm), MinervaTerm.reset()

getFunctor

public java.lang.String getFunctor()
This function retrieves the functor of a compound term.

Specified by:
getFunctor in class MinervaStruct

getArity

public int getArity()
This function retrieves the arity of a compound term.

Specified by:
getArity in class MinervaStruct

getArg

public com.ifcomputer.minerva.MinervaTerm getArg(int i)
This function retrieves the i-th argument of a compound term.

Specified by:
getArg in class MinervaStruct
Parameters:
i - argument index (0 <= index < arity)
Returns:
i-th argument of the compound term

setArg

public void setArg(int i,
                   com.ifcomputer.minerva.MinervaTerm term)
This function replaces the i-th argument of a compound term by 'term'.

Specified by:
setArg in class MinervaStruct
Parameters:
i - argument index (0 <= index < arity)
term - term by which the selected argument has to be replaced

equals

public boolean equals(java.lang.Object other)
This function returns true, if 'this' and 'other' are identical terms, i.e. if both are compound terms with identical functor, arity and arguments. Otherwise the function returns 'false'.

Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
This function calculates a hashcode for a compoundterm. The hashcode is valid as long as the arguments of the compound term will not be changed.

Overrides:
hashCode in class java.lang.Object

toString

public java.lang.String toString()
Stringifies a compound term. The format will be readable by the read-predicates of Minerva.

Overrides:
toString in class java.lang.Object

typeOf

public int typeOf()
Description copied from class: MinervaTerm
This function returns the type (VARIABLE, ATOM, etc.) of this term.

Specified by:
typeOf in class MinervaTerm
See Also:
MinervaTerm.VARIABLE, MinervaTerm.ATOM, MinervaTerm.LONG, MinervaTerm.DOUBLE, MinervaTerm.OBJECT, MinervaTerm.COMPOUND, MinervaTerm.LIST