sun.util.calendar.LocalGregorianCalendar Java Examples

The following examples show how to use sun.util.calendar.LocalGregorianCalendar. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: JapaneseImperialCalendar.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Returns the index to the new era if the given date is in a
 * transition month.  For example, if the give date is Heisei 1
 * (1989) January 20, then the era index for Heisei is
 * returned. Likewise, if the given date is Showa 64 (1989)
 * January 3, then the era index for Heisei is returned. If the
 * given date is not in any transition month, then -1 is returned.
 */
private static int getTransitionEraIndex(LocalGregorianCalendar.Date date) {
    int eraIndex = getEraIndex(date);
    CalendarDate transitionDate = eras[eraIndex].getSinceDate();
    if (transitionDate.getYear() == date.getNormalizedYear() &&
        transitionDate.getMonth() == date.getMonth()) {
        return eraIndex;
    }
    if (eraIndex < eras.length - 1) {
        transitionDate = eras[++eraIndex].getSinceDate();
        if (transitionDate.getYear() == date.getNormalizedYear() &&
            transitionDate.getMonth() == date.getMonth()) {
            return eraIndex;
        }
    }
    return -1;
}
 
Example #2
Source File: JapaneseChronology.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
@Override
public int prolepticYear(Era era, int yearOfEra) {
    if (era instanceof JapaneseEra == false) {
        throw new ClassCastException("Era must be JapaneseEra");
    }

    JapaneseEra jera = (JapaneseEra) era;
    int gregorianYear = jera.getPrivateEra().getSinceDate().getYear() + yearOfEra - 1;
    if (yearOfEra == 1) {
        return gregorianYear;
    }
    if (gregorianYear >= Year.MIN_VALUE && gregorianYear <= Year.MAX_VALUE) {
        LocalGregorianCalendar.Date jdate = JCAL.newCalendarDate(null);
        jdate.setEra(jera.getPrivateEra()).setDate(yearOfEra, 1, 1);
        if (JapaneseChronology.JCAL.validate(jdate)) {
            return gregorianYear;
        }
    }
    throw new DateTimeException("Invalid yearOfEra value");
}
 
Example #3
Source File: JapaneseChronology.java    From JDKSourceCode1.8 with MIT License 6 votes vote down vote up
@Override
public int prolepticYear(Era era, int yearOfEra) {
    if (era instanceof JapaneseEra == false) {
        throw new ClassCastException("Era must be JapaneseEra");
    }

    JapaneseEra jera = (JapaneseEra) era;
    int gregorianYear = jera.getPrivateEra().getSinceDate().getYear() + yearOfEra - 1;
    if (yearOfEra == 1) {
        return gregorianYear;
    }
    if (gregorianYear >= Year.MIN_VALUE && gregorianYear <= Year.MAX_VALUE) {
        LocalGregorianCalendar.Date jdate = JCAL.newCalendarDate(null);
        jdate.setEra(jera.getPrivateEra()).setDate(yearOfEra, 1, 1);
        if (JapaneseChronology.JCAL.validate(jdate)) {
            return gregorianYear;
        }
    }
    throw new DateTimeException("Invalid yearOfEra value");
}
 
Example #4
Source File: JapaneseImperialCalendar.java    From jdk1.8-source-analysis with Apache License 2.0 6 votes vote down vote up
/**
 * Returns the fixed date of the first date of the month (usually
 * the 1st of the month) before the specified date.
 *
 * @param date the date for which the first day of the month is
 * calculated. The date must be in the era transition year.
 * @param fixedDate the fixed date representation of the date
 */
private long getFixedDateMonth1(LocalGregorianCalendar.Date date,
                                      long fixedDate) {
    int eraIndex = getTransitionEraIndex(date);
    if (eraIndex != -1) {
        long transition = sinceFixedDates[eraIndex];
        // If the given date is on or after the transition date, then
        // return the transition date.
        if (transition <= fixedDate) {
            return transition;
        }
    }

    // Otherwise, we can use the 1st day of the month.
    return fixedDate - date.getDayOfMonth() + 1;
}
 
