• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* GENERATED SOURCE. DO NOT MODIFY. */
2 // © 2017 and later: Unicode, Inc. and others.
3 // License & terms of use: http://www.unicode.org/copyright.html#License
4 package ohos.global.icu.impl.number.parse;
5 
6 import static ohos.global.icu.impl.number.parse.ParsingUtils.safeContains;
7 
8 import ohos.global.icu.impl.StaticUnicodeSets;
9 import ohos.global.icu.impl.StringSegment;
10 import ohos.global.icu.text.DecimalFormatSymbols;
11 
12 /**
13  * @author sffc
14  * @hide exposed on OHOS
15  *
16  */
17 public class InfinityMatcher extends SymbolMatcher {
18 
19     private static final InfinityMatcher DEFAULT = new InfinityMatcher();
20 
getInstance(DecimalFormatSymbols symbols)21     public static InfinityMatcher getInstance(DecimalFormatSymbols symbols) {
22         String symbolString = symbols.getInfinity();
23         if (safeContains(DEFAULT.uniSet, symbolString)) {
24             return DEFAULT;
25         } else {
26             return new InfinityMatcher(symbolString);
27         }
28     }
29 
InfinityMatcher(String symbolString)30     private InfinityMatcher(String symbolString) {
31         super(symbolString, DEFAULT.uniSet);
32     }
33 
InfinityMatcher()34     private InfinityMatcher() {
35         super(StaticUnicodeSets.Key.INFINITY_SIGN);
36     }
37 
38     @Override
isDisabled(ParsedNumber result)39     protected boolean isDisabled(ParsedNumber result) {
40         return 0 != (result.flags & ParsedNumber.FLAG_INFINITY);
41     }
42 
43     @Override
accept(StringSegment segment, ParsedNumber result)44     protected void accept(StringSegment segment, ParsedNumber result) {
45         result.flags |= ParsedNumber.FLAG_INFINITY;
46         result.setCharsConsumed(segment);
47     }
48 
49     @Override
toString()50     public String toString() {
51         return "<InfinityMatcher>";
52     }
53 }
54