480 292278994, // YEAR
481 DECEMBER, // MONTH
482 53, // WEEK_OF_YEAR
483 6, // WEEK_OF_MONTH
484 31, // DAY_OF_MONTH
485 366, // DAY_OF_YEAR
486 SATURDAY, // DAY_OF_WEEK
487 6, // DAY_OF_WEEK_IN
488 PM, // AM_PM
489 11, // HOUR
490 23, // HOUR_OF_DAY
491 59, // MINUTE
492 59, // SECOND
493 999, // MILLISECOND
494 14*ONE_HOUR, // ZONE_OFFSET
495 2*ONE_HOUR // DST_OFFSET (double summer time)
496 };
497
498 // Proclaim serialization compatibility with JDK 1.1
499 @SuppressWarnings("FieldNameHidesFieldInSuperclass")
500 static final long serialVersionUID = -8125100834729963327L;
501
502 // Reference to the sun.util.calendar.Gregorian instance (singleton).
503 private static final Gregorian gcal =
504 CalendarSystem.getGregorianCalendar();
505
506 // Reference to the JulianCalendar instance (singleton), set as needed. See
507 // getJulianCalendarSystem().
508 private static JulianCalendar jcal;
509
510 // JulianCalendar eras. See getJulianCalendarSystem().
511 private static Era[] jeras;
512
513 // The default value of gregorianCutover.
514 static final long DEFAULT_GREGORIAN_CUTOVER = -12219292800000L;
515
516 /////////////////////
517 // Instance Variables
518 /////////////////////
519
3212 if (n > max) {
3213 n -= range;
3214 } else if (n < min) {
3215 n += range;
3216 }
3217 assert n >= min && n <= max;
3218 return n;
3219 }
3220
3221 /**
3222 * Returns the ERA. We need a special method for this because the
3223 * default ERA is CE, but a zero (unset) ERA is BCE.
3224 */
3225 private int internalGetEra() {
3226 return isSet(ERA) ? internalGet(ERA) : CE;
3227 }
3228
3229 /**
3230 * Updates internal state.
3231 */
3232 private void readObject(ObjectInputStream stream)
3233 throws IOException, ClassNotFoundException {
3234 stream.defaultReadObject();
3235 if (gdate == null) {
3236 gdate = (BaseCalendar.Date) gcal.newCalendarDate(getZone());
3237 cachedFixedDate = Long.MIN_VALUE;
3238 }
3239 setGregorianChange(gregorianCutover);
3240 }
3241
3242 /**
3243 * Converts this object to a {@code ZonedDateTime} that represents
3244 * the same point on the time-line as this {@code GregorianCalendar}.
3245 * <p>
3246 * Since this object supports a Julian-Gregorian cutover date and
3247 * {@code ZonedDateTime} does not, it is possible that the resulting year,
3248 * month and day will have different values. The result will represent the
3249 * correct date in the ISO calendar system, which will also be the same value
3250 * for Modified Julian Days.
3251 *
|
480 292278994, // YEAR
481 DECEMBER, // MONTH
482 53, // WEEK_OF_YEAR
483 6, // WEEK_OF_MONTH
484 31, // DAY_OF_MONTH
485 366, // DAY_OF_YEAR
486 SATURDAY, // DAY_OF_WEEK
487 6, // DAY_OF_WEEK_IN
488 PM, // AM_PM
489 11, // HOUR
490 23, // HOUR_OF_DAY
491 59, // MINUTE
492 59, // SECOND
493 999, // MILLISECOND
494 14*ONE_HOUR, // ZONE_OFFSET
495 2*ONE_HOUR // DST_OFFSET (double summer time)
496 };
497
498 // Proclaim serialization compatibility with JDK 1.1
499 @SuppressWarnings("FieldNameHidesFieldInSuperclass")
500 @java.io.Serial
501 static final long serialVersionUID = -8125100834729963327L;
502
503 // Reference to the sun.util.calendar.Gregorian instance (singleton).
504 private static final Gregorian gcal =
505 CalendarSystem.getGregorianCalendar();
506
507 // Reference to the JulianCalendar instance (singleton), set as needed. See
508 // getJulianCalendarSystem().
509 private static JulianCalendar jcal;
510
511 // JulianCalendar eras. See getJulianCalendarSystem().
512 private static Era[] jeras;
513
514 // The default value of gregorianCutover.
515 static final long DEFAULT_GREGORIAN_CUTOVER = -12219292800000L;
516
517 /////////////////////
518 // Instance Variables
519 /////////////////////
520
3213 if (n > max) {
3214 n -= range;
3215 } else if (n < min) {
3216 n += range;
3217 }
3218 assert n >= min && n <= max;
3219 return n;
3220 }
3221
3222 /**
3223 * Returns the ERA. We need a special method for this because the
3224 * default ERA is CE, but a zero (unset) ERA is BCE.
3225 */
3226 private int internalGetEra() {
3227 return isSet(ERA) ? internalGet(ERA) : CE;
3228 }
3229
3230 /**
3231 * Updates internal state.
3232 */
3233 @java.io.Serial
3234 private void readObject(ObjectInputStream stream)
3235 throws IOException, ClassNotFoundException {
3236 stream.defaultReadObject();
3237 if (gdate == null) {
3238 gdate = (BaseCalendar.Date) gcal.newCalendarDate(getZone());
3239 cachedFixedDate = Long.MIN_VALUE;
3240 }
3241 setGregorianChange(gregorianCutover);
3242 }
3243
3244 /**
3245 * Converts this object to a {@code ZonedDateTime} that represents
3246 * the same point on the time-line as this {@code GregorianCalendar}.
3247 * <p>
3248 * Since this object supports a Julian-Gregorian cutover date and
3249 * {@code ZonedDateTime} does not, it is possible that the resulting year,
3250 * month and day will have different values. The result will represent the
3251 * correct date in the ISO calendar system, which will also be the same value
3252 * for Modified Julian Days.
3253 *
|