| |
|
| java.lang.Object java.util.Calendar java.util.JapaneseImperialCalendar
JapaneseImperialCalendar | class JapaneseImperialCalendar extends Calendar (Code) | | JapaneseImperialCalendar implements a Japanese
calendar system in which the imperial era-based year numbering is
supported from the Meiji era. The following are the eras supported
by this calendar system.
ERA value Era name Since (in Gregorian)
------------------------------------------------------
0 N/A N/A
1 Meiji 1868-01-01 midnight local time
2 Taisho 1912-07-30 midnight local time
3 Showa 1926-12-25 midnight local time
4 Heisei 1989-01-08 midnight local time
------------------------------------------------------
ERA value 0 specifies the years before Meiji and
the Gregorian year values are used. Unlike
GregorianCalendar , the Julian to Gregorian transition is not
supported because it doesn't make any sense to the Japanese
calendar systems used before Meiji. To represent the years before
Gregorian year 1, 0 and negative values are used. The Japanese
Imperial rescripts and government decrees don't specify how to deal
with time differences for applying the era transitions. This
calendar implementation assumes local time for all transitions.
author: Masayoshi Okutsu since: 1.6
|
Field Summary | |
final public static int | BEFORE_MEIJI The ERA constant designating the era before Meiji. | final public static int | HEISEI The ERA constant designating the Heisei era. | final static int | LEAST_MAX_VALUES | final static int | MAX_VALUES | final public static int | MEIJI The ERA constant designating the Meiji era. | final static int | MIN_VALUES | final public static int | SHOWA The ERA constant designating the Showa era. | final public static int | TAISHO The ERA constant designating the Taisho era. |
Constructor Summary | |
public | JapaneseImperialCalendar(TimeZone zone, Locale aLocale) Constructs a JapaneseImperialCalendar based on the current time
in the given time zone with the given locale. |
Method Summary | |
public void | add(int field, int amount) Adds the specified (signed) amount of time to the given calendar field,
based on the calendar's rules.
Add rule 1. | public Object | clone() | protected void | computeFields() Converts the time value (millisecond offset from the Epoch) to calendar field values. | protected void | computeTime() Converts calendar field values to the time value (millisecond
offset from the Epoch). | public boolean | equals(Object obj) Compares this JapaneseImperialCalendar to the specified
Object . | public int | getActualMaximum(int field) Returns the maximum value that this calendar field could have,
taking into consideration the given time value and the current
values of the
Calendar.getFirstDayOfWeek getFirstDayOfWeek ,
Calendar.getMinimalDaysInFirstWeek getMinimalDaysInFirstWeek ,
and
Calendar.getTimeZone getTimeZone methods. | public int | getActualMinimum(int field) Returns the minimum value that this calendar field could have,
taking into consideration the given time value and the current
values of the
Calendar.getFirstDayOfWeek getFirstDayOfWeek ,
Calendar.getMinimalDaysInFirstWeek getMinimalDaysInFirstWeek ,
and
Calendar.getTimeZone getTimeZone methods. | public String | getDisplayName(int field, int style, Locale locale) | public Map<String, Integer> | getDisplayNames(int field, int style, Locale locale) | public int | getGreatestMinimum(int field) Returns the highest minimum value for the given calendar field
of this GregorianCalendar instance. | public int | getLeastMaximum(int field) Returns the lowest maximum value for the given calendar field
of this GregorianCalendar instance. | public int | getMaximum(int field) Returns the maximum value for the given calendar field of this
GregorianCalendar instance. | public int | getMinimum(int field) Returns the minimum value for the given calendar field of this
Calendar instance. | public TimeZone | getTimeZone() | public int | hashCode() Generates the hash code for this
JapaneseImperialCalendar object. | public void | roll(int field, boolean up) | public void | roll(int field, int amount) Adds a signed amount to the specified calendar field without changing larger fields.
A negative roll amount means to subtract from field without changing
larger fields. | public void | setTimeZone(TimeZone zone) |
BEFORE_MEIJI | final public static int BEFORE_MEIJI(Code) | | The ERA constant designating the era before Meiji.
|
HEISEI | final public static int HEISEI(Code) | | The ERA constant designating the Heisei era.
|
LEAST_MAX_VALUES | final static int LEAST_MAX_VALUES(Code) | | |
MAX_VALUES | final static int MAX_VALUES(Code) | | |
MEIJI | final public static int MEIJI(Code) | | The ERA constant designating the Meiji era.
|
MIN_VALUES | final static int MIN_VALUES(Code) | | |
SHOWA | final public static int SHOWA(Code) | | The ERA constant designating the Showa era.
|
TAISHO | final public static int TAISHO(Code) | | The ERA constant designating the Taisho era.
|
JapaneseImperialCalendar | public JapaneseImperialCalendar(TimeZone zone, Locale aLocale)(Code) | | Constructs a JapaneseImperialCalendar based on the current time
in the given time zone with the given locale.
Parameters: zone - the given time zone. Parameters: aLocale - the given locale. |
add | public void add(int field, int amount)(Code) | | Adds the specified (signed) amount of time to the given calendar field,
based on the calendar's rules.
Add rule 1. The value of field
after the call minus the value of field before the
call is amount , modulo any overflow that has occurred in
field . Overflow occurs when a field value exceeds its
range and, as a result, the next larger field is incremented or
decremented and the field value is adjusted back into its range.
Add rule 2. If a smaller field is expected to be
invariant, but it is impossible for it to be equal to its
prior value because of changes in its minimum or maximum after
field is changed, then its value is adjusted to be as close
as possible to its expected value. A smaller field represents a
smaller unit of time. HOUR is a smaller field than
DAY_OF_MONTH . No adjustment is made to smaller fields
that are not expected to be invariant. The calendar system
determines what fields are expected to be invariant.
Parameters: field - the calendar field. Parameters: amount - the amount of date or time to be added to the field. exception: IllegalArgumentException - if field isZONE_OFFSET , DST_OFFSET , or unknown,or if any calendar fields have out-of-range values innon-lenient mode. |
computeFields | protected void computeFields()(Code) | | Converts the time value (millisecond offset from the Epoch) to calendar field values.
The time is not
recomputed first; to recompute the time, then the fields, call the
complete method.
See Also: Calendar.complete |
computeTime | protected void computeTime()(Code) | | Converts calendar field values to the time value (millisecond
offset from the Epoch).
exception: IllegalArgumentException - if any calendar fields are invalid. |
equals | public boolean equals(Object obj)(Code) | | Compares this JapaneseImperialCalendar to the specified
Object . The result is true if and
only if the argument is a JapaneseImperialCalendar object
that represents the same time value (millisecond offset from
the Epoch) under the same
Calendar parameters.
Parameters: obj - the object to compare with. true if this object is equal to obj ;false otherwise. See Also: Calendar.compareTo(Calendar) |
hashCode | public int hashCode()(Code) | | Generates the hash code for this
JapaneseImperialCalendar object.
|
roll | public void roll(int field, boolean up)(Code) | | |
roll | public void roll(int field, int amount)(Code) | | Adds a signed amount to the specified calendar field without changing larger fields.
A negative roll amount means to subtract from field without changing
larger fields. If the specified amount is 0, this method performs nothing.
This method calls
JapaneseImperialCalendar.complete() before adding the
amount so that all the calendar fields are normalized. If there
is any calendar field having an out-of-range value in non-lenient mode, then an
IllegalArgumentException is thrown.
Parameters: field - the calendar field. Parameters: amount - the signed amount to add to field . exception: IllegalArgumentException - if field isZONE_OFFSET , DST_OFFSET , or unknown,or if any calendar fields have out-of-range values innon-lenient mode. See Also: JapaneseImperialCalendar.roll(int,boolean) See Also: JapaneseImperialCalendar.add(int,int) See Also: JapaneseImperialCalendar.set(int,int) |
Methods inherited from java.util.Calendar | abstract public void add(int field, int amount)(Code)(Java Doc) public boolean after(Object when)(Code)(Java Doc) public boolean before(Object when)(Code)(Java Doc) boolean checkDisplayNameParams(int field, int style, int minStyle, int maxStyle, Locale locale, int fieldMask)(Code)(Java Doc) final public void clear()(Code)(Java Doc) final public void clear(int field)(Code)(Java Doc) public Object clone()(Code)(Java Doc) public int compareTo(Calendar anotherCalendar)(Code)(Java Doc) protected void complete()(Code)(Java Doc) abstract protected void computeFields()(Code)(Java Doc) abstract protected void computeTime()(Code)(Java Doc) public boolean equals(Object obj)(Code)(Java Doc) public int get(int field)(Code)(Java Doc) public int getActualMaximum(int field)(Code)(Java Doc) public int getActualMinimum(int field)(Code)(Java Doc) public static synchronized Locale[] getAvailableLocales()(Code)(Java Doc) public String getDisplayName(int field, int style, Locale locale)(Code)(Java Doc) public Map<String, Integer> getDisplayNames(int field, int style, Locale locale)(Code)(Java Doc) final static String getFieldName(int field)(Code)(Java Doc) public int getFirstDayOfWeek()(Code)(Java Doc) abstract public int getGreatestMinimum(int field)(Code)(Java Doc) public static Calendar getInstance()(Code)(Java Doc) public static Calendar getInstance(TimeZone zone)(Code)(Java Doc) public static Calendar getInstance(Locale aLocale)(Code)(Java Doc) public static Calendar getInstance(TimeZone zone, Locale aLocale)(Code)(Java Doc) abstract public int getLeastMaximum(int field)(Code)(Java Doc) abstract public int getMaximum(int field)(Code)(Java Doc) public int getMinimalDaysInFirstWeek()(Code)(Java Doc) abstract public int getMinimum(int field)(Code)(Java Doc) final int getSetStateFields()(Code)(Java Doc) final public Date getTime()(Code)(Java Doc) public long getTimeInMillis()(Code)(Java Doc) public TimeZone getTimeZone()(Code)(Java Doc) TimeZone getZone()(Code)(Java Doc) public int hashCode()(Code)(Java Doc) final protected int internalGet(int field)(Code)(Java Doc) final void internalSet(int field, int value)(Code)(Java Doc) final boolean isExternallySet(int field)(Code)(Java Doc) final static boolean isFieldSet(int fieldMask, int field)(Code)(Java Doc) final boolean isFullyNormalized()(Code)(Java Doc) public boolean isLenient()(Code)(Java Doc) final boolean isPartiallyNormalized()(Code)(Java Doc) final public boolean isSet(int field)(Code)(Java Doc) abstract public void roll(int field, boolean up)(Code)(Java Doc) public void roll(int field, int amount)(Code)(Java Doc) final int selectFields()(Code)(Java Doc) public void set(int field, int value)(Code)(Java Doc) final public void set(int year, int month, int date)(Code)(Java Doc) final public void set(int year, int month, int date, int hourOfDay, int minute)(Code)(Java Doc) final public void set(int year, int month, int date, int hourOfDay, int minute, int second)(Code)(Java Doc) final void setFieldsComputed(int fieldMask)(Code)(Java Doc) final void setFieldsNormalized(int fieldMask)(Code)(Java Doc) public void setFirstDayOfWeek(int value)(Code)(Java Doc) public void setLenient(boolean lenient)(Code)(Java Doc) public void setMinimalDaysInFirstWeek(int value)(Code)(Java Doc) final public void setTime(Date date)(Code)(Java Doc) public void setTimeInMillis(long millis)(Code)(Java Doc) public void setTimeZone(TimeZone value)(Code)(Java Doc) final void setUnnormalized()(Code)(Java Doc) void setZoneShared(boolean shared)(Code)(Java Doc) public String toString()(Code)(Java Doc)
|
|
|
|