• 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;
5 
6 import ohos.global.icu.number.IntegerWidth;
7 import ohos.global.icu.number.NumberFormatter.DecimalSeparatorDisplay;
8 import ohos.global.icu.number.NumberFormatter.SignDisplay;
9 import ohos.global.icu.number.Precision;
10 import ohos.global.icu.text.DecimalFormatSymbols;
11 
12 /**
13  * @hide exposed on OHOS
14  */
15 public class MicroProps implements Cloneable, MicroPropsGenerator {
16     // Populated globally:
17     public SignDisplay sign;
18     public DecimalFormatSymbols symbols;
19     public String nsName;
20     public Padder padding;
21     public DecimalSeparatorDisplay decimal;
22     public IntegerWidth integerWidth;
23 
24     // Populated by notation/unit:
25     public Modifier modOuter;
26     public Modifier modMiddle;
27     public Modifier modInner;
28     public Precision rounder;
29     public Grouper grouping;
30     public boolean useCurrency;
31 
32     // Internal fields:
33     private final boolean immutable;
34     private volatile boolean exhausted;
35 
36     /**
37      * @param immutable
38      *            Whether this MicroProps should behave as an immutable after construction with respect
39      *            to the quantity chain.
40      */
MicroProps(boolean immutable)41     public MicroProps(boolean immutable) {
42         this.immutable = immutable;
43     }
44 
45     @Override
processQuantity(DecimalQuantity quantity)46     public MicroProps processQuantity(DecimalQuantity quantity) {
47         if (immutable) {
48             return (MicroProps) this.clone();
49         } else if (exhausted) {
50             // Safety check
51             throw new AssertionError("Cannot re-use a mutable MicroProps in the quantity chain");
52         } else {
53             exhausted = true;
54             return this;
55         }
56     }
57 
58     @Override
clone()59     public Object clone() {
60         try {
61             return super.clone();
62         } catch (CloneNotSupportedException e) {
63             throw new AssertionError(e);
64         }
65     }
66 }
67