CiaoJava
Class PLAtom

java.lang.Object
  extended byCiaoJava.PLTerm
      extended byCiaoJava.PLAtom

public class PLAtom
extends PLTerm

Prolog atom representation. This class is used to represent Prolog atoms and empty lists (The empty list [] is represented in Prolog and in the fast_read/fast_write format as an atom). This class does not represent numeric atoms; use instead PLInteger and PLFloat classes.


Field Summary
 
Fields inherited from class CiaoJava.PLTerm
fail, nil, success
 
Constructor Summary
PLAtom(java.lang.String name)
          Atom constructor.
 
Method Summary
 PLTerm copy()
          Makes a full copy of this PLAtom object.
 boolean equals(PLTerm term)
          comparison between Prolog terms.
 java.lang.String getName()
          Gets the name of this atom as a string.
 boolean isRunnable()
          Execution test on Prolog objects.
 java.lang.Object javaRepr()
          Gets the Java representation of the atom as an object (a String object).
 java.lang.Object javaRepr(CiaoJava.PLInterpreter i)
          Gets the Java representation of the atom as an object.
 java.lang.String toString()
          String representation of a Prolog atom.
 
Methods inherited from class CiaoJava.PLTerm
isInteger, isList, isNil, isString, isStructure, isVariable, unify
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PLAtom

public PLAtom(java.lang.String name)
Atom constructor. Creates a new atom object with its name given as argument.

Parameters:
name - Name of the Prolog atom.
Method Detail

toString

public java.lang.String toString()
String representation of a Prolog atom.

Specified by:
toString in class PLTerm
Returns:
The String representation of this atom.

javaRepr

public java.lang.Object javaRepr(CiaoJava.PLInterpreter i)
Gets the Java representation of the atom as an object.

Specified by:
javaRepr in class PLTerm
Parameters:
i - PLInterpreter object representing a Prolog to Java interpreter. Although is not used in this class, is included to implement the same method of class PLTerm.
Returns:
a Java Object with the name of this Prolog atom.

javaRepr

public java.lang.Object javaRepr()
Gets the Java representation of the atom as an object (a String object).

Returns:
a Java Object with the name of this Prolog atom.

getName

public java.lang.String getName()
Gets the name of this atom as a string. Returns a copy of the string name instead of the name itself.

Returns:
A String with the name of this atom.

isRunnable

public boolean isRunnable()
Execution test on Prolog objects. Implements the abstract method of class PLTerm.

Specified by:
isRunnable in class PLTerm
Returns:
true if the related Prolog term can be evaluated as a goal; false otherwise.

equals

public boolean equals(PLTerm term)
comparison between Prolog terms.

Specified by:
equals in class PLTerm
Parameters:
term - The PLTerm object to compare with this object.
Returns:
true if the term received as argument is similar to this atom: is a PLAtom object and has the same atom name; false otherwise.

copy

public PLTerm copy()
Makes a full copy of this PLAtom object. Creates a new PLAtom object with the name equals to this object name.

Specified by:
copy in class PLTerm
Returns:
The new object created.