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.


Fields inherited from class CiaoJava.PLTerm
fail, nil, success
 
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()
          Java representation of a Prolog float.
 java.lang.Object javaRepr(CiaoJava.PLInterpreter i)
          Java representation of a Prolog float.
 java.lang.String toString()
          String representation of a Prolog float.
 
Methods inherited from class CiaoJava.PLTerm
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

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.
Overrides:
toString in class PLTerm
Returns:
The string representation of the Prolog float.

javaRepr

public java.lang.Object javaRepr(CiaoJava.PLInterpreter i)
Java representation of a Prolog float. Returns the Java Double object that contains the Prolog float.
Overrides:
javaRepr in class PLTerm
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.

javaRepr

public java.lang.Object javaRepr()
Java representation of a Prolog float. Returns the Java Double object that contains the Prolog float.
Returns:
an Object instance that contains a Double object.

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.
Overrides:
isRunnable in class PLTerm
Returns:
Always false.

equals

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

copy

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