Example #5
Source File: JapaneseImperialCalendar.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Returns the index to the new era if the given date is in a
 * transition month.  For example, if the give date is Heisei 1
 * (1989) January 20, then the era index for Heisei is
 * returned. Likewise, if the given date is Showa 64 (1989)
 * January 3, then the era index for Heisei is returned. If the
 * given date is not in any transition month, then -1 is returned.
 */
private static int getTransitionEraIndex(LocalGregorianCalendar.Date date) {
    int eraIndex = getEraIndex(date);
    CalendarDate transitionDate = eras[eraIndex].getSinceDate();
    if (transitionDate.getYear() == date.getNormalizedYear() &&
        transitionDate.getMonth() == date.getMonth()) {
        return eraIndex;
    }
    if (eraIndex < eras.length - 1) {
        transitionDate = eras[++eraIndex].getSinceDate();
        if (transitionDate.getYear() == date.getNormalizedYear() &&
            transitionDate.getMonth() == date.getMonth()) {
            return eraIndex;
        }
    }
    return -1;
}
 
Example #6
Source File: JapaneseImperialCalendar.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Returns the index to the new era if the given date is in a
 * transition month.  For example, if the give date is Heisei 1
 * (1989) January 20, then the era index for Heisei is
 * returned. Likewise, if the given date is Showa 64 (1989)
 * January 3, then the era index for Heisei is returned. If the
 * given date is not in any transition month, then -1 is returned.
 */
private static int getTransitionEraIndex(LocalGregorianCalendar.Date date) {
    int eraIndex = getEraIndex(date);
    CalendarDate transitionDate = eras[eraIndex].getSinceDate();
    if (transitionDate.getYear() == date.getNormalizedYear() &&
        transitionDate.getMonth() == date.getMonth()) {
        return eraIndex;
    }
    if (eraIndex < eras.length - 1) {
        transitionDate = eras[++eraIndex].getSinceDate();
        if (transitionDate.getYear() == date.getNormalizedYear() &&
            transitionDate.getMonth() == date.getMonth()) {
            return eraIndex;
        }
    }
    return -1;
}
 
Example #7
Source File: JapaneseChronology.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
@Override
public int prolepticYear(Era era, int yearOfEra) {
    if (era instanceof JapaneseEra == false) {
        throw new ClassCastException("Era must be JapaneseEra");
    }

    JapaneseEra jera = (JapaneseEra) era;
    int gregorianYear = jera.getPrivateEra().getSinceDate().getYear() + yearOfEra - 1;
    if (yearOfEra == 1) {
        return gregorianYear;
    }
    if (gregorianYear >= Year.MIN_VALUE && gregorianYear <= Year.MAX_VALUE) {
        LocalGregorianCalendar.Date jdate = JCAL.newCalendarDate(null);
        jdate.setEra(jera.getPrivateEra()).setDate(yearOfEra, 1, 1);
        if (JapaneseChronology.JCAL.validate(jdate)) {
            return gregorianYear;
        }
    }
    throw new DateTimeException("Invalid yearOfEra value");
}
 
Example #8
Source File: JapaneseChronology.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
@Override
public int prolepticYear(Era era, int yearOfEra) {
    if (era instanceof JapaneseEra == false) {
        throw new ClassCastException("Era must be JapaneseEra");
    }

    JapaneseEra jera = (JapaneseEra) era;
    int gregorianYear = jera.getPrivateEra().getSinceDate().getYear() + yearOfEra - 1;
    if (yearOfEra == 1) {
        return gregorianYear;
    }
    if (gregorianYear >= Year.MIN_VALUE && gregorianYear <= Year.MAX_VALUE) {
        LocalGregorianCalendar.Date jdate = JCAL.newCalendarDate(null);
        jdate.setEra(jera.getPrivateEra()).setDate(yearOfEra, 1, 1);
        if (JapaneseChronology.JCAL.validate(jdate)) {
            return gregorianYear;
        }
    }
    throw new DateTimeException("Invalid yearOfEra value");
}
 
