1 // © 2016 and later: Unicode, Inc. and others. 2 // License & terms of use: http://www.unicode.org/copyright.html 3 /* 4 ************************************************************************** 5 * Copyright (C) 2008-2009, Google, International Business Machines 6 * Corporation and others. All Rights Reserved. 7 ************************************************************************** 8 */ 9 package com.ibm.icu.util; 10 11 /** 12 * Express a duration as a time unit and number. Patterned after Currency. 13 * <p>Immutable. 14 * @see TimeUnitAmount 15 * @see com.ibm.icu.text.TimeUnitFormat 16 * @author markdavis 17 * @stable ICU 4.0 18 */ 19 public class TimeUnitAmount extends Measure { 20 21 /** 22 * Create from a number and unit. 23 * @stable ICU 4.0 24 */ TimeUnitAmount(Number number, TimeUnit unit)25 public TimeUnitAmount(Number number, TimeUnit unit) { 26 super(number, unit); 27 } 28 29 /** 30 * Create from a number and unit. 31 * @stable ICU 4.0 32 */ TimeUnitAmount(double number, TimeUnit unit)33 public TimeUnitAmount(double number, TimeUnit unit) { 34 super(new Double(number), unit); 35 } 36 37 /** 38 * Get the unit (convenience to avoid cast). 39 * @stable ICU 4.0 40 */ getTimeUnit()41 public TimeUnit getTimeUnit() { 42 return (TimeUnit) getUnit(); 43 } 44 } 45