1 Clazz.declarePackage ("java.util");
2 Clazz.load (["java.util.Calendar", "jssun.util.calendar.CalendarSystem", "$.Gregorian"], "java.util.GregorianCalendar", ["java.lang.ArrayIndexOutOfBoundsException", "$.IllegalArgumentException", "java.util.Date", "java.util.Locale", "$.TimeZone", "jssun.util.calendar.AbstractCalendar", "$.CalendarUtils", "$.ZoneInfo"], function () {
3 c$ = Clazz.decorateAsClass (function () {
4 this.gregorianCutover = -12219292800000;
5 this.gregorianCutoverDate = 577736;
6 this.gregorianCutoverYear = 1582;
7 this.gregorianCutoverYearJulian = 1582;
11 this.zoneOffsets = null;
12 this.originalFields = null;
13 this.cachedFixedDate = -9223372036854775808;
14 Clazz.instantialize (this, arguments);
15 }, java.util, "GregorianCalendar", java.util.Calendar);
16 Clazz.makeConstructor (c$,
18 this.construct (java.util.TimeZone.getDefaultRef (), java.util.Locale.getDefault ());
19 this.setZoneShared (true);
21 Clazz.makeConstructor (c$,
23 this.construct (zone, java.util.Locale.getDefault ());
24 }, "java.util.TimeZone");
25 Clazz.makeConstructor (c$,
27 this.construct (java.util.TimeZone.getDefaultRef (), aLocale);
28 this.setZoneShared (true);
29 }, "java.util.Locale");
30 Clazz.makeConstructor (c$,
31 function (zone, aLocale) {
32 Clazz.superConstructor (this, java.util.GregorianCalendar, [zone, aLocale]);
33 this.gdate = java.util.GregorianCalendar.gcal.newCalendarDate (zone);
34 this.setTimeInMillis (System.currentTimeMillis ());
35 }, "java.util.TimeZone,java.util.Locale");
36 Clazz.makeConstructor (c$,
37 function (year, month, dayOfMonth) {
38 this.construct (year, month, dayOfMonth, 0, 0, 0, 0);
40 Clazz.makeConstructor (c$,
41 function (year, month, dayOfMonth, hourOfDay, minute) {
42 this.construct (year, month, dayOfMonth, hourOfDay, minute, 0, 0);
44 Clazz.makeConstructor (c$,
45 function (year, month, dayOfMonth, hourOfDay, minute, second) {
46 this.construct (year, month, dayOfMonth, hourOfDay, minute, second, 0);
47 }, "~N,~N,~N,~N,~N,~N");
48 Clazz.makeConstructor (c$,
49 function (year, month, dayOfMonth, hourOfDay, minute, second, millis) {
50 Clazz.superConstructor (this, java.util.GregorianCalendar);
51 this.gdate = java.util.GregorianCalendar.gcal.newCalendarDate (this.getZone ());
54 this.set (5, dayOfMonth);
55 if (hourOfDay >= 12 && hourOfDay <= 23) {
56 this.internalSet (9, 1);
57 this.internalSet (10, hourOfDay - 12);
59 this.internalSet (10, hourOfDay);
60 }this.setFieldsComputed (1536);
61 this.set (11, hourOfDay);
62 this.set (12, minute);
63 this.set (13, second);
64 this.internalSet (14, millis);
65 }, "~N,~N,~N,~N,~N,~N,~N");
66 Clazz.defineMethod (c$, "getGregorianChange",
68 return new java.util.Date (this.gregorianCutover);
70 Clazz.defineMethod (c$, "isLeapYear",
72 if ((year & 3) != 0) {
74 }if (year > this.gregorianCutoverYear) {
75 return (year % 100 != 0) || (year % 400 == 0);
76 }if (year < this.gregorianCutoverYearJulian) {
79 if (this.gregorianCutoverYear == this.gregorianCutoverYearJulian) {
80 var d = this.getCalendarDate (this.gregorianCutoverDate);
81 gregorian = d.getMonth () < 3;
83 gregorian = year == this.gregorianCutoverYear;
84 }return gregorian ? (year % 100 != 0) || (year % 400 == 0) : true;
86 Clazz.defineMethod (c$, "equals",
88 return Clazz.instanceOf (obj, java.util.GregorianCalendar) && Clazz.superCall (this, java.util.GregorianCalendar, "equals", [obj]) && this.gregorianCutover == (obj).gregorianCutover;
90 Clazz.defineMethod (c$, "hashCode",
92 return Clazz.superCall (this, java.util.GregorianCalendar, "hashCode", []) ^ this.gregorianCutoverDate;
94 Clazz.overrideMethod (c$, "add",
95 function (field, amount) {
98 }if (field < 0 || field >= 15) {
99 throw new IllegalArgumentException ();
102 var year = this.internalGet (1);
103 if (this.internalGetEra () == 1) {
108 this.set (1, 1 - year);
115 this.set (1, 1 - year);
117 }}this.pinDayOfMonth ();
118 } else if (field == 2) {
119 var month = this.internalGet (2) + amount;
120 var year = this.internalGet (1);
123 y_amount = Clazz.doubleToInt (month / 12);
125 y_amount = Clazz.doubleToInt ((month + 1) / 12) - 1;
126 }if (y_amount != 0) {
127 if (this.internalGetEra () == 1) {
132 this.set (1, 1 - year);
139 this.set (1, 1 - year);
142 this.set (2, (month % 12));
147 }this.set (2, 0 + month);
148 }this.pinDayOfMonth ();
149 } else if (field == 0) {
150 var era = this.internalGet (0) + amount;
182 delta = Clazz.doubleToInt (amount / 2);
183 timeOfDay = 12 * (amount % 2);
187 this.setTimeInMillis (this.time + delta);
189 }var fd = this.getCurrentFixedDate ();
190 timeOfDay += this.internalGet (11);
192 timeOfDay += this.internalGet (12);
194 timeOfDay += this.internalGet (13);
196 timeOfDay += this.internalGet (14);
197 if (timeOfDay >= 86400000) {
199 timeOfDay -= 86400000;
200 } else if (timeOfDay < 0) {
202 timeOfDay += 86400000;
204 var zoneOffset = this.internalGet (15) + this.internalGet (16);
205 this.setTimeInMillis ((fd - 719163) * 86400000 + timeOfDay - zoneOffset);
206 zoneOffset -= this.internalGet (15) + this.internalGet (16);
207 if (zoneOffset != 0) {
208 this.setTimeInMillis (this.time + zoneOffset);
209 var fd2 = this.getCurrentFixedDate ();
211 this.setTimeInMillis (this.time - zoneOffset);
213 Clazz.defineMethod (c$, "roll",
214 function (field, up) {
215 this.roll (field, up ? 1 : -1);
217 Clazz.defineMethod (c$, "roll",
218 function (field, amount) {
221 }if (field < 0 || field >= 15) {
222 throw new IllegalArgumentException ();
224 var min = this.getMinimum (field);
225 var max = this.getMaximum (field);
238 var h = this.internalGet (field);
239 var nh = (h + amount) % unit;
242 }this.time += 3600000 * (nh - h);
243 var d = this.calsys.getCalendarDate (this.time, this.getZone ());
244 if (this.internalGet (5) != d.getDayOfMonth ()) {
245 d.setDate (this.internalGet (1), this.internalGet (2) + 1, this.internalGet (5));
248 }this.time = this.calsys.getTime (d);
249 }var hourOfDay = d.getHours ();
250 this.internalSet (field, hourOfDay % unit);
252 this.internalSet (11, hourOfDay);
254 this.internalSet (9, Clazz.doubleToInt (hourOfDay / 12));
255 this.internalSet (10, hourOfDay % 12);
256 }var zoneOffset = d.getZoneOffset ();
257 var saving = d.getDaylightSaving ();
258 this.internalSet (15, zoneOffset - saving);
259 this.internalSet (16, saving);
263 var mon = (this.internalGet (2) + amount) % 12;
267 var monthLen = this.monthLength (mon);
268 if (this.internalGet (5) > monthLen) {
269 this.set (5, monthLen);
273 var y = this.cdate.getNormalizedYear ();
274 max = this.getActualMaximum (3);
275 this.set (7, this.internalGet (7));
276 var woy = this.internalGet (3);
277 var value = woy + amount;
278 if (value > min && value < max) {
281 }var fd = this.getCurrentFixedDate ();
282 var day1 = fd - (7 * (woy - min));
283 if (this.calsys.getYearFromFixedDate (day1) != y) {
285 }fd += 7 * (max - this.internalGet (3));
286 if (this.calsys.getYearFromFixedDate (fd) != y) {
291 var dow = this.internalGet (7) - this.getFirstDayOfWeek ();
294 }var fd = this.getCurrentFixedDate ();
297 month1 = fd - this.internalGet (5) + 1;
298 monthLength = this.calsys.getMonthLength (this.cdate);
299 var monthDay1st = jssun.util.calendar.AbstractCalendar.getDayOfWeekDateOnOrBefore (month1 + 6, this.getFirstDayOfWeek ());
300 if ((monthDay1st - month1) >= this.getMinimalDaysInFirstWeek ()) {
302 }max = this.getActualMaximum (field);
303 var value = java.util.GregorianCalendar.getRolledValue (this.internalGet (field), amount, 1, max) - 1;
304 var nfd = monthDay1st + value * 7 + dow;
307 } else if (nfd >= (month1 + monthLength)) {
308 nfd = month1 + monthLength - 1;
310 dayOfMonth = (nfd - month1) + 1;
311 this.set (5, dayOfMonth);
315 max = this.calsys.getMonthLength (this.cdate);
319 max = this.getActualMaximum (field);
323 var weekOfYear = this.internalGet (3);
324 this.set (3, weekOfYear);
330 var dom = this.internalGet (5);
331 var monthLength = this.calsys.getMonthLength (this.cdate);
332 var lastDays = monthLength % 7;
333 max = Clazz.doubleToInt (monthLength / 7);
334 var x = (dom - 1) % 7;
337 }this.set (7, this.internalGet (7));
340 this.set (field, java.util.GregorianCalendar.getRolledValue (this.internalGet (field), amount, min, max));
342 Clazz.overrideMethod (c$, "getMinimum",
344 return java.util.GregorianCalendar.MIN_VALUES[field];
346 Clazz.overrideMethod (c$, "getMaximum",
357 if (this.gregorianCutoverYear > 200) {
359 }var gc = this.clone ();
360 gc.setLenient (true);
361 gc.setTimeInMillis (this.gregorianCutover);
362 var v1 = gc.getActualMaximum (field);
363 gc.setTimeInMillis (this.gregorianCutover - 1);
364 var v2 = gc.getActualMaximum (field);
365 return Math.max (java.util.GregorianCalendar.MAX_VALUES[field], Math.max (v1, v2));
367 return java.util.GregorianCalendar.MAX_VALUES[field];
369 Clazz.overrideMethod (c$, "getGreatestMinimum",
371 return java.util.GregorianCalendar.MIN_VALUES[field];
373 Clazz.overrideMethod (c$, "getLeastMaximum",
384 var gc = this.clone ();
385 gc.setLenient (true);
386 gc.setTimeInMillis (this.gregorianCutover);
387 var v1 = gc.getActualMaximum (field);
388 gc.setTimeInMillis (this.gregorianCutover - 1);
389 var v2 = gc.getActualMaximum (field);
390 return Math.min (java.util.GregorianCalendar.LEAST_MAX_VALUES[field], Math.min (v1, v2));
392 return java.util.GregorianCalendar.LEAST_MAX_VALUES[field];
394 Clazz.overrideMethod (c$, "getActualMinimum",
397 }return this.getMinimum (field);
399 Clazz.overrideMethod (c$, "getActualMaximum",
401 var fieldsForFixedMax = 130689;
402 if ((130689 & (1 << field)) != 0) {
403 return this.getMaximum (field);
404 }var gc = this.getNormalizedCalendar ();
415 value = cal.getMonthLength (date);
418 value = cal.getYearLength (date);
422 dd = cal.newCalendarDate (java.util.TimeZone.NO_TIMEZONE);
423 dd.setDate (date.getYear (), 1, 1);
424 var dayOfWeek = cal.getDayOfWeek (dd);
425 dayOfWeek -= this.getFirstDayOfWeek ();
429 var magic = dayOfWeek + this.getMinimalDaysInFirstWeek () - 1;
430 if ((magic == 6) || (date.isLeapYear () && (magic == 5 || magic == 12))) {
434 dd = cal.newCalendarDate (null);
435 dd.setDate (date.getYear (), date.getMonth (), 1);
436 var dayOfWeek = cal.getDayOfWeek (dd);
437 var monthLength = cal.getMonthLength (dd);
438 dayOfWeek -= this.getFirstDayOfWeek ();
441 }var nDaysFirstWeek = 7 - dayOfWeek;
443 if (nDaysFirstWeek >= this.getMinimalDaysInFirstWeek ()) {
445 }monthLength -= nDaysFirstWeek + 21;
446 if (monthLength > 0) {
448 if (monthLength > 7) {
455 var dow = date.getDayOfWeek ();
457 ndays = cal.getMonthLength (d);
460 dow1 = d.getDayOfWeek ();
465 value = Clazz.doubleToInt ((ndays + 6) / 7);
471 }var current = gc.getYearOffsetInMillis ();
472 if (gc.internalGetEra () == 1) {
473 gc.setTimeInMillis (9223372036854775807);
475 var maxEnd = gc.getYearOffsetInMillis ();
476 if (current > maxEnd) {
479 var mincal = java.util.GregorianCalendar.gcal;
480 dd = mincal.getCalendarDate (-9223372036854775808, this.getZone ());
481 var maxEnd = (cal.getDayOfYear (dd) - 1) * 24 + dd.getHours ();
483 maxEnd += dd.getMinutes ();
485 maxEnd += dd.getSeconds ();
487 maxEnd += dd.getMillis ();
488 value = dd.getYear ();
491 }if (current < maxEnd) {
495 throw new ArrayIndexOutOfBoundsException (field);
499 Clazz.defineMethod (c$, "getYearOffsetInMillis",
501 var t = (this.internalGet (6) - 1) * 24;
502 t += this.internalGet (11);
504 t += this.internalGet (12);
506 t += this.internalGet (13);
508 return t + this.internalGet (14) - (this.internalGet (15) + this.internalGet (16));
510 Clazz.defineMethod (c$, "clone",
512 var other = Clazz.superCall (this, java.util.GregorianCalendar, "clone", []);
513 other.gdate = this.gdate.clone ();
514 if (this.cdate != null) {
515 if (this.cdate !== this.gdate) {
516 other.cdate = this.cdate.clone ();
518 other.cdate = other.gdate;
519 }}other.originalFields = null;
520 other.zoneOffsets = null;
523 Clazz.defineMethod (c$, "getTimeZone",
525 var zone = Clazz.superCall (this, java.util.GregorianCalendar, "getTimeZone", []);
526 this.gdate.setZone (zone);
527 if (this.cdate != null && this.cdate !== this.gdate) {
528 this.cdate.setZone (zone);
531 Clazz.defineMethod (c$, "setTimeZone",
533 Clazz.superCall (this, java.util.GregorianCalendar, "setTimeZone", [zone]);
534 this.gdate.setZone (zone);
535 if (this.cdate != null && this.cdate !== this.gdate) {
536 this.cdate.setZone (zone);
537 }}, "java.util.TimeZone");
538 Clazz.defineMethod (c$, "computeFields",
541 if (this.isPartiallyNormalized ()) {
542 mask = this.getSetStateFields ();
543 var fieldMask = ~mask & 131071;
544 if (fieldMask != 0 || this.calsys == null) {
545 mask |= this.computeFields (fieldMask, mask & (98304));
548 this.computeFields (mask, 0);
549 }this.setFieldsComputed (mask);
551 Clazz.defineMethod (c$, "computeFields",
552 function (fieldMask, tzMask) {
554 var tz = this.getZone ();
555 if (this.zoneOffsets == null) {
556 this.zoneOffsets = Clazz.newIntArray (2, 0);
557 }if (tzMask != (98304)) {
558 if (Clazz.instanceOf (tz, jssun.util.calendar.ZoneInfo)) {
559 zoneOffset = (tz).getOffsets (this.time, this.zoneOffsets);
561 zoneOffset = tz.getOffset (this.time);
562 this.zoneOffsets[0] = tz.getRawOffset ();
563 this.zoneOffsets[1] = zoneOffset - this.zoneOffsets[0];
565 if (java.util.Calendar.isFieldSet (tzMask, 15)) {
566 this.zoneOffsets[0] = this.internalGet (15);
567 }if (java.util.Calendar.isFieldSet (tzMask, 16)) {
568 this.zoneOffsets[1] = this.internalGet (16);
569 }zoneOffset = this.zoneOffsets[0] + this.zoneOffsets[1];
570 }var fixedDate = Clazz.doubleToInt (zoneOffset / 86400000);
571 var timeOfDay = zoneOffset % 86400000;
572 fixedDate += Clazz.doubleToInt (this.time / 86400000);
573 timeOfDay += (this.time % 86400000);
574 if (timeOfDay >= 86400000) {
575 timeOfDay -= 86400000;
578 while (timeOfDay < 0) {
579 timeOfDay += 86400000;
582 }fixedDate += 719163;
585 if (fixedDate != this.cachedFixedDate) {
586 java.util.GregorianCalendar.gcal.getCalendarDateFromFixedDate (this.gdate, fixedDate);
587 this.cachedFixedDate = fixedDate;
588 }year = this.gdate.getYear ();
592 }this.calsys = java.util.GregorianCalendar.gcal;
593 this.cdate = this.gdate;
594 this.internalSet (0, era);
595 this.internalSet (1, year);
596 var mask = fieldMask | (3);
597 var month = this.cdate.getMonth () - 1;
598 var dayOfMonth = this.cdate.getDayOfMonth ();
599 if ((fieldMask & (164)) != 0) {
600 this.internalSet (2, month);
601 this.internalSet (5, dayOfMonth);
602 this.internalSet (7, this.cdate.getDayOfWeek ());
604 }if ((fieldMask & (32256)) != 0) {
605 if (timeOfDay != 0) {
606 var hours = Clazz.doubleToInt (timeOfDay / 3600000);
607 this.internalSet (11, hours);
608 this.internalSet (9, Clazz.doubleToInt (hours / 12));
609 this.internalSet (10, hours % 12);
610 var r = timeOfDay % 3600000;
611 this.internalSet (12, Clazz.doubleToInt (r / 60000));
613 this.internalSet (13, Clazz.doubleToInt (r / 1000));
614 this.internalSet (14, r % 1000);
616 this.internalSet (11, 0);
617 this.internalSet (9, 0);
618 this.internalSet (10, 0);
619 this.internalSet (12, 0);
620 this.internalSet (13, 0);
621 this.internalSet (14, 0);
623 }if ((fieldMask & (98304)) != 0) {
624 this.internalSet (15, this.zoneOffsets[0]);
625 this.internalSet (16, this.zoneOffsets[1]);
627 }if ((fieldMask & (344)) != 0) {
628 var normalizedYear = this.cdate.getNormalizedYear ();
629 var fixedDateJan1 = this.calsys.getFixedDate (normalizedYear, 1, 1, this.cdate);
630 var dayOfYear = (fixedDate - fixedDateJan1) + 1;
631 var fixedDateMonth1 = fixedDate - dayOfMonth + 1;
632 var cutoverYear = (this.calsys === java.util.GregorianCalendar.gcal) ? this.gregorianCutoverYear : this.gregorianCutoverYearJulian;
633 var relativeDayOfMonth = dayOfMonth - 1;
634 if (normalizedYear == cutoverYear) {
635 var realDayOfYear = (fixedDate - fixedDateJan1) + 1;
636 dayOfYear = realDayOfYear;
637 relativeDayOfMonth = (fixedDate - fixedDateMonth1);
638 }this.internalSet (6, dayOfYear);
639 this.internalSet (8, Clazz.doubleToInt (relativeDayOfMonth / 7) + 1);
640 var weekOfYear = this.getWeekNumber (fixedDateJan1, fixedDate);
641 if (weekOfYear == 0) {
642 var fixedDec31 = fixedDateJan1 - 1;
644 prevJan1 = fixedDateJan1 - 365;
645 if (jssun.util.calendar.CalendarUtils.isGregorianLeapYear (normalizedYear - 1)) {
647 }weekOfYear = this.getWeekNumber (prevJan1, fixedDec31);
649 if (normalizedYear > this.gregorianCutoverYear || normalizedYear < (this.gregorianCutoverYearJulian - 1)) {
650 if (weekOfYear >= 52) {
651 var nextJan1 = fixedDateJan1 + 365;
652 if (this.cdate.isLeapYear ()) {
654 }var nextJan1st = jssun.util.calendar.AbstractCalendar.getDayOfWeekDateOnOrBefore (nextJan1 + 6, this.getFirstDayOfWeek ());
655 var ndays = (nextJan1st - nextJan1);
656 if (ndays >= this.getMinimalDaysInFirstWeek () && fixedDate >= (nextJan1st - 7)) {
659 var calForJan1 = this.calsys;
660 var nextYear = normalizedYear + 1;
661 var nextJan1 = calForJan1.getFixedDate (nextYear, 1, 1, null);
662 if (nextJan1 < fixedDate) {
663 nextJan1 = this.gregorianCutoverDate;
664 calForJan1 = java.util.GregorianCalendar.gcal;
665 }var nextJan1st = jssun.util.calendar.AbstractCalendar.getDayOfWeekDateOnOrBefore (nextJan1 + 6, this.getFirstDayOfWeek ());
666 var ndays = (nextJan1st - nextJan1);
667 if (ndays >= this.getMinimalDaysInFirstWeek () && fixedDate >= (nextJan1st - 7)) {
669 }}}this.internalSet (3, weekOfYear);
670 this.internalSet (4, this.getWeekNumber (fixedDateMonth1, fixedDate));
674 Clazz.defineMethod (c$, "getWeekNumber",
675 function (fixedDay1, fixedDate) {
676 var fixedDay1st = jssun.util.calendar.AbstractCalendar.getDayOfWeekDateOnOrBefore (fixedDay1 + 6, this.getFirstDayOfWeek ());
677 var ndays = (fixedDay1st - fixedDay1);
678 if (ndays >= this.getMinimalDaysInFirstWeek ()) {
680 }var normalizedDayOfPeriod = (fixedDate - fixedDay1st);
681 if (normalizedDayOfPeriod >= 0) {
682 return Clazz.doubleToInt (normalizedDayOfPeriod / 7) + 1;
683 }return jssun.util.calendar.CalendarUtils.floorDivide (normalizedDayOfPeriod, 7) + 1;
685 Clazz.overrideMethod (c$, "computeTime",
687 if (!this.isLenient ()) {
688 if (this.originalFields == null) {
689 this.originalFields = Clazz.newIntArray (17, 0);
690 }for (var field = 0; field < 17; field++) {
691 var value = this.internalGet (field);
692 if (this.isExternallySet (field)) {
693 if (value < this.getMinimum (field) || value > this.getMaximum (field)) {
694 throw new IllegalArgumentException (java.util.Calendar.getFieldName (field));
695 }}this.originalFields[field] = value;
697 }var fieldMask = this.selectFields ();
698 var year = this.isSet (1) ? this.internalGet (1) : 1970;
699 var era = this.internalGetEra ();
702 } else if (era != 1) {
703 throw new IllegalArgumentException ("Invalid era");
704 }if (year <= 0 && !this.isSet (0)) {
706 this.setFieldsComputed (1);
708 if (java.util.Calendar.isFieldSet (fieldMask, 11)) {
709 timeOfDay += this.internalGet (11);
711 timeOfDay += this.internalGet (10);
712 if (java.util.Calendar.isFieldSet (fieldMask, 9)) {
713 timeOfDay += 12 * this.internalGet (9);
715 timeOfDay += this.internalGet (12);
717 timeOfDay += this.internalGet (13);
719 timeOfDay += this.internalGet (14);
720 var fixedDate = Clazz.doubleToInt (timeOfDay / 86400000);
721 timeOfDay %= 86400000;
722 while (timeOfDay < 0) {
723 timeOfDay += 86400000;
726 calculateFixedDate : {
728 gfd = fixedDate + this.getFixedDate (java.util.GregorianCalendar.gcal, year, fieldMask);
730 break calculateFixedDate;
731 }var millis = (fixedDate - 719163) * 86400000 + timeOfDay;
732 var zone = this.getZone ();
733 if (this.zoneOffsets == null) {
734 this.zoneOffsets = Clazz.newIntArray (2, 0);
735 }var tzMask = fieldMask & (98304);
736 if (tzMask != (98304)) {
737 if (Clazz.instanceOf (zone, jssun.util.calendar.ZoneInfo)) {
738 (zone).getOffsetsByWall (millis, this.zoneOffsets);
740 var gmtOffset = java.util.Calendar.isFieldSet (fieldMask, 15) ? this.internalGet (15) : zone.getRawOffset ();
741 zone.getOffsets (millis - gmtOffset, this.zoneOffsets);
743 if (java.util.Calendar.isFieldSet (tzMask, 15)) {
744 this.zoneOffsets[0] = this.internalGet (15);
745 }if (java.util.Calendar.isFieldSet (tzMask, 16)) {
746 this.zoneOffsets[1] = this.internalGet (16);
747 }}millis -= this.zoneOffsets[0] + this.zoneOffsets[1];
749 var mask = this.computeFields (fieldMask | this.getSetStateFields (), tzMask);
750 if (!this.isLenient ()) {
751 for (var field = 0; field < 17; field++) {
752 if (!this.isExternallySet (field)) {
754 }if (this.originalFields[field] != this.internalGet (field)) {
755 System.arraycopy (this.originalFields, 0, this.fields, 0, this.fields.length);
756 throw new IllegalArgumentException (java.util.Calendar.getFieldName (field));
758 }this.setFieldsNormalized (mask);
760 Clazz.defineMethod (c$, "getFixedDate",
761 function (cal, year, fieldMask) {
763 if (java.util.Calendar.isFieldSet (fieldMask, 2)) {
764 month = this.internalGet (2);
766 year += Clazz.doubleToInt (month / 12);
768 } else if (month < 0) {
769 var rem = Clazz.newIntArray (1, 0);
770 year += jssun.util.calendar.CalendarUtils.floorDivide (month, 12, rem);
772 }}var fixedDate = cal.getFixedDate (year, month + 1, 1, cal === java.util.GregorianCalendar.gcal ? this.gdate : null);
773 if (java.util.Calendar.isFieldSet (fieldMask, 2)) {
774 if (java.util.Calendar.isFieldSet (fieldMask, 5)) {
775 if (this.isSet (5)) {
776 fixedDate += this.internalGet (5);
779 if (java.util.Calendar.isFieldSet (fieldMask, 4)) {
780 var firstDayOfWeek = jssun.util.calendar.AbstractCalendar.getDayOfWeekDateOnOrBefore (fixedDate + 6, this.getFirstDayOfWeek ());
781 if ((firstDayOfWeek - fixedDate) >= this.getMinimalDaysInFirstWeek ()) {
783 }if (java.util.Calendar.isFieldSet (fieldMask, 7)) {
784 firstDayOfWeek = jssun.util.calendar.AbstractCalendar.getDayOfWeekDateOnOrBefore (firstDayOfWeek + 6, this.internalGet (7));
785 }fixedDate = firstDayOfWeek + 7 * (this.internalGet (4) - 1);
788 if (java.util.Calendar.isFieldSet (fieldMask, 7)) {
789 dayOfWeek = this.internalGet (7);
791 dayOfWeek = this.getFirstDayOfWeek ();
793 if (java.util.Calendar.isFieldSet (fieldMask, 8)) {
794 dowim = this.internalGet (8);
798 fixedDate = jssun.util.calendar.AbstractCalendar.getDayOfWeekDateOnOrBefore (fixedDate + (7 * dowim) - 1, dayOfWeek);
800 var lastDate = this.monthLength (month, year) + (7 * (dowim + 1));
801 fixedDate = jssun.util.calendar.AbstractCalendar.getDayOfWeekDateOnOrBefore (fixedDate + lastDate - 1, dayOfWeek);
803 if (year == this.gregorianCutoverYear && cal === java.util.GregorianCalendar.gcal && fixedDate < this.gregorianCutoverDate && this.gregorianCutoverYear != this.gregorianCutoverYearJulian) {
804 fixedDate = this.gregorianCutoverDate;
805 }if (java.util.Calendar.isFieldSet (fieldMask, 6)) {
806 fixedDate += this.internalGet (6);
809 var firstDayOfWeek = jssun.util.calendar.AbstractCalendar.getDayOfWeekDateOnOrBefore (fixedDate + 6, this.getFirstDayOfWeek ());
810 if ((firstDayOfWeek - fixedDate) >= this.getMinimalDaysInFirstWeek ()) {
812 }if (java.util.Calendar.isFieldSet (fieldMask, 7)) {
813 var dayOfWeek = this.internalGet (7);
814 if (dayOfWeek != this.getFirstDayOfWeek ()) {
815 firstDayOfWeek = jssun.util.calendar.AbstractCalendar.getDayOfWeekDateOnOrBefore (firstDayOfWeek + 6, dayOfWeek);
816 }}fixedDate = firstDayOfWeek + 7 * (this.internalGet (3) - 1);
818 }, "jssun.util.calendar.BaseCalendar,~N,~N");
819 Clazz.defineMethod (c$, "getNormalizedCalendar",
822 if (this.isFullyNormalized ()) {
826 gc.setLenient (true);
830 Clazz.defineMethod (c$, "getCalendarDate",
832 var cal = java.util.GregorianCalendar.gcal;
833 var d = cal.newCalendarDate (java.util.TimeZone.NO_TIMEZONE);
834 cal.getCalendarDateFromFixedDate (d, fd);
837 Clazz.defineMethod (c$, "monthLength",
838 function (month, year) {
839 return this.isLeapYear (year) ? java.util.GregorianCalendar.LEAP_MONTH_LENGTH[month] : java.util.GregorianCalendar.MONTH_LENGTH[month];
841 Clazz.defineMethod (c$, "monthLength",
843 var year = this.internalGet (1);
844 if (this.internalGetEra () == 0) {
846 }return this.monthLength (month, year);
848 Clazz.defineMethod (c$, "pinDayOfMonth",
850 var year = this.internalGet (1);
852 if (year > this.gregorianCutoverYear || year < this.gregorianCutoverYearJulian) {
853 monthLen = this.monthLength (this.internalGet (2));
855 var gc = this.getNormalizedCalendar ();
856 monthLen = gc.getActualMaximum (5);
857 }var dom = this.internalGet (5);
858 if (dom > monthLen) {
859 this.set (5, monthLen);
861 Clazz.defineMethod (c$, "getCurrentFixedDate",
863 return (this.calsys === java.util.GregorianCalendar.gcal) ? this.cachedFixedDate : this.calsys.getFixedDate (this.cdate);
865 c$.getRolledValue = Clazz.defineMethod (c$, "getRolledValue",
866 function (value, amount, min, max) {
867 var range = max - min + 1;
869 var n = value + amount;
872 } else if (n < min) {
876 Clazz.defineMethod (c$, "internalGetEra",
878 return this.isSet (0) ? this.internalGet (0) : 1;
880 Clazz.defineStatics (c$,
885 "EPOCH_OFFSET", 719163,
887 "MONTH_LENGTH", Clazz.newIntArray (-1, [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]),
888 "LEAP_MONTH_LENGTH", Clazz.newIntArray (-1, [31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]),
893 "MIN_VALUES", Clazz.newIntArray (-1, [0, 1, 0, 1, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, -46800000, 0]),
894 "LEAST_MAX_VALUES", Clazz.newIntArray (-1, [1, 292269054, 11, 52, 4, 28, 365, 7, 4, 1, 11, 23, 59, 59, 999, 50400000, 1200000]),
895 "MAX_VALUES", Clazz.newIntArray (-1, [1, 292278994, 11, 53, 6, 31, 366, 7, 6, 1, 11, 23, 59, 59, 999, 50400000, 7200000]));
896 c$.gcal = c$.prototype.gcal = jssun.util.calendar.CalendarSystem.getGregorianCalendar ();
897 Clazz.defineStatics (c$,
898 "DEFAULT_GREGORIAN_CUTOVER", -12219292800000);