Example #9
Source File: JapaneseChronology.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
@Override
public int prolepticYear(Era era, int yearOfEra) {
    if (era instanceof JapaneseEra == false) {
        throw new ClassCastException("Era must be JapaneseEra");
    }

    JapaneseEra jera = (JapaneseEra) era;
    int gregorianYear = jera.getPrivateEra().getSinceDate().getYear() + yearOfEra - 1;
    if (yearOfEra == 1) {
        return gregorianYear;
    }
    if (gregorianYear >= Year.MIN_VALUE && gregorianYear <= Year.MAX_VALUE) {
        LocalGregorianCalendar.Date jdate = JCAL.newCalendarDate(null);
        jdate.setEra(jera.getPrivateEra()).setDate(yearOfEra, 1, 1);
        if (JapaneseChronology.JCAL.validate(jdate)) {
            return gregorianYear;
        }
    }
    throw new DateTimeException("Invalid yearOfEra value");
}
 
Example #10
Source File: JapaneseImperialCalendar.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Returns the fixed date of the first date of the month (usually
 * the 1st of the month) before the specified date.
 *
 * @param date the date for which the first day of the month is
 * calculated. The date must be in the era transition year.
 * @param fixedDate the fixed date representation of the date
 */
private long getFixedDateMonth1(LocalGregorianCalendar.Date date,
                                      long fixedDate) {
    int eraIndex = getTransitionEraIndex(date);
    if (eraIndex != -1) {
        long transition = sinceFixedDates[eraIndex];
        // If the given date is on or after the transition date, then
        // return the transition date.
        if (transition <= fixedDate) {
            return transition;
        }
    }

    // Otherwise, we can use the 1st day of the month.
    return fixedDate - date.getDayOfMonth() + 1;
}
 
Example #11
Source File: JapaneseImperialCalendar.java    From Bytecoder with Apache License 2.0 6 votes vote down vote up
/**
 * Returns the fixed date of the first date of the month (usually
 * the 1st of the month) before the specified date.
 *
 * @param date the date for which the first day of the month is
 * calculated. The date must be in the era transition year.
 * @param fixedDate the fixed date representation of the date
 */
private long getFixedDateMonth1(LocalGregorianCalendar.Date date,
                                      long fixedDate) {
    int eraIndex = getTransitionEraIndex(date);
    if (eraIndex != -1) {
        long transition = sinceFixedDates[eraIndex];
        // If the given date is on or after the transition date, then
        // return the transition date.
        if (transition <= fixedDate) {
            return transition;
        }
    }

    // Otherwise, we can use the 1st day of the month.
    return fixedDate - date.getDayOfMonth() + 1;
}
 
Example #12
Source File: JapaneseImperialCalendar.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Returns the index to the new era if the given date is in a
 * transition month.  For example, if the give date is Heisei 1
 * (1989) January 20, then the era index for Heisei is
 * returned. Likewise, if the given date is Showa 64 (1989)
 * January 3, then the era index for Heisei is returned. If the
 * given date is not in any transition month, then -1 is returned.
 */
private static int getTransitionEraIndex(LocalGregorianCalendar.Date date) {
    int eraIndex = getEraIndex(date);
    CalendarDate transitionDate = eras[eraIndex].getSinceDate();
    if (transitionDate.getYear() == date.getNormalizedYear() &&
        transitionDate.getMonth() == date.getMonth()) {
        return eraIndex;
    }
    if (eraIndex < eras.length - 1) {
        transitionDate = eras[++eraIndex].getSinceDate();
        if (transitionDate.getYear() == date.getNormalizedYear() &&
            transitionDate.getMonth() == date.getMonth()) {
            return eraIndex;
        }
    }
    return -1;
}
 
Example #13
Source File: JapaneseImperialCalendar.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Returns the fixed date of the first date of the month (usually
 * the 1st of the month) before the specified date.
 *
 * @param date the date for which the first day of the month is
 * calculated. The date must be in the era transition year.
 * @param fixedDate the fixed date representation of the date
 */
