public class Float extends Term
Float f = new Float(3.14159265);A Float can be used (and re-used) in Compound Terms. Two Float instances are equal (by .equals()) iff their (double) values are equal.
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 double |
value
this Float's immutable (double) value
|
Constructor and Description |
---|
Float(double value)
construct a Float with the supplied (double) value
|
Modifier and Type | Method and Description |
---|---|
Term[] |
args()
the (zero) arguments of a Float, as a (zero-length) Term[]
|
double |
doubleValue()
returns the (double) value of this Float
|
boolean |
equals(java.lang.Object obj)
Two Floats are equal if they are the same object, or their values are equal
|
float |
floatValue()
returns the (double) value of this Float, converted to a float
|
boolean |
hasFunctor(double val,
int arity)
Tests whether this Float's functor has (double) 'name' and 'arity'
|
int |
intValue()
returns the (double) value of this Float, converted to an int
|
java.lang.Object |
jrefToObject() |
long |
longValue()
returns the (double) value of this Float, converted to a long
|
protected void |
put(java.util.Map<java.lang.String,term_t> varnames_to_vars,
term_t term)
To convert a JPL Float to a Prolog term, we put its value field into the term_t as a float.
|
java.lang.String |
toString()
Returns a Prolog source text representation of this Float
|
int |
type()
returns the type of this term, as one of org.jpl7.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
|
arg, arity, atomType, bigValue, 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, toTermArray
public Float(double value)
value
- this Float's valuepublic Term[] args()
public final double doubleValue()
doubleValue
in class Term
public final boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
obj
- The Object to comparepublic final float floatValue()
floatValue
in class Term
public final boolean hasFunctor(double val, int arity)
hasFunctor
in class Term
public final int intValue()
public java.lang.Object jrefToObject()
jrefToObject
in class Term
public final long longValue()
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.Object
public final int type()
Term
public java.lang.String typeName()
Term