|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjpl.Term
jpl.Integer
public class Integer
Integer is a specialised Term with a long field, representing a Prolog integer value.
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.
Term,
Compound| Constructor Summary | |
|---|---|
Integer(long value)
|
|
| Method Summary | |
|---|---|
Term |
arg(int ano)
The (nonexistent) ano-th arg of this Integer |
Term[] |
args()
The (nonexistent) args of this Integer |
int |
arity()
Returns the arity (0) of this jpl.Integer (c.f. |
java.lang.String |
debugString()
Deprecated. |
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(double value,
int arity)
Tests whether this Integer's functor has (double) 'name' and 'arity' (c.f. |
boolean |
hasFunctor(int val,
int arity)
Tests whether this Integer's functor has (int) 'name' and 'arity' (c.f. |
boolean |
hasFunctor(java.lang.String name,
int arity)
Tests whether this Integer's functor has (String) 'name' and 'arity' (c.f. |
int |
intValue()
Returns the value of this Integer as an int if possible, else throws a JPLException |
java.lang.Object |
jrefToObject()
|
long |
longValue()
Returns the value of this Integer as a long |
java.lang.String |
name()
throws a JPLException (name() is defined only for Compound, Atom and Variable) |
java.lang.String |
toString()
Returns a Prolog source text representation of this Integer's value |
int |
type()
returns the type of this term, as one of jpl.fli.Prolog.COMPOUND, .ATOM, .VARIABLE, .INTEGER, .FLOAT etc |
java.lang.String |
typeName()
returns the name of the type of this term, as one of "Compound", "Atom", "Variable", "Integer", "Float" etc |
int |
value()
Deprecated. |
| Methods inherited from class jpl.Term |
|---|
debugString, isAtom, isCompound, isFloat, isInteger, isJFalse, isJNull, isJObject, isJRef, isJTrue, isJVoid, isVariable, listLength, objectToJRef, put, putParams, putParams, putTerm, toString, toTermArray |
| Methods inherited from class java.lang.Object |
|---|
getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public Integer(long value)
value - This Integer's (long) value| Method Detail |
|---|
public Term arg(int ano)
arg in class Termpublic Term[] args()
args in class Term
public final boolean hasFunctor(int val,
int arity)
hasFunctor in class Term
public boolean hasFunctor(java.lang.String name,
int arity)
hasFunctor in class Term
public boolean hasFunctor(double value,
int arity)
hasFunctor in class Termpublic final java.lang.String name()
name in class Termpublic final int arity()
arity 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 intpublic final long longValue()
longValue in class Termpublic final float floatValue()
floatValue in class Termpublic final double doubleValue()
doubleValue in class Termpublic final int type()
Term
type in class Termpublic java.lang.String typeName()
Term
typeName in class Termpublic java.lang.String toString()
toString in class java.lang.Objectpublic final boolean equals(java.lang.Object obj)
equals in class java.lang.Objectobj - The Object to compare (not necessarily an Integer)
public final int value()
public java.lang.String debugString()
debugString in class Termpublic java.lang.Object jrefToObject()
jrefToObject in class Term
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||