2 **************************************************************************
\r
3 * Copyright (C) 2008-2009, Google, International Business Machines
\r
4 * Corporation and others. All Rights Reserved.
\r
5 **************************************************************************
\r
7 package com.ibm.icu.util;
\r
10 * Measurement unit for time units.
\r
11 * @see TimeUnitAmount
\r
16 public class TimeUnit extends MeasureUnit {
\r
18 * Supports selected time duration units
\r
20 private String name;
\r
22 private static TimeUnit[] values = new TimeUnit[7]; // adjust count if new items are added
\r
23 private static int valueCount = 0;
\r
26 * Constant value for supported time unit.
\r
29 public static TimeUnit
\r
30 SECOND = new TimeUnit("second"),
\r
31 MINUTE = new TimeUnit("minute"),
\r
32 HOUR = new TimeUnit("hour"),
\r
33 DAY = new TimeUnit("day"),
\r
34 WEEK = new TimeUnit("week"),
\r
35 MONTH = new TimeUnit("month"),
\r
36 YEAR = new TimeUnit("year");
\r
38 private TimeUnit(String name) {
\r
40 values[valueCount++] = this; // store in values array
\r
44 * @return the available values
\r
47 public static TimeUnit[] values() {
\r
48 return (TimeUnit[])values.clone();
\r
52 * A string representation for debugging.
\r
53 * It is for debugging purpose. The value might change.
\r
54 * Please do not count on the value.
\r
57 public String toString() {
\r