private long getFixedDateMonth1(LocalGregorianCalendar.Date date,
                                      long fixedDate) {
    int eraIndex = getTransitionEraIndex(date);
    if (eraIndex != -1) {
        long transition = sinceFixedDates[eraIndex];
        // If the given date is on or after the transition date, then
        // return the transition date.
        if (transition <= fixedDate) {
            return transition;
        }
    }

    // Otherwise, we can use the 1st day of the month.
    return fixedDate - date.getDayOfMonth() + 1;
}
 
Example #14
Source File: JapaneseChronology.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
@Override
public int prolepticYear(Era era, int yearOfEra) {
    if (era instanceof JapaneseEra == false) {
        throw new ClassCastException("Era must be JapaneseEra");
    }

    JapaneseEra jera = (JapaneseEra) era;
    int gregorianYear = jera.getPrivateEra().getSinceDate().getYear() + yearOfEra - 1;
    if (yearOfEra == 1) {
        return gregorianYear;
    }
    if (gregorianYear >= Year.MIN_VALUE && gregorianYear <= Year.MAX_VALUE) {
        LocalGregorianCalendar.Date jdate = JCAL.newCalendarDate(null);
        jdate.setEra(jera.getPrivateEra()).setDate(yearOfEra, 1, 1);
        if (JapaneseChronology.JCAL.validate(jdate)) {
            return gregorianYear;
        }
    }
    throw new DateTimeException("Invalid yearOfEra value");
}
 
Example #15
Source File: JapaneseImperialCalendar.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Returns the fixed date of the first date of the month (usually
 * the 1st of the month) before the specified date.
 *
 * @param date the date for which the first day of the month is
 * calculated. The date must be in the era transition year.
 * @param fixedDate the fixed date representation of the date
 */
private long getFixedDateMonth1(LocalGregorianCalendar.Date date,
                                      long fixedDate) {
    int eraIndex = getTransitionEraIndex(date);
    if (eraIndex != -1) {
        long transition = sinceFixedDates[eraIndex];
        // If the given date is on or after the transition date, then
        // return the transition date.
        if (transition <= fixedDate) {
            return transition;
        }
    }

    // Otherwise, we can use the 1st day of the month.
    return fixedDate - date.getDayOfMonth() + 1;
}
 
Example #16
Source File: JapaneseImperialCalendar.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Returns the fixed date of the first date of the month (usually
 * the 1st of the month) before the specified date.
 *
 * @param date the date for which the first day of the month is
 * calculated. The date must be in the era transition year.
 * @param fixedDate the fixed date representation of the date
 */
private long getFixedDateMonth1(LocalGregorianCalendar.Date date,
                                      long fixedDate) {
    int eraIndex = getTransitionEraIndex(date);
    if (eraIndex != -1) {
        long transition = sinceFixedDates[eraIndex];
        // If the given date is on or after the transition date, then
        // return the transition date.
        if (transition <= fixedDate) {
            return transition;
        }
    }

    // Otherwise, we can use the 1st day of the month.
    return fixedDate - date.getDayOfMonth() + 1;
}
 
Example #17
Source File: JapaneseImperialCalendar.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Returns the index to the new era if the given date is in a
 * transition month.  For example, if the give date is Heisei 1
 * (1989) January 20, then the era index for Heisei is
 * returned. Likewise, if the given date is Showa 64 (1989)
 * January 3, then the era index for Heisei is returned. If the
 * given date is not in any transition month, then -1 is returned.
 */
private static int getTransitionEraIndex(LocalGregorianCalendar.Date date) {
    int eraIndex = getEraIndex(date);
    CalendarDate transitionDate = eras[eraIndex].getSinceDate();
    if (transitionDate.getYear() == date.getNormalizedYear() &&
        transitionDate.getMonth() == date.getMonth()) {
        return eraIndex;
    }
    if (eraIndex < eras.length - 1) {
        transitionDate = eras[++eraIndex].getSinceDate();
        if (transitionDate.getYear() == date.getNormalizedYear() &&
            transitionDate.getMonth() == date.getMonth()) {
            return eraIndex;
        }
    }
    return -1;
}
 
