• 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 ohos.global.icu.impl.StaticUnicodeSets;
7 import ohos.global.icu.impl.StringSegment;
8 import ohos.global.icu.text.DecimalFormatSymbols;
9 
10 /**
11  * @author sffc
12  * @hide exposed on OHOS
13  *
14  */
15 public class PermilleMatcher extends SymbolMatcher {
16 
17     private static final PermilleMatcher DEFAULT = new PermilleMatcher();
18 
getInstance(DecimalFormatSymbols symbols)19     public static PermilleMatcher getInstance(DecimalFormatSymbols symbols) {
20         String symbolString = symbols.getPerMillString();
21         if (DEFAULT.uniSet.contains(symbolString)) {
22             return DEFAULT;
23         } else {
24             return new PermilleMatcher(symbolString);
25         }
26     }
27 
PermilleMatcher(String symbolString)28     private PermilleMatcher(String symbolString) {
29         super(symbolString, DEFAULT.uniSet);
30     }
31 
PermilleMatcher()32     private PermilleMatcher() {
33         super(StaticUnicodeSets.Key.PERMILLE_SIGN);
34     }
35 
36     @Override
isDisabled(ParsedNumber result)37     protected boolean isDisabled(ParsedNumber result) {
38         return 0 != (result.flags & ParsedNumber.FLAG_PERMILLE);
39     }
40 
41     @Override
accept(StringSegment segment, ParsedNumber result)42     protected void accept(StringSegment segment, ParsedNumber result) {
43         result.flags |= ParsedNumber.FLAG_PERMILLE;
44         result.setCharsConsumed(segment);
45     }
46 
47     @Override
toString()48     public String toString() {
49         return "<PermilleMatcher>";
50     }
51 }
52