Top Description Fields Constructors Methods
com.ibm.icu.impl.number.parse

public Class CombinedCurrencyMatcher

extends Object
implements NumberParseMatcher
Class Inheritance
All Implemented Interfaces
com.ibm.icu.impl.number.parse.NumberParseMatcher
Imports
java.util.Iterator, com.ibm.icu.impl.StandardPlural, .StringSegment, .TextTrieMap, com.ibm.icu.text.DecimalFormatSymbols, com.ibm.icu.util.Currency, .Currency.CurrencyStringInfo

Matches a currency, either a custom currency or one from the data bundle. The class is called "combined" to emphasize that the currency string may come from one of multiple sources. Will match currency spacing either before or after the number depending on whether we are currently in the prefix or suffix. The implementation of this class is slightly different between J and C. See #13584 for a follow-up.
Author
sffc

Field Summary

Modifier and TypeField and Description
private final String
private final String
private final String
private final String
private final String
private final String[]
private final TextTrieMap<Currency.CurrencyStringInfo>
private final TextTrieMap<Currency.CurrencyStringInfo>

Constructor Summary

AccessConstructor and Description
private
CombinedCurrencyMatcher(Currency currency, DecimalFormatSymbols dfs, int parseFlags)

Method Summary

Modifier and TypeMethod and Description
public static CombinedCurrencyMatcher
getInstance(Currency currency, DecimalFormatSymbols dfs, int parseFlags)

public boolean
match(StringSegment
The StringSegment to match against. Matches always start at the beginning of the segment. The segment is guaranteed to contain at least one char.
segment
,
ParsedNumber
The data structure to store results if the match succeeds.
result
)

Implements com.ibm.icu.impl.number.parse.NumberParseMatcher.match.

Runs this matcher starting at the beginning of the given StringSegment.
private boolean
matchCurrency(StringSegment segment, ParsedNumber result)

Matches the currency string without concern for currency spacing.

public void
postProcess(ParsedNumber
The data structure to store results.
result
)

Implements com.ibm.icu.impl.number.parse.NumberParseMatcher.postProcess.

Method called at the end of a parse, after all matchers have failed to consume any more chars.
public boolean
smokeTest(StringSegment
The segment to check against.
segment
)

Implements com.ibm.icu.impl.number.parse.NumberParseMatcher.smokeTest.

Performs a fast "smoke check" for whether or not this matcher could possibly match against the given string segment.
public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

afterPrefixInsertback to summary
private final String afterPrefixInsert
beforeSuffixInsertback to summary
private final String beforeSuffixInsert
currency1back to summary
private final String currency1
currency2back to summary
private final String currency2
isoCodeback to summary
private final String isoCode
localLongNamesback to summary
private final String[] localLongNames
longNameTrieback to summary
private final TextTrieMap<Currency.CurrencyStringInfo> longNameTrie
symbolTrieback to summary
private final TextTrieMap<Currency.CurrencyStringInfo> symbolTrie

Constructor Detail

CombinedCurrencyMatcherback to summary
private CombinedCurrencyMatcher(Currency currency, DecimalFormatSymbols dfs, int parseFlags)

Method Detail

getInstanceback to summary
public static CombinedCurrencyMatcher getInstance(Currency currency, DecimalFormatSymbols dfs, int parseFlags)
matchback to summary
public boolean match(StringSegment segment, ParsedNumber result)

Implements com.ibm.icu.impl.number.parse.NumberParseMatcher.match.

Doc from com.ibm.icu.impl.number.parse.NumberParseMatcher.match.

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.

Parameters
segment:StringSegment

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:ParsedNumber

The data structure to store results if the match succeeds.

Returns:boolean

Whether this matcher thinks there may be more interesting chars beyond the end of the string segment.

Annotations
@Override
matchCurrencyback to summary
private boolean matchCurrency(StringSegment segment, ParsedNumber result)

Matches the currency string without concern for currency spacing.

postProcessback to summary
public void postProcess(ParsedNumber result)

Implements com.ibm.icu.impl.number.parse.NumberParseMatcher.postProcess.

Doc from com.ibm.icu.impl.number.parse.NumberParseMatcher.postProcess.

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.

Parameters
result:ParsedNumber

The data structure to store results.

Annotations
@Override
smokeTestback to summary
public boolean smokeTest(StringSegment segment)

Implements com.ibm.icu.impl.number.parse.NumberParseMatcher.smokeTest.

Doc from com.ibm.icu.impl.number.parse.NumberParseMatcher.smokeTest.

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 the StringSegment#startsWith method in order to correctly handle case folding.

Parameters
segment:StringSegment

The segment to check against.

Returns:boolean

true if the matcher might be able to match against this segment; false if it definitely will not be able to match.

Annotations
@Override
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

a string representation of the object.

Annotations
@Override