com.ifcomputer.minerva
Class MinervaAtom

java.lang.Object
  |
  +--com.ifcomputer.minerva.MinervaTerm
        |
        +--com.ifcomputer.minerva.MinervaAtom
All Implemented Interfaces:
java.util.Enumeration, java.io.Serializable

public class MinervaAtom
extends MinervaTerm
implements java.util.Enumeration, java.io.Serializable

The class MinervaAtom is used to represent a Minerva atom.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class com.ifcomputer.minerva.MinervaTerm
ATOM, COMPOUND, DOUBLE, LIST, LONG, OBJECT, VARIABLE
 
Constructor Summary
MinervaAtom(java.lang.String name)
          Constructs an MinervaAtom.
 
Method Summary
 boolean equals(java.lang.Object other)
          This function compares two terms.
 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.
 int hashCode()
          This function returns a hashcode for an atom (based on the external representation of the atom).
 boolean hasMoreElements()
          This function is used to implement the Enumeration interface.
 boolean isList()
          This function returns true if this is a Minerva list or a Minerva atom with value [].
 java.lang.Object nextElement()
           
 java.lang.String stringValue()
          This function returns the external representation of the atom.
 java.lang.String toString()
          This function returns the external representation of the atom.
 int typeOf()
          This function returns the type (VARIABLE, ATOM, etc.) of this term.
 
Methods inherited from class com.ifcomputer.minerva.MinervaTerm
reset, resolve, setValue
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MinervaAtom

public MinervaAtom(java.lang.String name)
Constructs an MinervaAtom.

Parameters:
name - The external representation of the atom.
Method Detail

equals

public boolean equals(java.lang.Object other)
This function compares two terms. If they are both atoms and have the same external representation, then the function returns true, otherwise the function returns false.

Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
This function returns a hashcode for an atom (based on the external representation of the atom).

Overrides:
hashCode in class java.lang.Object

stringValue

public java.lang.String stringValue()
This function returns the external representation of the atom.


toString

public java.lang.String toString()
This function returns the external representation of the atom.

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

isList

public boolean isList()
Description copied from class: MinervaTerm
This function returns true if this is a Minerva list or a Minerva atom with value [].

Overrides:
isList in class MinervaTerm

getStringArray

public java.lang.String[] getStringArray()
Description copied from class: MinervaTerm
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.

Overrides:
getStringArray in class MinervaTerm

getTermArray

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

Overrides:
getTermArray in class MinervaTerm

getListLength

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

Overrides:
getListLength in class MinervaTerm
java.lang.IllegalArgumentException

getEnumeration

public java.util.Enumeration getEnumeration()
                                     throws java.lang.IllegalArgumentException
Description copied from class: MinervaTerm
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.

Overrides:
getEnumeration in class MinervaTerm
java.lang.IllegalArgumentException

hasMoreElements

public boolean hasMoreElements()
This function is used to implement the Enumeration interface. The function returns true, if there are more elements in the enumeration; otherwise it returns false

Specified by:
hasMoreElements in interface java.util.Enumeration
See Also:
getEnumeration()

nextElement

public java.lang.Object nextElement()
Specified by:
nextElement in interface java.util.Enumeration