Example #18
Source File: JapaneseChronology.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
@Override
public int prolepticYear(Era era, int yearOfEra) {
    if (era instanceof JapaneseEra == false) {
        throw new ClassCastException("Era must be JapaneseEra");
    }

    JapaneseEra jera = (JapaneseEra) era;
    int gregorianYear = jera.getPrivateEra().getSinceDate().getYear() + yearOfEra - 1;
    if (yearOfEra == 1) {
        return gregorianYear;
    }
    if (gregorianYear >= Year.MIN_VALUE && gregorianYear <= Year.MAX_VALUE) {
        LocalGregorianCalendar.Date jdate = JCAL.newCalendarDate(null);
        jdate.setEra(jera.getPrivateEra()).setDate(yearOfEra, 1, 1);
        if (JapaneseChronology.JCAL.validate(jdate)) {
            return gregorianYear;
        }
    }
    throw new DateTimeException("Invalid yearOfEra value");
}
 
Example #19
Source File: JapaneseImperialCalendar.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Returns the fixed date of the first date of the month (usually
 * the 1st of the month) before the specified date.
 *
 * @param date the date for which the first day of the month is
 * calculated. The date must be in the era transition year.
 * @param fixedDate the fixed date representation of the date
 */
private long getFixedDateMonth1(LocalGregorianCalendar.Date date,
                                      long fixedDate) {
    int eraIndex = getTransitionEraIndex(date);
    if (eraIndex != -1) {
        long transition = sinceFixedDates[eraIndex];
        // If the given date is on or after the transition date, then
        // return the transition date.
        if (transition <= fixedDate) {
            return transition;
        }
    }

    // Otherwise, we can use the 1st day of the month.
    return fixedDate - date.getDayOfMonth() + 1;
}
 
Example #20
Source File: JapaneseImperialCalendar.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Returns the index to the new era if the given date is in a
 * transition month.  For example, if the give date is Heisei 1
 * (1989) January 20, then the era index for Heisei is
 * returned. Likewise, if the given date is Showa 64 (1989)
 * January 3, then the era index for Heisei is returned. If the
 * given date is not in any transition month, then -1 is returned.
 */
private static int getTransitionEraIndex(LocalGregorianCalendar.Date date) {
    int eraIndex = getEraIndex(date);
    CalendarDate transitionDate = eras[eraIndex].getSinceDate();
    if (transitionDate.getYear() == date.getNormalizedYear() &&
        transitionDate.getMonth() == date.getMonth()) {
        return eraIndex;
    }
    if (eraIndex < eras.length - 1) {
        transitionDate = eras[++eraIndex].getSinceDate();
        if (transitionDate.getYear() == date.getNormalizedYear() &&
            transitionDate.getMonth() == date.getMonth()) {
            return eraIndex;
        }
    }
    return -1;
}
 
Example #21
Source File: JapaneseImperialCalendar.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Returns the fixed date of the first date of the month (usually
 * the 1st of the month) before the specified date.
 *
 * @param date the date for which the first day of the month is
 * calculated. The date must be in the era transition year.
 * @param fixedDate the fixed date representation of the date
 */
private long getFixedDateMonth1(LocalGregorianCalendar.Date date,
                                      long fixedDate) {
    int eraIndex = getTransitionEraIndex(date);
    if (eraIndex != -1) {
        long transition = sinceFixedDates[eraIndex];
        // If the given date is on or after the transition date, then
        // return the transition date.
        if (transition <= fixedDate) {
            return transition;
        }
    }

    // Otherwise, we can use the 1st day of the month.
    return fixedDate - date.getDayOfMonth() + 1;
}
 
Example #22
Source File: JapaneseImperialCalendar.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
public Object clone() {
    JapaneseImperialCalendar other = (JapaneseImperialCalendar) super.clone();

    other.jdate = (LocalGregorianCalendar.Date) jdate.clone();
    other.originalFields = null;
    other.zoneOffsets = null;
    return other;
}
 
