Class PrologFloat
- java.lang.Object
-
- com.igormaznitsa.prologparser.terms.PrologTerm
-
- com.igormaznitsa.prologparser.terms.PrologNumeric
-
- com.igormaznitsa.prologparser.terms.PrologFloat
-
- All Implemented Interfaces:
java.io.Serializable,java.lang.Comparable<PrologTerm>
public final class PrologFloat extends PrologNumeric
Representation for float numeric term.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static java.math.MathContextMATH_CONTEXTprivate static longserialVersionUIDprivate java.math.BigDecimalvalue-
Fields inherited from class com.igormaznitsa.prologparser.terms.PrologTerm
quotation, text
-
-
Constructor Summary
Constructors Constructor Description PrologFloat(double value)PrologFloat(double value, int line, int pos)PrologFloat(java.lang.String text)PrologFloat(java.lang.String text, int line, int pos)PrologFloat(java.math.BigDecimal value)PrologFloat(java.math.BigDecimal value, int line, int pos)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.math.BigDecimalgetFloatValue()java.lang.NumbergetNumber()Get numeric representation of the saved number.booleanisNegative()Check that the number is negative onePrologNumericmakeNeg()Make negative representation of the numeric termjava.lang.StringtoString()-
Methods inherited from class com.igormaznitsa.prologparser.terms.PrologNumeric
getText, getType
-
Methods inherited from class com.igormaznitsa.prologparser.terms.PrologTerm
assertNonEmptyString, compareTo, findQuotation, flatComma, getArity, getFunctor, getLine, getPos, getPrecedence, getQuotation, isAnyBlock, isBlock, isCurlyBlock, setLine, setPos, stream
-
-
-
-
Field Detail
-
MATH_CONTEXT
public static final java.math.MathContext MATH_CONTEXT
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
value
private final java.math.BigDecimal value
-
-
Constructor Detail
-
PrologFloat
public PrologFloat(java.lang.String text)
-
PrologFloat
public PrologFloat(java.lang.String text, int line, int pos)
-
PrologFloat
public PrologFloat(double value)
-
PrologFloat
public PrologFloat(double value, int line, int pos)
-
PrologFloat
public PrologFloat(java.math.BigDecimal value)
-
PrologFloat
public PrologFloat(java.math.BigDecimal value, int line, int pos)
-
-
Method Detail
-
makeNeg
public PrologNumeric makeNeg()
Description copied from class:PrologNumericMake negative representation of the numeric term- Specified by:
makeNegin classPrologNumeric- Returns:
- the negative variant of the numeric
-
getFloatValue
public java.math.BigDecimal getFloatValue()
-
getNumber
public java.lang.Number getNumber()
Description copied from class:PrologNumericGet numeric representation of the saved number.- Specified by:
getNumberin classPrologNumeric- Returns:
- the saved number
-
toString
public java.lang.String toString()
- Overrides:
toStringin classPrologTerm
-
isNegative
public boolean isNegative()
Description copied from class:PrologNumericCheck that the number is negative one- Specified by:
isNegativein classPrologNumeric- Returns:
- true if the number is negative one, false otherwise
-
-