Home » openjdk-7 » java » util » [javadoc | source]
java.util
class: JapaneseImperialCalendar [javadoc | source]
java.lang.Object
   java.util.Calendar
      java.util.JapaneseImperialCalendar

All Implemented Interfaces:
    Cloneable, Comparable, java$io$Serializable

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.

Field Summary
public static final  int BEFORE_MEIJI    The ERA constant designating the era before Meiji. 
public static final  int MEIJI    The ERA constant designating the Meiji era. 
public static final  int TAISHO    The ERA constant designating the Taisho era. 
public static final  int SHOWA    The ERA constant designating the Showa era. 
public static final  int HEISEI    The ERA constant designating the Heisei era. 
static final  int[] MIN_VALUES     
static final  int[] LEAST_MAX_VALUES     
static final  int[] MAX_VALUES     
Fields inherited from java.util.Calendar:
ERA,  YEAR,  MONTH,  WEEK_OF_YEAR,  WEEK_OF_MONTH,  DATE,  DAY_OF_MONTH,  DAY_OF_YEAR,  DAY_OF_WEEK,  DAY_OF_WEEK_IN_MONTH,  AM_PM,  HOUR,  HOUR_OF_DAY,  MINUTE,  SECOND,  MILLISECOND,  ZONE_OFFSET,  DST_OFFSET,  FIELD_COUNT,  SUNDAY,  MONDAY,  TUESDAY,  WEDNESDAY,  THURSDAY,  FRIDAY,  SATURDAY,  JANUARY,  FEBRUARY,  MARCH,  APRIL,  MAY,  JUNE,  JULY,  AUGUST,  SEPTEMBER,  OCTOBER,  NOVEMBER,  DECEMBER,  UNDECIMBER,  AM,  PM,  ALL_STYLES,  SHORT,  LONG,  fields,  isSet,  time,  isTimeSet,  areFieldsSet,  areAllFieldsSet,  ALL_FIELDS,  currentSerialVersion,  serialVersionUID,  ERA_MASK,  YEAR_MASK,  MONTH_MASK,  WEEK_OF_YEAR_MASK,  WEEK_OF_MONTH_MASK,  DAY_OF_MONTH_MASK,  DATE_MASK,  DAY_OF_YEAR_MASK,  DAY_OF_WEEK_MASK,  DAY_OF_WEEK_IN_MONTH_MASK,  AM_PM_MASK,  HOUR_MASK,  HOUR_OF_DAY_MASK,  MINUTE_MASK,  SECOND_MASK,  MILLISECOND_MASK,  ZONE_OFFSET_MASK,  DST_OFFSET_MASK
Constructor:
 public JapaneseImperialCalendar(TimeZone zone,
    Locale aLocale) 
    Constructs a JapaneseImperialCalendar based on the current time in the given time zone with the given locale.
    Parameters:
    zone - the given time zone.
    aLocale - the given locale.
Method from java.util.JapaneseImperialCalendar Summary:
add,   clone,   computeFields,   computeTime,   equals,   getActualMaximum,   getActualMinimum,   getDisplayName,   getDisplayNames,   getGreatestMinimum,   getLeastMaximum,   getMaximum,   getMinimum,   getTimeZone,   hashCode,   roll,   roll,   setTimeZone
Methods from java.util.Calendar:
add,   after,   before,   checkDisplayNameParams,   clear,   clear,   clone,   compareTo,   complete,   computeFields,   computeTime,   equals,   get,   getActualMaximum,   getActualMinimum,   getAvailableLocales,   getDisplayName,   getDisplayNames,   getFieldName,   getFirstDayOfWeek,   getGreatestMinimum,   getInstance,   getInstance,   getInstance,   getInstance,   getLeastMaximum,   getMaximum,   getMinimalDaysInFirstWeek,   getMinimum,   getSetStateFields,   getTime,   getTimeInMillis,   getTimeZone,   getWeekYear,   getWeeksInWeekYear,   getZone,   hashCode,   internalGet,   internalSet,   isExternallySet,   isFieldSet,   isFullyNormalized,   isLenient,   isPartiallyNormalized,   isSet,   isWeekDateSupported,   roll,   roll,   selectFields,   set,   set,   set,   set,   setFieldsComputed,   setFieldsNormalized,   setFirstDayOfWeek,   setLenient,   setMinimalDaysInFirstWeek,   setTime,   setTimeInMillis,   setTimeZone,   setUnnormalized,   setWeekDate,   setZoneShared,   toString
Methods from java.lang.Object:
clone,   equals,   finalize,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from java.util.JapaneseImperialCalendar Detail:
 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. 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.

 public Object clone() 
 protected  void computeFields() 
    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.
 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. 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.
 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 getFirstDayOfWeek , getMinimalDaysInFirstWeek , and getTimeZone methods. For example, if the date of this instance is Heisei 16February 1, the actual maximum value of the DAY_OF_MONTH field is 29 because Heisei 16 is a leap year, and if the date of this instance is Heisei 17 February 1, it's 28.
 public int getActualMinimum(int field) 
 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) 
 public int getLeastMaximum(int field) 
 public int getMaximum(int field) 
    Returns the maximum value for the given calendar field of this GregorianCalendar instance. The maximum value is defined as the largest value returned by the get method for any possible time value, taking into consideration the current values of the getFirstDayOfWeek , getMinimalDaysInFirstWeek , and getTimeZone methods.
 public int getMinimum(int field) 
    Returns the minimum value for the given calendar field of this Calendar instance. The minimum value is defined as the smallest value returned by the get method for any possible time value, taking into consideration the current values of the getFirstDayOfWeek , getMinimalDaysInFirstWeek , and getTimeZone methods.
 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. If the specified amount is 0, this method performs nothing.

    This method calls #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.

 public  void setTimeZone(TimeZone zone)