CiaoJava
Class PLInteger
java.lang.Object
|
+--CiaoJava.PLTerm
|
+--CiaoJava.PLInteger
- public class PLInteger
- extends PLTerm
Prolog integer representation.
This implementation can only work with Prolog integers
that fit in Java Integer
type. The Long
representation cannot be used due to the importance of integer
numbers for almost every class in the Java API.
Constructor Summary |
PLInteger(int v)
Integer constructor. |
Method Summary |
PLTerm |
copy()
Makes a full copy of this PLInteger object. |
boolean |
equals(PLTerm t)
comparison between Prolog terms. |
int |
getValue()
Gets the integer value of the PLInteger object. |
boolean |
isRunnable()
Execution test on Prolog objects. |
java.lang.Object |
javaRepr()
Gets the Java representation of this Prolog integer as an object. |
java.lang.Object |
javaRepr(CiaoJava.PLInterpreter i)
Gets the Java representation of this Prolog integer as an object. |
java.lang.String |
toString()
String representation. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
PLInteger
public PLInteger(int v)
- Integer constructor. Creates a new
PLInteger
object
with initial value given as argument.
- Parameters:
v
- Initial value of this PLInteger
object.
This argument must be the largest representation of an
integral number to manage Prolog integers.
toString
public java.lang.String toString()
- String representation. Returns the
String
representation
of this PLInteger
object.
- Overrides:
toString
in class PLTerm
- Returns:
- The string representation of this
PLInteger
object.
javaRepr
public java.lang.Object javaRepr(CiaoJava.PLInterpreter i)
- Gets the Java representation of this Prolog integer as an object.
The object returned must be a Java
Integer
object.
- Overrides:
javaRepr
in class PLTerm
- Parameters:
i
- PLInterpreter
object to interpret the
this Prolog term (although is not needed in this
method, this parameter is included here for compatibility with
the abstract declaration in PLTerm
).- Returns:
- An
Object
representing the Prolog integer.
This object will be a Java Integer
object.
javaRepr
public java.lang.Object javaRepr()
- Gets the Java representation of this Prolog integer as an object.
The object returned will be a Java
Integer
object.
- Returns:
- An
Object
representing the Prolog integer.
This object will be a Java Integer
object.
getValue
public int getValue()
- Gets the integer value of the
PLInteger
object.
- Returns:
- The primitive
int
value of this Prolog integer.
isRunnable
public boolean isRunnable()
- Execution test on Prolog objects. Returns true if the
related Prolog term can be evaluated. Included here
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 PLTerm
received as argument is equal to this PLInteger
object.
copy
public PLTerm copy()
- Makes a full copy of this
PLInteger
object.
Creates a new PLInteger
object with the
integer value of this object.
- Overrides:
copy
in class PLTerm
- Returns:
- A new
PLInteger
with the value of this object.