Package sun.util.calendar

Examples of sun.util.calendar.Era


  } else {
      // Handle Julian calendar dates.
      calsys = getJulianCalendarSystem();
      cdate = (BaseCalendar.Date) jcal.newCalendarDate(getZone());
      jcal.getCalendarDateFromFixedDate(cdate, fixedDate);
      Era e = cdate.getEra();
      if (e == jeras[0]) {
    era = BCE;
      }
      year = cdate.getYear();
  }
View Full Code Here


        map.put(strings[i], base + i);
    }
    // If strings[] has fewer than eras[], get more names from eras[].
    if (field == ERA && strings.length < eras.length) {
        for (int i = strings.length; i < eras.length; i++) {
      Era era = eras[i];
      String name = (style == SHORT) ? era.getAbbreviation() : era.getName();
      map.put(name, i);
        }
    }
      }
  }
View Full Code Here

     * @param date the date for which the first day of the year is
     * calculated. The date has to be in the cut-over year.
     * @param fixedDate the fixed date representation of the date
     */
    private final long getFixedDateJan1(LocalGregorianCalendar.Date date, long fixedDate) {
  Era era = date.getEra();
  if (date.getEra() != null && date.getYear() == 1) {
      for (int eraIndex = getEraIndex(date); eraIndex > 0; eraIndex--) {
    CalendarDate d = eras[eraIndex].getSinceDate();
    long fd = gcal.getFixedDate(d);
    // There might be multiple era transitions in a year.
View Full Code Here

  }
  return false;
    }

    private static final int getEraIndex(LocalGregorianCalendar.Date date) {
  Era era = date.getEra();
  for (int i = eras.length - 1; i > 0; i--) {
      if (eras[i] == era) {
    return i;
      }
  }
View Full Code Here

      } else {
    int index = get(field);
    // If the ERA value is out of range for strings, then
    // try to get its name or abbreviation from the Era instance.
    if (field == ERA && index >= strings.length && index < eras.length) {
        Era era = eras[index];
        name = (style == SHORT) ? era.getAbbreviation() : era.getName();
    } else {
        if (field == DAY_OF_WEEK)
      --index;
        name = strings[index];
    }
View Full Code Here

        } else {
            // Handle Julian calendar dates.
            calsys = getJulianCalendarSystem();
            cdate = (BaseCalendar.Date) jcal.newCalendarDate(getZone());
            jcal.getCalendarDateFromFixedDate(cdate, fixedDate);
            Era e = cdate.getEra();
            if (e == jeras[0]) {
                era = BCE;
            }
            year = cdate.getYear();
        }
View Full Code Here

                    size = values.size();
                }
                if (size < eras.length) {
                    int baseStyle = getBaseStyle(style);
                    for (int i = size; i < eras.length; i++) {
                        Era era = eras[i];
                        if (baseStyle == ALL_STYLES || baseStyle == SHORT
                                || baseStyle == NARROW_FORMAT) {
                            names.put(era.getAbbreviation(), i);
                        }
                        if (baseStyle == ALL_STYLES || baseStyle == LONG) {
                            names.put(era.getName(), i);
                        }
                    }
                }
            }
        }
View Full Code Here

     * @param date the date for which the first day of the year is
     * calculated. The date has to be in the cut-over year.
     * @param fixedDate the fixed date representation of the date
     */
    private long getFixedDateJan1(LocalGregorianCalendar.Date date, long fixedDate) {
        Era era = date.getEra();
        if (date.getEra() != null && date.getYear() == 1) {
            for (int eraIndex = getEraIndex(date); eraIndex > 0; eraIndex--) {
                CalendarDate d = eras[eraIndex].getSinceDate();
                long fd = gcal.getFixedDate(d);
                // There might be multiple era transitions in a year.
View Full Code Here

        }
        return false;
    }

    private static int getEraIndex(LocalGregorianCalendar.Date date) {
        Era era = date.getEra();
        for (int i = eras.length - 1; i > 0; i--) {
            if (eras[i] == era) {
                return i;
            }
        }
View Full Code Here

        } else {
            // Handle Julian calendar dates.
            calsys = getJulianCalendarSystem();
            cdate = (BaseCalendar.Date) jcal.newCalendarDate(getZone());
            jcal.getCalendarDateFromFixedDate(cdate, fixedDate);
            Era e = cdate.getEra();
            if (e == jeras[0]) {
                era = BCE;
            }
            year = cdate.getYear();
        }
View Full Code Here

TOP

Related Classes of sun.util.calendar.Era

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.