Class NegatedNumberReader
java.lang.Object
ch.andre601.expressionparser.parsers.ValueReader
ch.andre601.expressionparser.parsers.NegatedNumberReader
ValueReader
creating a negated ExpressionTemplate
should the first token be the provided one.-
Constructor Summary
ConstructorDescriptionNegatedNumberReader
(Token negationToken) Sets theToken
that this ValueReader should look for. -
Method Summary
Modifier and TypeMethodDescriptionread
(ExpressionTemplateParser parser, List<Token> tokens, ParseWarnCollector collector) Takes the first token of thelist of Tokens
and returns aExpressionTemplate
who's number value is negated, if the retrieved Token is the set negation Token, ornull
.
-
Constructor Details
-
NegatedNumberReader
Sets theToken
that this ValueReader should look for.- Parameters:
negationToken
- Token this ValueReader should look for.
-
-
Method Details
-
read
public ExpressionTemplate read(ExpressionTemplateParser parser, List<Token> tokens, ParseWarnCollector collector) Takes the first token of thelist of Tokens
and returns aExpressionTemplate
who's number value is negated, if the retrieved Token is the set negation Token, ornull
.- Specified by:
read
in classValueReader
- Parameters:
parser
- ExpressionTemplateParser instance to use. The default ExpressionTemplateParser provides itself here.tokens
- List of tokens to parse into an ExpressionTemplate.collector
-ParseWarnCollector
instance to use.- Returns:
- Possibly-null
ExpressionTemplate
with number value negated.
-