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.DecimalFormatSymbols; |
| 6 |
| 7 /** |
| 8 * @author sffc |
| 9 * |
| 10 */ |
| 11 public class InfinityMatcher extends SymbolMatcher { |
| 12 |
| 13 private static final InfinityMatcher DEFAULT = new InfinityMatcher(); |
| 14 |
| 15 public static InfinityMatcher getInstance(DecimalFormatSymbols symbols) { |
| 16 String symbolString = symbols.getInfinity(); |
| 17 if (DEFAULT.uniSet.contains(symbolString)) { |
| 18 return DEFAULT; |
| 19 } else { |
| 20 return new InfinityMatcher(symbolString); |
| 21 } |
| 22 } |
| 23 |
| 24 private InfinityMatcher(String symbolString) { |
| 25 super(symbolString, DEFAULT.uniSet); |
| 26 } |
| 27 |
| 28 private InfinityMatcher() { |
| 29 super(UnicodeSetStaticCache.Key.INFINITY); |
| 30 } |
| 31 |
| 32 @Override |
| 33 protected boolean isDisabled(ParsedNumber result) { |
| 34 return 0 != (result.flags & ParsedNumber.FLAG_INFINITY); |
| 35 } |
| 36 |
| 37 @Override |
| 38 protected void accept(StringSegment segment, ParsedNumber result) { |
| 39 result.flags |= ParsedNumber.FLAG_INFINITY; |
| 40 result.setCharsConsumed(segment); |
| 41 } |
| 42 |
| 43 @Override |
| 44 public String toString() { |
| 45 return "<PercentMatcher>"; |
| 46 } |
| 47 } |
LEFT | RIGHT |