12ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller/* GENERATED SOURCE. DO NOT MODIFY. */ 2f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert// © 2016 and later: Unicode, Inc. and others. 3f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert// License & terms of use: http://www.unicode.org/copyright.html#License 42ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller/* 52ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller ************************************************************************** 62ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * Copyright (C) 2008-2014, Google, International Business Machines 72ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * Corporation and others. All Rights Reserved. 82ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller ************************************************************************** 92ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller */ 102ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fullerpackage android.icu.util; 112ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller 122ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fullerimport java.io.InvalidObjectException; 132ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fullerimport java.io.ObjectStreamException; 142ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller 152ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller 162ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller/** 172ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * Measurement unit for time units. 182ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * @see TimeUnit 192ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * @author markdavis 202ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller */ 212ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fullerpublic class TimeUnit extends MeasureUnit { 222ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller private static final long serialVersionUID = -2839973855554750484L; 232ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller 242ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller /** 252ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * Here for serialization backward compatibility only. 262ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller */ 272ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller private final int index; 282ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller 292ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller TimeUnit(String type, String code) { 302ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller super(type, code); 312ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller index = 0; 322ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller } 332ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller 342ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller /** 352ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * @return the available values 362ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller */ 372ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller public static TimeUnit[] values() { 382ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller return new TimeUnit[] { SECOND, MINUTE, HOUR, DAY, WEEK, MONTH, YEAR }; 392ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller } 402ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller 412ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller private Object writeReplace() throws ObjectStreamException { 422ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller return new MeasureUnitProxy(type, subType); 432ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller } 442ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller 452ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller // For backward compatibility only 462ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller private Object readResolve() throws ObjectStreamException { 472ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller // The old index field used to uniquely identify the time unit. 482ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller switch (index) { 492ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller case 6: 502ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller return SECOND; 512ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller case 5: 522ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller return MINUTE; 532ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller case 4: 542ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller return HOUR; 552ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller case 3: 562ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller return DAY; 572ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller case 2: 582ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller return WEEK; 592ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller case 1: 602ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller return MONTH; 612ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller case 0: 622ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller return YEAR; 632ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller default: 642ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller throw new InvalidObjectException("Bad index: " + index); 652ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller } 662ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller } 672ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller} 68