Class NumberTokenReader
java.lang.Object
ch.andre601.expressionparser.tokens.readers.TokenReader
ch.andre601.expressionparser.tokens.readers.NumberTokenReader
TokenReader instance that reads the provided text by trying to parse it through a
NumberFormatter and creates a NumberToken instance should a valid number
be found.
-
Constructor Summary
ConstructorsConstructorDescriptionNumberTokenReader
(int priority) Constructor for creating a new NumberTokenReader. -
Method Summary
Modifier and TypeMethodDescriptionread
(String text, ParsePosition position, ParseWarnCollector collector) Takes the provided Text and parses the content from its current position using aNumberFormat
instance.Methods inherited from class ch.andre601.expressionparser.tokens.readers.TokenReader
getPriority
-
Constructor Details
-
NumberTokenReader
public NumberTokenReader(int priority) Constructor for creating a new NumberTokenReader.- Parameters:
priority
- The priority this TokenReader should have.
-
-
Method Details
-
read
Takes the provided Text and parses the content from its current position using aNumberFormat
instance. Returns aNumberToken
if the position is not the same after parsing, elsenull
.- Specified by:
read
in classTokenReader
- Parameters:
text
- The text to parse.position
- The current position within the text.collector
- Instance of theParseWarnCollector
used for the parsing.- Returns:
- Possibly-null
Token
instance.
-