Class EraRules

java.lang.Object
org.graalvm.shadowed.com.ibm.icu.impl.EraRules

public class EraRules extends Object
EraRules represents calendar era rules specified in supplementalData/calendarData.
  • Field Details

    • MIN_ENCODED_START

      public static final int MIN_ENCODED_START
  • Method Details

    • getInstance

      public static EraRules getInstance(CalType calType, boolean includeTentativeEra)
    • getInstance

      public static EraRules getInstance(String calId, boolean includeTentativeEra)
    • getNumberOfEras

      public int getNumberOfEras()
      Gets number of effective eras
      Returns:
      number of effective eras (not the same as max era code)
    • getMaxEraCode

      public int getMaxEraCode()
      Gets maximum defined era code for the current calendar
      Returns:
      maximum defined era code
    • getStartDate

      public int[] getStartDate(int eraCode, int[] fillIn)
      Gets start date of an era
      Parameters:
      eraCode - Era code
      fillIn - Receives date fields if supplied. If null, or size of array is less than 3, then a new int[] will be newly allocated.
      Returns:
      An int array including values of year, month, day of month in this order. When an era has no start date, the result will be January 1st in year whose value is minimum integer.
    • getStartYear

      public int getStartYear(int eraCode)
      Gets start year of an era
      Parameters:
      eraCode - Era code
      Returns:
      The first year of an era. When a era has no start date, minimum integer value is returned.
    • getEraCode

      public int getEraCode(int year, int month, int day)
      Returns era code for the specified year/month/day.
      Parameters:
      year - Year
      month - Month (1-base)
      day - Day of month
      Returns:
      era code (or code of earliest era when date is before that era)
    • getCurrentEraCode

      public int getCurrentEraCode()
      Gets the current era code. This is calculated only once for an instance of EraRules. The current era calculation is based on the default time zone at the time of instantiation.
      Returns:
      era index of current era (or era code of earliest era when current date is before any era)