• 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 /**
7  * This interface is used when all number formatting settings, including the locale, are known, except
8  * for the quantity itself. The {@link #processQuantity} method performs the final step in the number
9  * processing pipeline: it uses the quantity to generate a finalized {@link MicroProps}, which can be
10  * used to render the number to output.
11  *
12  * <p>
13  * In other words, this interface is used for the parts of number processing that are
14  * <em>quantity-dependent</em>.
15  *
16  * <p>
17  * In order to allow for multiple different objects to all mutate the same MicroProps, a "chain" of
18  * MicroPropsGenerators are linked together, and each one is responsible for manipulating a certain
19  * quantity-dependent part of the MicroProps. At the top of the linked list is a base instance of
20  * {@link MicroProps} with properties that are not quantity-dependent. Each element in the linked list
21  * calls {@link #processQuantity} on its "parent", then does its work, and then returns the result.
22  *
23  * <p>
24  * A class implementing MicroPropsGenerator looks something like this:
25  *
26  * <pre>
27  * class Foo implements MicroPropsGenerator {
28  *     private final MicroPropsGenerator parent;
29  *
30  *     public Foo(MicroPropsGenerator parent) {
31  *         this.parent = parent;
32  *     }
33  *
34  *     &#64;Override
35  *     public MicroProps processQuantity(DecimalQuantity quantity) {
36  *         MicroProps micros = this.parent.processQuantity(quantity);
37  *         // Perform manipulations on micros and/or quantity
38  *         return micros;
39  *     }
40  * }
41  * </pre>
42  *
43  * @author sffc
44  * @hide exposed on OHOS
45  *
46  */
47 public interface MicroPropsGenerator {
48     /**
49      * Considers the given {@link DecimalQuantity}, optionally mutates it, and returns a
50      * {@link MicroProps}.
51      *
52      * @param quantity
53      *            The quantity for consideration and optional mutation.
54      * @return A MicroProps instance resolved for the quantity.
55      */
processQuantity(DecimalQuantity quantity)56     public MicroProps processQuantity(DecimalQuantity quantity);
57 }