- java.lang.Object
-
- com.igormaznitsa.prologparser.terms.PrologTerm
-
- com.igormaznitsa.prologparser.terms.PrologNumeric
-
- All Implemented Interfaces:
Serializable,Comparable<PrologTerm>
- Direct Known Subclasses:
PrologFloat,PrologInt
public abstract class PrologNumeric extends PrologTerm
Base class for all numeric terms.- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class com.igormaznitsa.prologparser.terms.PrologTerm
quotation, text
-
-
Constructor Summary
Constructors Constructor Description PrologNumeric()PrologNumeric(int line, int pos)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract NumbergetNumber()Get numeric representation of the saved number.StringgetText()Get the term text.TermTypegetType()Get term type.abstract booleanisNegative()Check that the number is negative oneabstract PrologNumericmakeNeg()Make negative representation of the numeric term-
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, toString
-
-
-
-
Method Detail
-
getNumber
public abstract Number getNumber()
Get numeric representation of the saved number.- Returns:
- the saved number
-
getType
public final TermType getType()
Description copied from class:PrologTermGet term type.- Specified by:
getTypein classPrologTerm- Returns:
- term type, must not be null
-
getText
public String getText()
Description copied from class:PrologTermGet the term text.- Overrides:
getTextin classPrologTerm- Returns:
- the term text, must not be null
-
isNegative
public abstract boolean isNegative()
Check that the number is negative one- Returns:
- true if the number is negative one, false otherwise
-
makeNeg
public abstract PrologNumeric makeNeg()
Make negative representation of the numeric term- Returns:
- the negative variant of the numeric
-
-