Example #23
Source File: JapaneseImperialCalendar.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
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;
        }
    }
    return 0;
}
 
Example #24
Source File: JapaneseImperialCalendar.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
public Object clone() {
    JapaneseImperialCalendar other = (JapaneseImperialCalendar) super.clone();

    other.jdate = (LocalGregorianCalendar.Date) jdate.clone();
    other.originalFields = null;
    other.zoneOffsets = null;
    return other;
}
 
Example #25
Source File: JapaneseImperialCalendar.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public Object clone() {
    JapaneseImperialCalendar other = (JapaneseImperialCalendar) super.clone();

    other.jdate = (LocalGregorianCalendar.Date) jdate.clone();
    other.originalFields = null;
    other.zoneOffsets = null;
    return other;
}
 
Example #26
Source File: JapaneseDate.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
/**
 * Creates an instance from an ISO date.
 *
 * @param isoDate  the standard local date, validated not null
 */
JapaneseDate(LocalDate isoDate) {
    if (isoDate.isBefore(MEIJI_6_ISODATE)) {
        throw new DateTimeException("JapaneseDate before Meiji 6 is not supported");
    }
    LocalGregorianCalendar.Date jdate = toPrivateJapaneseDate(isoDate);
    this.era = JapaneseEra.toJapaneseEra(jdate.getEra());
    this.yearOfEra = jdate.getYear();
    this.isoDate = isoDate;
}
 
Example #27
Source File: JapaneseDate.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates an instance from an ISO date.
 *
 * @param isoDate  the standard local date, validated not null
 */
JapaneseDate(LocalDate isoDate) {
    if (isoDate.isBefore(MEIJI_6_ISODATE)) {
        throw new DateTimeException("JapaneseDate before Meiji 6 is not supported");
    }
    LocalGregorianCalendar.Date jdate = toPrivateJapaneseDate(isoDate);
    this.era = JapaneseEra.toJapaneseEra(jdate.getEra());
    this.yearOfEra = jdate.getYear();
    this.isoDate = isoDate;
}
 
Example #28
Source File: JapaneseDate.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Returns a {@code LocalGregorianCalendar.Date} converted from the given {@code isoDate}.
 *
 * @param isoDate  the local date, not null
 * @return a {@code LocalGregorianCalendar.Date}, not null
 */
private static LocalGregorianCalendar.Date toPrivateJapaneseDate(LocalDate isoDate) {
    LocalGregorianCalendar.Date jdate = JapaneseChronology.JCAL.newCalendarDate(null);
    sun.util.calendar.Era sunEra = JapaneseEra.privateEraFrom(isoDate);
    int year = isoDate.getYear();
    if (sunEra != null) {
        year -= sunEra.getSinceDate().getYear() - 1;
    }
    jdate.setEra(sunEra).setYear(year).setMonth(isoDate.getMonthValue()).setDayOfMonth(isoDate.getDayOfMonth());
    JapaneseChronology.JCAL.normalize(jdate);
    return jdate;
}
 
Example #29
Source File: JapaneseImperialCalendar.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
public Object clone() {
    JapaneseImperialCalendar other = (JapaneseImperialCalendar) super.clone();

    other.jdate = (LocalGregorianCalendar.Date) jdate.clone();
    other.originalFields = null;
    other.zoneOffsets = null;
    return other;
}
 
Example #30
Source File: JapaneseDate.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates an instance from an ISO date.
 *
 * @param isoDate  the standard local date, validated not null
 */
JapaneseDate(LocalDate isoDate) {
    if (isoDate.isBefore(MEIJI_6_ISODATE)) {
        throw new DateTimeException("JapaneseDate before Meiji 6 is not supported");
    }
    LocalGregorianCalendar.Date jdate = toPrivateJapaneseDate(isoDate);
    this.era = JapaneseEra.toJapaneseEra(jdate.getEra());
    this.yearOfEra = jdate.getYear();
    this.isoDate = isoDate;
}