- java.lang.Object
-
- com.igormaznitsa.prologparser.terms.PrologTerm
-
- com.igormaznitsa.prologparser.terms.PrologNumeric
-
- com.igormaznitsa.prologparser.terms.PrologFloat
-
- All Implemented Interfaces:
Serializable,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 MathContextMATH_CONTEXT-
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(String text)PrologFloat(String text, int line, int pos)PrologFloat(BigDecimal value)PrologFloat(BigDecimal value, int line, int pos)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description BigDecimalgetFloatValue()NumbergetNumber()Get numeric representation of the saved number.booleanisNegative()Check that the number is negative onePrologNumericmakeNeg()Make negative representation of the numeric termStringtoString()-
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 MathContext MATH_CONTEXT
-
-
Constructor Detail
-
PrologFloat
public PrologFloat(String text)
-
PrologFloat
public PrologFloat(String text, int line, int pos)
-
PrologFloat
public PrologFloat(double value)
-
PrologFloat
public PrologFloat(double value, int line, int pos)
-
PrologFloat
public PrologFloat(BigDecimal value)
-
PrologFloat
public PrologFloat(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 BigDecimal getFloatValue()
-
getNumber
public Number getNumber()
Description copied from class:PrologNumericGet numeric representation of the saved number.- Specified by:
getNumberin classPrologNumeric- Returns:
- the saved number
-
toString
public 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
-
-