public class Integer extends Term
Integer i = new Integer(1024);Once constructed, the value of an Integer instance cannot be altered. An Integer can be used (and re-used) as an argument of Compounds. Beware confusing jpl.Integer with java.lang.Integer.
Copyright (C) 1998 Fred Dushin
This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library Public License for more details.
| Modifier and Type | Field and Description |
|---|---|
protected java.math.BigInteger |
bigValue
the Integer's immutable BigInteger value, iff too big for a long
|
protected long |
value
the Integer's immutable long value, iff small enough
|
| Constructor and Description |
|---|
Integer(java.math.BigInteger value) |
Integer(long value) |
| Modifier and Type | Method and Description |
|---|---|
Term[] |
args()
the (zero) arguments of an Integer, as a (zero-length) Term[]
|
java.math.BigInteger |
bigValue()
Returns the value of this Integer as a java.math.BigInteger, whether or not it fits in a long
|
double |
doubleValue()
Returns the value of this Integer converted to a double
|
boolean |
equals(java.lang.Object obj)
two Integer instances are equal if they are the same object, or if their values are equal
|
float |
floatValue()
Returns the value of this Integer converted to a float
|
boolean |
hasFunctor(int val,
int arity)
whether this Integer's functor has (int) 'name' and 'arity' (c.f. traditional functor/3)
|
int |
intValue()
Returns the value of this Integer as an int if possible, else throws a JPLException
|
protected boolean |
isBig() |
java.lang.Object |
jrefToObject() |
long |
longValue()
Returns the value of this Integer as a long
|
protected void |
put(java.util.Map<java.lang.String,term_t> varnames_to_vars,
term_t term)
To convert an Integer into a Prolog term, we put its value into the term_t.
|
java.lang.String |
toString()
a Prolog source text representation of this Integer's value
|
int |
type()
the type of this term, as "Prolog.INTEGER"
|
java.lang.String |
typeName()
the name of the type of this term, as "Integer"
|
arg, arity, atomType, getSubst, getSubsts, getTerm, getTerm, hasFunctor, hasFunctor, isAtom, isBigInteger, isCompound, isFloat, isInteger, isJFalse, isJNull, isJObject, isJRef, isJTrue, isJVoid, isListNil, isListPair, isVariable, listLength, name, objectToJRef, put, putParams, putParams, putParams1, putParams2, putTerm, putTerms, terms_equals, toString, toTermArrayprotected final long value
protected final java.math.BigInteger bigValue
public Integer(long value)
value - This Integer's intended (long) valuepublic Integer(java.math.BigInteger value)
value - This Integer's intended (BigInteger) valuepublic Term[] args()
public final double doubleValue()
doubleValue in class Termpublic final boolean equals(java.lang.Object obj)
equals in class java.lang.Objectobj - The Object to compare (not necessarily an Integer)public final float floatValue()
floatValue in class Termpublic final boolean hasFunctor(int val,
int arity)
hasFunctor in class Termpublic final int intValue()
intValue in class TermJPLException - if the value of this Integer is too great to be represented as a Java intprotected final boolean isBig()
public java.lang.Object jrefToObject()
jrefToObject in class Termpublic final long longValue()
public final java.math.BigInteger bigValue()
protected final void put(java.util.Map<java.lang.String,term_t> varnames_to_vars, term_t term)
public java.lang.String toString()
toString in class java.lang.Objectpublic final int type()