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.
Field Summary |
protected java.lang.String |
Value
|
Fields inherited from class CiaoJava.PLTerm |
ATOM,
AtomTable,
currentVersion,
fail,
FLOAT,
INTEGER,
INTERPRETER_ERROR,
INTERPRETER_SUCCESS,
JAVA_OBJECT,
LIST,
MAX_READ_BUFFER,
nil,
PFX_ATOM,
PFX_FLOAT,
PFX_LIST_WITH_NIL_TAIL,
PFX_LIST_WITH_NONIL_TAIL,
PFX_LONG_INT,
PFX_MULTI_REF_ATOM,
PFX_MULTI_REF_STRUCT,
PFX_MULTI_REF_VAR,
PFX_SHORT_INT,
PFX_SINGLE_REF_VAR,
PFX_STRUCT,
PFXC_ATOM,
PFXC_FLOAT,
PFXC_INTEGER,
PFXC_LIST,
PFXC_NIL,
PFXC_STRING,
PFXC_STRUCT,
PFXC_VARIABLE,
PROLOG_EXCEPTION,
PROLOG_FAIL,
PROLOG_QUERY_ID,
PROLOG_SUCCESS,
STRING,
STRING_BUFFER_SIZE,
STRUCTURE,
success,
Type,
VarCounter,
VARIABLE,
VarNumber,
VERSION_A,
VERSION_C |
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(PLInterpreter i)
Gets the Java representation of the atom as an object. |
private void |
launchGoal(java.io.PrintWriter out)
this method is under development. |
protected int |
numberOfCells()
Returns the number of cells used in the internal Prolog
representation. |
java.lang.String |
toString()
String representation of a Prolog atom. |
Methods inherited from class CiaoJava.PLTerm |
backtrack,
fastRead,
fastWrite,
genPrefix,
genTerm,
getChar,
getFloat,
getInt,
getPrefix,
getString,
getTerm,
isException,
isList,
isNil,
isPrologFail,
isPrologSuccess,
isQueryId,
isSolution,
isString,
isStructure,
isVariable,
unify |
Methods inherited from class java.lang.Object |
,
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
registerNatives,
wait,
wait,
wait |
Value
protected java.lang.String Value
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.
- Returns:
- The
String
representation of this atom. - Overrides:
- toString in class PLTerm
javaRepr
public java.lang.Object javaRepr(PLInterpreter i)
- Gets the Java representation of the atom as an object.
- 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. - Overrides:
- javaRepr in class PLTerm
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
.
- Returns:
- true if the related Prolog term can be evaluated as a goal;
false otherwise.
- Overrides:
- isRunnable in class PLTerm
equals
public boolean equals(PLTerm term)
- comparison between Prolog terms.
- 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.- Overrides:
- equals in class PLTerm
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.
- Returns:
- The new object created.
- Overrides:
- copy in class PLTerm
numberOfCells
protected int numberOfCells()
- Returns the number of cells used in the internal Prolog
representation. This function is only needed for $fast format generation in
Prolog $fast_read version 'a'.
- Returns:
- The number of cells used in the internal Prolog representation.
- Overrides:
- numberOfCells in class PLTerm
launchGoal
private void launchGoal(java.io.PrintWriter out)
throws PLGoalException
- this method is under development. Must implement the launching
of a Prolog goal with no arguments.
- Overrides:
- launchGoal in class PLTerm