Class PrologNumeric
- java.lang.Object
-
- com.igormaznitsa.prologparser.terms.PrologTerm
-
- com.igormaznitsa.prologparser.terms.PrologNumeric
-
- All Implemented Interfaces:
java.io.Serializable,java.lang.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 Modifier and Type Field Description private static longserialVersionUID-
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 java.lang.NumbergetNumber()Get numeric representation of the saved number.java.lang.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
-
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
-
Method Detail
-
getNumber
public abstract java.lang.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 java.lang.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
-
-