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