CiaoJava
Class PLFloat

java.lang.Object
  |
  +--CiaoJava.PLTerm
        |
        +--CiaoJava.PLFloat

public class PLFloat
extends PLTerm

This class represents the Prolog floats. Internally the Prolog floats are stored as double, to facilitate the conversion in the Java side.


Field Summary
(package private)  java.lang.Double Value
          Value of this Prolog float.
 
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
PLFloat(double v)
          Creates a new PLFloat object with the given float value.
 
Method Summary
 PLTerm copy()
          Makes a full copy of this PLFloat object.
 boolean equals(PLTerm t)
          Comparison between Prolog terms.
 double getValue()
          Returns the value of this Prolog float as a Java double.
 boolean isRunnable()
          Execution test on Prolog objects.
 java.lang.Object javaRepr(PLInterpreter i)
          Java representation of a Prolog float.
protected  int numberOfCells()
          Not implemented.
 java.lang.String toString()
          String representation of a Prolog float.
 
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, launchGoal, unify
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, wait, wait, wait
 

Field Detail

Value

java.lang.Double Value
Value of this Prolog float. Must be the largest representation of a float point number in Java, so can be implemented Prolog floats.
Constructor Detail

PLFloat

public PLFloat(double v)
Creates a new PLFloat object with the given float value.
Parameters:
v - double value that will contain the new object.
Method Detail

toString

public java.lang.String toString()
String representation of a Prolog float. Uses the representation of the toString method of the Double Java class.
Returns:
The string representation of the Prolog float.
Overrides:
toString in class PLTerm

javaRepr

public java.lang.Object javaRepr(PLInterpreter i)
Java representation of a Prolog float. Returns the Java Double object that contains the Prolog float.
Parameters:
i - is the PLInterpreter instance used to translate Prolog representations of Java objects. Although this method makes no use of this argument, is included to keep the declaration of this method as abstract in class PLTerm.
Returns:
an Object instance that contains a Double object.
Overrides:
javaRepr in class PLTerm

getValue

public double getValue()
Returns the value of this Prolog float as a Java double.
Returns:
The value of this Prolog PLFloat as a Java double.

isRunnable

public boolean isRunnable()
Execution test on Prolog objects. Returns true if the related Prolog term can be evaluated. This method is included for compatibility with the PLTerm class.
Returns:
Always false.
Overrides:
isRunnable in class PLTerm

equals

public boolean equals(PLTerm t)
Comparison between Prolog terms.
Parameters:
t - Prolog term to compare to.
Returns:
true if the Prolog term received as argument is equal to this PLFloat< false otherwise.
Overrides:
equals in class PLTerm

copy

public PLTerm copy()
Makes a full copy of this PLFloat object. Creates a new PLFloat object with the value of this object.
Returns:
A copy of this PLFloat object.
Overrides:
copy in class PLTerm

numberOfCells

protected int numberOfCells()
Not implemented.
Overrides:
numberOfCells in class PLTerm