Class PrologInt
- java.lang.Object
-
- com.igormaznitsa.prologparser.terms.PrologTerm
-
- com.igormaznitsa.prologparser.terms.PrologNumeric
-
- com.igormaznitsa.prologparser.terms.PrologInt
-
- All Implemented Interfaces:
java.io.Serializable,java.lang.Comparable<PrologTerm>
public final class PrologInt extends PrologNumeric
Representation of integer numeric term.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private static java.util.Map<java.lang.String,java.math.BigInteger>cachedValuesprivate static longserialVersionUIDprivate java.math.BigIntegervalue-
Fields inherited from class com.igormaznitsa.prologparser.terms.PrologTerm
quotation, text
-
-
Constructor Summary
Constructors Constructor Description PrologInt(long value)PrologInt(long value, int line, int pos)PrologInt(java.lang.String text)PrologInt(java.lang.String text, int line, int pos)PrologInt(java.math.BigInteger value)PrologInt(java.math.BigInteger value, int line, int pos)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.math.BigIntegergetIntValue()Get the value as BigIntegerjava.lang.NumbergetNumber()Get numeric representation of the saved number.java.lang.StringgetText()Get the term text.booleanisNegative()Check that the number is negative onePrologNumericmakeNeg()Make negative representation of the numeric termjava.lang.StringtoString()private static java.math.BigIntegervalueOf(java.lang.String text)-
Methods inherited from class com.igormaznitsa.prologparser.terms.PrologNumeric
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
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
cachedValues
private static final java.util.Map<java.lang.String,java.math.BigInteger> cachedValues
-
value
private final java.math.BigInteger value
-
-
Constructor Detail
-
PrologInt
public PrologInt(java.lang.String text)
-
PrologInt
public PrologInt(java.lang.String text, int line, int pos)
-
PrologInt
public PrologInt(long value)
-
PrologInt
public PrologInt(long value, int line, int pos)
-
PrologInt
public PrologInt(java.math.BigInteger value)
-
PrologInt
public PrologInt(java.math.BigInteger value, int line, int pos)
-
-
Method Detail
-
valueOf
private static java.math.BigInteger valueOf(java.lang.String text)
-
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
-
toString
public java.lang.String toString()
- Overrides:
toStringin classPrologTerm
-
getText
public java.lang.String getText()
Description copied from class:PrologTermGet the term text.- Overrides:
getTextin classPrologNumeric- Returns:
- the term text, must not be null
-
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
-
getIntValue
public java.math.BigInteger getIntValue()
Get the value as BigInteger- Returns:
- the value as BigInteger
-
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
-
-