Package com.ibm.icu.impl.number.parse
Class DecimalMatcher
java.lang.Object
com.ibm.icu.impl.number.parse.DecimalMatcher
- All Implemented Interfaces:
NumberParseMatcher
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.ibm.icu.impl.number.parse.NumberParseMatcher
NumberParseMatcher.Flexible
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final String
private final UnicodeSet
private final String[]
private final int
private final int
private final boolean
If true, do not accept grouping separators at allprivate final String
private final UnicodeSet
private final boolean
If true, do not accept numbers in the fractionprivate final UnicodeSet
private final boolean
If true, only accept strings whose grouping sizes match the localeprivate final UnicodeSet
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprivate
DecimalMatcher
(DecimalFormatSymbols symbols, Grouper grouper, int parseFlags) -
Method Summary
Modifier and TypeMethodDescriptionstatic DecimalMatcher
getInstance
(DecimalFormatSymbols symbols, Grouper grouper, int parseFlags) boolean
match
(StringSegment segment, ParsedNumber result) Runs this matcher starting at the beginning of the given StringSegment.boolean
match
(StringSegment segment, ParsedNumber result, int exponentSign) void
postProcess
(ParsedNumber result) Method called at the end of a parse, after all matchers have failed to consume any more chars.boolean
smokeTest
(StringSegment segment) Performs a fast "smoke check" for whether or not this matcher could possibly match against the given string segment.toString()
private boolean
validateGroup
(int sepType, int count, boolean isPrimary)
-
Field Details
-
requireGroupingMatch
private final boolean requireGroupingMatchIf true, only accept strings whose grouping sizes match the locale -
groupingDisabled
private final boolean groupingDisabledIf true, do not accept grouping separators at all -
integerOnly
private final boolean integerOnlyIf true, do not accept numbers in the fraction -
grouping1
private final int grouping1 -
grouping2
private final int grouping2 -
groupingSeparator
-
decimalSeparator
-
groupingUniSet
-
decimalUniSet
-
separatorSet
-
leadSet
-
digitStrings
-
-
Constructor Details
-
DecimalMatcher
-
-
Method Details
-
getInstance
public static DecimalMatcher getInstance(DecimalFormatSymbols symbols, Grouper grouper, int parseFlags) -
match
Description copied from interface:NumberParseMatcher
Runs this matcher starting at the beginning of the given StringSegment. If this matcher finds something interesting in the StringSegment, it should update the offset of the StringSegment corresponding to how many chars were matched.- Specified by:
match
in interfaceNumberParseMatcher
- Parameters:
segment
- The StringSegment to match against. Matches always start at the beginning of the segment. The segment is guaranteed to contain at least one char.result
- The data structure to store results if the match succeeds.- Returns:
- Whether this matcher thinks there may be more interesting chars beyond the end of the string segment.
-
match
- Parameters:
exponentSign
- -1 means a negative exponent; +1 means a positive exponent; 0 means NO exponent. If -1 or +1, the number will be saved by scaling the pre-existing DecimalQuantity in the ParsedNumber. If 0, a new DecimalQuantity will be created to store the number.
-
validateGroup
private boolean validateGroup(int sepType, int count, boolean isPrimary) -
smokeTest
Description copied from interface:NumberParseMatcher
Performs a fast "smoke check" for whether or not this matcher could possibly match against the given string segment. The test should be as fast as possible but also as restrictive as possible. For example, matchers can maintain a UnicodeSet of all code points that count possibly start a match. Matchers should use theStringSegment.startsWith(int)
method in order to correctly handle case folding.- Specified by:
smokeTest
in interfaceNumberParseMatcher
- Parameters:
segment
- The segment to check against.- Returns:
- true if the matcher might be able to match against this segment; false if it definitely will not be able to match.
-
postProcess
Description copied from interface:NumberParseMatcher
Method called at the end of a parse, after all matchers have failed to consume any more chars. Allows a matcher to make final modifications to the result given the knowledge that no more matches are possible.- Specified by:
postProcess
in interfaceNumberParseMatcher
- Parameters:
result
- The data structure to store results.
-
toString
-