• 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 java.math.RoundingMode;
7 import java.util.Objects;
8 
9 import ohos.global.icu.number.IntegerWidth;
10 import ohos.global.icu.number.Notation;
11 import ohos.global.icu.number.NumberFormatter.DecimalSeparatorDisplay;
12 import ohos.global.icu.number.NumberFormatter.SignDisplay;
13 import ohos.global.icu.number.NumberFormatter.UnitWidth;
14 import ohos.global.icu.number.Precision;
15 import ohos.global.icu.number.Scale;
16 import ohos.global.icu.text.PluralRules;
17 import ohos.global.icu.util.MeasureUnit;
18 import ohos.global.icu.util.ULocale;
19 
20 /**
21  * @hide exposed on OHOS
22  */
23 public class MacroProps implements Cloneable {
24     public Notation notation;
25     public MeasureUnit unit;
26     public MeasureUnit perUnit;
27     public Precision precision;
28     public RoundingMode roundingMode;
29     public Object grouping;
30     public Padder padder;
31     public IntegerWidth integerWidth;
32     public Object symbols;
33     public UnitWidth unitWidth;
34     public SignDisplay sign;
35     public DecimalSeparatorDisplay decimal;
36     public Scale scale;
37     public AffixPatternProvider affixProvider; // not in API; for JDK compatibility mode only
38     public PluralRules rules; // not in API; could be made public in the future
39     public Long threshold; // not in API; controls internal self-regulation threshold
40     public ULocale loc;
41 
42     /**
43      * Copies values from fallback into this instance if they are null in this instance.
44      *
45      * @param fallback
46      *            The instance to copy from; not modified by this operation.
47      */
fallback(MacroProps fallback)48     public void fallback(MacroProps fallback) {
49         if (notation == null)
50             notation = fallback.notation;
51         if (unit == null)
52             unit = fallback.unit;
53         if (perUnit == null)
54             perUnit = fallback.perUnit;
55         if (precision == null)
56             precision = fallback.precision;
57         if (roundingMode == null)
58             roundingMode = fallback.roundingMode;
59         if (grouping == null)
60             grouping = fallback.grouping;
61         if (padder == null)
62             padder = fallback.padder;
63         if (integerWidth == null)
64             integerWidth = fallback.integerWidth;
65         if (symbols == null)
66             symbols = fallback.symbols;
67         if (unitWidth == null)
68             unitWidth = fallback.unitWidth;
69         if (sign == null)
70             sign = fallback.sign;
71         if (decimal == null)
72             decimal = fallback.decimal;
73         if (affixProvider == null)
74             affixProvider = fallback.affixProvider;
75         if (scale == null)
76             scale = fallback.scale;
77         if (rules == null)
78             rules = fallback.rules;
79         if (loc == null)
80             loc = fallback.loc;
81     }
82 
83     @Override
hashCode()84     public int hashCode() {
85         return Objects.hash(notation,
86                 unit,
87                 perUnit,
88                 precision,
89                 roundingMode,
90                 grouping,
91                 padder,
92                 integerWidth,
93                 symbols,
94                 unitWidth,
95                 sign,
96                 decimal,
97                 affixProvider,
98                 scale,
99                 rules,
100                 loc);
101     }
102 
103     @Override
equals(Object _other)104     public boolean equals(Object _other) {
105         if (_other == null)
106             return false;
107         if (this == _other)
108             return true;
109         if (!(_other instanceof MacroProps))
110             return false;
111         MacroProps other = (MacroProps) _other;
112         return Objects.equals(notation, other.notation)
113                 && Objects.equals(unit, other.unit)
114                 && Objects.equals(perUnit, other.perUnit)
115                 && Objects.equals(precision, other.precision)
116                 && Objects.equals(roundingMode, other.roundingMode)
117                 && Objects.equals(grouping, other.grouping)
118                 && Objects.equals(padder, other.padder)
119                 && Objects.equals(integerWidth, other.integerWidth)
120                 && Objects.equals(symbols, other.symbols)
121                 && Objects.equals(unitWidth, other.unitWidth)
122                 && Objects.equals(sign, other.sign)
123                 && Objects.equals(decimal, other.decimal)
124                 && Objects.equals(affixProvider, other.affixProvider)
125                 && Objects.equals(scale, other.scale)
126                 && Objects.equals(rules, other.rules)
127                 && Objects.equals(loc, other.loc);
128     }
129 
130     @Override
clone()131     public Object clone() {
132         // TODO: Remove this method?
133         try {
134             return super.clone();
135         } catch (CloneNotSupportedException e) {
136             throw new AssertionError(e);
137         }
138     }
139 }
140