public class NumericalExpression extends AbstractRegularExpression
ANY_CHAR, ANY_CHAR_EOL, ANY_SIGN, AT_LEAST, AT_MOST, DEBUG, DOUBLE, EOL, EXACTLY, INTEGER, NEGATIVE, NON_NULL, POSITIVE, STRICTLY_NEGATIVE, STRICTLY_POSITIVE, WHITE_SPACES, WHITE_SPACES_OR_EOL
Constructor and Description |
---|
NumericalExpression()
Constructor w/o postfix, type=DOUBLE and sign=ANY_SIGN.
|
NumericalExpression(int numberType,
int sign)
Constructor w/o postfix, i.e.
|
NumericalExpression(int numberType,
int sign,
java.lang.String postfix,
boolean swallowPostFix) |
Modifier and Type | Method and Description |
---|---|
java.lang.Number |
getValue()
Return the parsed value, wrapped in a Number (either Integer or Double)
|
boolean |
interpret(Context context)
Parses this expression, possibly using the given Context to fetch the String to interpret
if this Expression is a leaf expression.
|
java.lang.String |
toString() |
action
public NumericalExpression(int numberType, int sign, java.lang.String postfix, boolean swallowPostFix)
numberType
- INTEGER or DOUBLEsign
- ANY_SIGN, POSITIVE, NEGATIVE, STRICTLY_POSITIVE, STRICTLY_NEGATIVE or NON_NULLpostfix
- a String that signals the end of this numerical expression (if NULL, swallows as many digits as possible)swallowPostFix
- if TRUE, move cursor JUST BEHIND the postfix; else move it TO THE POSTFIX POSITION
N/A if postFix is null.public NumericalExpression(int numberType, int sign)
numberType
- INTEGER or DOUBLEsign
- ANY_SIGN, POSITIVE, NEGATIVE, STRICTLY_POSITIVE, STRICTLY_NEGATIVE or NON_NULLpublic NumericalExpression()
public boolean interpret(Context context) throws REParserException
AbstractRegularExpression
interpret
in class AbstractRegularExpression
REParserException
- if an error occur during parsingpublic java.lang.Number getValue()
public java.lang.String toString()
toString
in class java.lang.Object
Submit a bug : syd@jpicedt.org