diff -r 3bbdae468b05 -r 60207b2b4b42 jdk/src/share/classes/java/time/chrono/MinguoEra.java --- a/jdk/src/share/classes/java/time/chrono/MinguoEra.java Thu Apr 11 19:15:24 2013 -0700 +++ b/jdk/src/share/classes/java/time/chrono/MinguoEra.java Fri Apr 12 07:57:35 2013 -0700 @@ -24,6 +24,11 @@ */ /* + * This file is available under and governed by the GNU General Public + * License version 2 only, as published by the Free Software Foundation. + * However, the following notice accompanied the original version of this + * file: + * * Copyright (c) 2012, Stephen Colebourne & Michael Nascimento Santos * * All rights reserved. @@ -65,7 +70,34 @@ * An era in the Minguo calendar system. *
* The Minguo calendar system has two eras. - * The date {@code 0001-01-01 (Minguo)} is equal to {@code 1912-01-01 (ISO)}. + * The current era, for years from 1 onwards, is known as the 'Republic of China' era. + * All previous years, zero or earlier in the proleptic count or one and greater + * in the year-of-era count, are part of the 'Before Republic of China' era. + *
+ *
year-of-era | + *era | + *proleptic-year | + *ISO proleptic-year | + *
---|---|---|---|
2 | ROC | 2 | 1913 | + *
1 | ROC | 1 | 1912 | + *
1 | BEFORE_ROC | 0 | 1911 | + *
2 | BEFORE_ROC | -1 | 1910 | + *
* Do not use {@code ordinal()} to obtain the numeric representation of {@code MinguoEra}. * Use {@code getValue()} instead. @@ -75,16 +107,16 @@ * * @since 1.8 */ -enum MinguoEra implements Era { +public enum MinguoEra implements Era { /** - * The singleton instance for the era BEFORE_ROC, 'Before Republic of China'. - * This has the numeric value of {@code 0}. + * The singleton instance for the era before the current one, 'Before Republic of China Era', + * which has the numeric value 0. */ BEFORE_ROC, /** - * The singleton instance for the era ROC, 'Republic of China'. - * This has the numeric value of {@code 1}. + * The singleton instance for the current era, 'Republic of China Era', + * which has the numeric value 1. */ ROC; @@ -95,18 +127,18 @@ * {@code MinguoEra} is an enum representing the Minguo eras of BEFORE_ROC/ROC. * This factory allows the enum to be obtained from the {@code int} value. * - * @param era the BEFORE_ROC/ROC value to represent, from 0 (BEFORE_ROC) to 1 (ROC) + * @param minguoEra the BEFORE_ROC/ROC value to represent, from 0 (BEFORE_ROC) to 1 (ROC) * @return the era singleton, not null * @throws DateTimeException if the value is invalid */ - public static MinguoEra of(int era) { - switch (era) { + public static MinguoEra of(int minguoEra) { + switch (minguoEra) { case 0: return BEFORE_ROC; case 1: return ROC; default: - throw new DateTimeException("Invalid era: " + era); + throw new DateTimeException("Invalid era: " + minguoEra); } } @@ -123,24 +155,7 @@ return ordinal(); } - @Override - public MinguoChronology getChronology() { - return MinguoChronology.INSTANCE; - } - - // JDK8 default methods: //----------------------------------------------------------------------- - @Override - public MinguoDate date(int year, int month, int day) { - return (MinguoDate)(getChronology().date(this, year, month, day)); - } - - @Override - public MinguoDate dateYearDay(int year, int dayOfYear) { - return (MinguoDate)(getChronology().dateYearDay(this, year, dayOfYear)); - } - - //------------------------------------------------------------------------- private Object writeReplace() { return new Ser(Ser.MINGUO_ERA_TYPE, this); }