• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* GENERATED SOURCE. DO NOT MODIFY. */
2 // © 2016 and later: Unicode, Inc. and others.
3 // License & terms of use: http://www.unicode.org/copyright.html#License
4 /*
5 **********************************************************************
6 * Copyright (c) 2004-2010, International Business Machines
7 * Corporation and others.  All Rights Reserved.
8 **********************************************************************
9 * Author: Alan Liu
10 * Created: April 12, 2004
11 * Since: ICU 3.0
12 **********************************************************************
13 */
14 package ohos.global.icu.util;
15 
16 
17 /**
18  * An amount of currency, consisting of a Number and a Currency.
19  * CurrencyAmount objects are immutable.
20  *
21  * @see java.lang.Number
22  * @see Currency
23  * @author Alan Liu
24  */
25 public class CurrencyAmount extends Measure {
26 
27     /**
28      * Constructs a new object given a number and a currency.
29      * @param number the number
30      * @param currency the currency
31      */
CurrencyAmount(Number number, Currency currency)32     public CurrencyAmount(Number number, Currency currency) {
33         super(number, currency);
34     }
35 
36     /**
37      * Constructs a new object given a double value and a currency.
38      * @param number a double value
39      * @param currency the currency
40      */
CurrencyAmount(double number, Currency currency)41     public CurrencyAmount(double number, Currency currency) {
42         super(new Double(number), currency);
43     }
44 
45     /**
46      * Constructs a new object given a number and a Java currency.
47      * @param number the number
48      * @param currency the currency
49      */
CurrencyAmount(Number number, java.util.Currency currency)50     public CurrencyAmount(Number number, java.util.Currency currency) {
51         this(number, Currency.fromJavaCurrency(currency));
52     }
53 
54     /**
55      * Constructs a new object given a double value and a Java currency.
56      * @param number a double value
57      * @param currency the currency
58      */
CurrencyAmount(double number, java.util.Currency currency)59     public CurrencyAmount(double number, java.util.Currency currency) {
60         this(number, Currency.fromJavaCurrency(currency));
61     }
62 
63     /**
64      * Returns the currency of this object.
65      * @return this object's Currency
66      */
getCurrency()67     public Currency getCurrency() {
68         return (Currency) getUnit();
69     }
70 }
71