CiaoJava
Class PLAtom
java.lang.Object
|
+--CiaoJava.PLTerm
|
+--CiaoJava.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.
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 java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
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.
toString
public java.lang.String toString()
- String representation of a Prolog atom.
- Overrides:
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.
- Overrides:
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
.
- Overrides:
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.
- Overrides:
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.
- Overrides:
copy
in class PLTerm
- Returns:
- The new object created.