| Modifier and Type | Field and Description |
|---|---|
| public int | charEnd
The index of the last char consumed during parsing. |
| public static final Comparator | COMPARATOR
A Comparator that favors ParsedNumbers with the most chars consumed. |
| public String | currencyCode
The currency that got consumed. |
| public static final int | |
| public static final int | |
| public static final int | |
| public static final int | |
| public static final int | |
| public static final int | |
| public static final int | |
| public static final int | |
| public int | flags
Boolean flags (see constants below). |
| public String | prefix
The pattern string corresponding to the prefix that got consumed. |
| public DecimalQuantity_DualStorageBCD | quantity
The numerical value that was parsed. |
| public String | suffix
The pattern string corresponding to the suffix that got consumed. |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public void | |
| public void | |
| public Number | |
| public Number | |
| pack-priv boolean | |
| public void | |
| public boolean | |
| public void | setCharsConsumed(StringSegment
The current StringSegment, usually immediately following a call to setOffset. segment)Call this method to register that a "strong" char was consumed. |
| public boolean |
| charEnd | back to summary |
|---|---|
| public int charEnd The index of the last char consumed during parsing. If parsing started at index 0, this is equal to the number of chars consumed. This is NOT necessarily the same as the StringSegment offset; "weak" chars, like whitespace, change the offset, but the charsConsumed is not touched until a "strong" char is encountered. | |
| COMPARATOR | back to summary |
|---|---|
| public static final Comparator<ParsedNumber> COMPARATOR A Comparator that favors ParsedNumbers with the most chars consumed. | |
| currencyCode | back to summary |
|---|---|
| public String currencyCode The currency that got consumed. | |
| FLAG_FAIL | back to summary |
|---|---|
| public static final int FLAG_FAIL | |
| FLAG_HAS_DECIMAL_SEPARATOR | back to summary |
|---|---|
| public static final int FLAG_HAS_DECIMAL_SEPARATOR | |
| FLAG_HAS_EXPONENT | back to summary |
|---|---|
| public static final int FLAG_HAS_EXPONENT | |
| FLAG_INFINITY | back to summary |
|---|---|
| public static final int FLAG_INFINITY | |
| FLAG_NAN | back to summary |
|---|---|
| public static final int FLAG_NAN | |
| FLAG_NEGATIVE | back to summary |
|---|---|
| public static final int FLAG_NEGATIVE | |
| FLAG_PERCENT | back to summary |
|---|---|
| public static final int FLAG_PERCENT | |
| FLAG_PERMILLE | back to summary |
|---|---|
| public static final int FLAG_PERMILLE | |
| flags | back to summary |
|---|---|
| public int flags Boolean flags (see constants below). | |
| prefix | back to summary |
|---|---|
| public String prefix The pattern string corresponding to the prefix that got consumed. | |
| quantity | back to summary |
|---|---|
| public DecimalQuantity_DualStorageBCD quantity
Deprecated as a consequence of The numerical value that was parsed. | |
| suffix | back to summary |
|---|---|
| public String suffix The pattern string corresponding to the suffix that got consumed. | |
| ParsedNumber | back to summary |
|---|---|
| public ParsedNumber() | |
| clear | back to summary |
|---|---|
| public void clear() Clears the data from this ParsedNumber, in effect failing the current parse. | |
| copyFrom | back to summary |
|---|---|
| public void copyFrom(ParsedNumber other) | |
| getNumber | back to summary |
|---|---|
| public Number getNumber() | |
| getNumber | back to summary |
|---|---|
public Number getNumber(int parseFlags)
| |
| isBetterThan | back to summary |
|---|---|
| pack-priv boolean isBetterThan(ParsedNumber other) | |
| postProcess | back to summary |
|---|---|
| public void postProcess() Apply certain number-related flags to the DecimalQuantity. | |
| seenNumber | back to summary |
|---|---|
| public boolean seenNumber() | |
| setCharsConsumed | back to summary |
|---|---|
| public void setCharsConsumed(StringSegment segment) Call this method to register that a "strong" char was consumed. This should be done after calling
What is a strong versus weak char? The behavior of number parsing is to "stop" after reading the number, even if there is other content following the number. For example, after parsing the string "123 " (123 followed by a space), the cursor should be set to 3, not 4, even though there are matchers that accept whitespace. In this example, the digits are strong, whereas the whitespace is weak. Grouping separators are weak, whereas decimal separators are strong. Most other chars are strong.
| |
| success | back to summary |
|---|---|
| public boolean success() Returns whether this the parse was successful. To be successful, at least one char must have been consumed, and the failure flag must not be set. | |