LEFT | RIGHT |
(no file at all) | |
| 1 // © 2017 and later: Unicode, Inc. and others. |
| 2 // License & terms of use: http://www.unicode.org/copyright.html#License |
| 3 package com.ibm.icu.impl.number.parse; |
| 4 |
| 5 import com.ibm.icu.text.UnicodeSet; |
| 6 |
| 7 /** |
| 8 * @author sffc |
| 9 * |
| 10 */ |
| 11 public interface NumberParseMatcher { |
| 12 /** |
| 13 * Runs this matcher starting at the beginning of the given StringSegment. I
f this matcher finds something |
| 14 * interesting in the StringSegment, it should update the offset of the Stri
ngSegment corresponding to how many |
| 15 * chars were matched. |
| 16 * |
| 17 * @param segment |
| 18 * The StringSegment to match against. Matches always start at th
e beginning of the segment. The segment |
| 19 * is guaranteed to contain at least one char. |
| 20 * @param result |
| 21 * The data structure to store results if the match succeeds. |
| 22 * @return Whether this matcher thinks there may be more interesting chars b
eyond the end of the string segment. |
| 23 */ |
| 24 public boolean match(StringSegment segment, ParsedNumber result); |
| 25 |
| 26 /** |
| 27 * Should return a set representing all possible chars (UTF-16 code units) t
hat could be the first char that this |
| 28 * matcher can consume. This method is only called during construction phase
, and its return value is used to skip |
| 29 * this matcher unless a segment begins with a char in this set. To make thi
s matcher always run, return |
| 30 * {@link UnicodeSet#ALL_CODE_POINTS}. |
| 31 */ |
| 32 public UnicodeSet getLeadCodePoints(); |
| 33 |
| 34 /** |
| 35 * Method called at the end of a parse, after all matchers have failed to co
nsume any more chars. Allows a matcher |
| 36 * to make final modifications to the result given the knowledge that no mor
e matches are possible. |
| 37 * |
| 38 * @param result |
| 39 * The data structure to store results. |
| 40 */ |
| 41 public void postProcess(ParsedNumber result); |
| 42 } |
LEFT | RIGHT |