Merge branch 'master' of https://source.jalview.org/git/jalviewjs.git
[jalviewjs.git] / site / swingjs / j2s / java / util / GregorianCalendar.js
index c601819..a7dfe8f 100644 (file)
-Clazz.declarePackage ("java.util");\r
-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 () {\r
-c$ = Clazz.decorateAsClass (function () {\r
-this.gregorianCutover = -12219292800000;\r
-this.gregorianCutoverDate = 577736;\r
-this.gregorianCutoverYear = 1582;\r
-this.gregorianCutoverYearJulian = 1582;\r
-this.gdate = null;\r
-this.cdate = null;\r
-this.calsys = null;\r
-this.zoneOffsets = null;\r
-this.originalFields = null;\r
-this.cachedFixedDate = -9223372036854775808;\r
-Clazz.instantialize (this, arguments);\r
-}, java.util, "GregorianCalendar", java.util.Calendar);\r
-Clazz.makeConstructor (c$, \r
-function () {\r
-this.construct (java.util.TimeZone.getDefaultRef (), java.util.Locale.getDefault ());\r
-this.setZoneShared (true);\r
-});\r
-Clazz.makeConstructor (c$, \r
-function (zone) {\r
-this.construct (zone, java.util.Locale.getDefault ());\r
-}, "java.util.TimeZone");\r
-Clazz.makeConstructor (c$, \r
-function (aLocale) {\r
-this.construct (java.util.TimeZone.getDefaultRef (), aLocale);\r
-this.setZoneShared (true);\r
-}, "java.util.Locale");\r
-Clazz.makeConstructor (c$, \r
-function (zone, aLocale) {\r
-Clazz.superConstructor (this, java.util.GregorianCalendar, [zone, aLocale]);\r
-this.gdate = java.util.GregorianCalendar.gcal.newCalendarDate (zone);\r
-this.setTimeInMillis (System.currentTimeMillis ());\r
-}, "java.util.TimeZone,java.util.Locale");\r
-Clazz.makeConstructor (c$, \r
-function (year, month, dayOfMonth) {\r
-this.construct (year, month, dayOfMonth, 0, 0, 0, 0);\r
-}, "~N,~N,~N");\r
-Clazz.makeConstructor (c$, \r
-function (year, month, dayOfMonth, hourOfDay, minute) {\r
-this.construct (year, month, dayOfMonth, hourOfDay, minute, 0, 0);\r
-}, "~N,~N,~N,~N,~N");\r
-Clazz.makeConstructor (c$, \r
-function (year, month, dayOfMonth, hourOfDay, minute, second) {\r
-this.construct (year, month, dayOfMonth, hourOfDay, minute, second, 0);\r
-}, "~N,~N,~N,~N,~N,~N");\r
-Clazz.makeConstructor (c$, \r
-function (year, month, dayOfMonth, hourOfDay, minute, second, millis) {\r
-Clazz.superConstructor (this, java.util.GregorianCalendar);\r
-this.gdate = java.util.GregorianCalendar.gcal.newCalendarDate (this.getZone ());\r
-this.set (1, year);\r
-this.set (2, month);\r
-this.set (5, dayOfMonth);\r
-if (hourOfDay >= 12 && hourOfDay <= 23) {\r
-this.internalSet (9, 1);\r
-this.internalSet (10, hourOfDay - 12);\r
-} else {\r
-this.internalSet (10, hourOfDay);\r
-}this.setFieldsComputed (1536);\r
-this.set (11, hourOfDay);\r
-this.set (12, minute);\r
-this.set (13, second);\r
-this.internalSet (14, millis);\r
-}, "~N,~N,~N,~N,~N,~N,~N");\r
-Clazz.defineMethod (c$, "getGregorianChange", \r
-function () {\r
-return  new java.util.Date (this.gregorianCutover);\r
-});\r
-Clazz.defineMethod (c$, "isLeapYear", \r
-function (year) {\r
-if ((year & 3) != 0) {\r
-return false;\r
-}if (year > this.gregorianCutoverYear) {\r
-return (year % 100 != 0) || (year % 400 == 0);\r
-}if (year < this.gregorianCutoverYearJulian) {\r
-return true;\r
-}var gregorian;\r
-if (this.gregorianCutoverYear == this.gregorianCutoverYearJulian) {\r
-var d = this.getCalendarDate (this.gregorianCutoverDate);\r
-gregorian = d.getMonth () < 3;\r
-} else {\r
-gregorian = year == this.gregorianCutoverYear;\r
-}return gregorian ? (year % 100 != 0) || (year % 400 == 0) : true;\r
-}, "~N");\r
-Clazz.defineMethod (c$, "equals", \r
-function (obj) {\r
-return Clazz.instanceOf (obj, java.util.GregorianCalendar) && Clazz.superCall (this, java.util.GregorianCalendar, "equals", [obj]) && this.gregorianCutover == (obj).gregorianCutover;\r
-}, "~O");\r
-Clazz.defineMethod (c$, "hashCode", \r
-function () {\r
-return Clazz.superCall (this, java.util.GregorianCalendar, "hashCode", []) ^ this.gregorianCutoverDate;\r
-});\r
-Clazz.overrideMethod (c$, "add", \r
-function (field, amount) {\r
-if (amount == 0) {\r
-return;\r
-}if (field < 0 || field >= 15) {\r
-throw  new IllegalArgumentException ();\r
-}this.complete ();\r
-if (field == 1) {\r
-var year = this.internalGet (1);\r
-if (this.internalGetEra () == 1) {\r
-year += amount;\r
-if (year > 0) {\r
-this.set (1, year);\r
-} else {\r
-this.set (1, 1 - year);\r
-this.set (0, 0);\r
-}} else {\r
-year -= amount;\r
-if (year > 0) {\r
-this.set (1, year);\r
-} else {\r
-this.set (1, 1 - year);\r
-this.set (0, 1);\r
-}}this.pinDayOfMonth ();\r
-} else if (field == 2) {\r
-var month = this.internalGet (2) + amount;\r
-var year = this.internalGet (1);\r
-var y_amount;\r
-if (month >= 0) {\r
-y_amount = Clazz.doubleToInt (month / 12);\r
-} else {\r
-y_amount = Clazz.doubleToInt ((month + 1) / 12) - 1;\r
-}if (y_amount != 0) {\r
-if (this.internalGetEra () == 1) {\r
-year += y_amount;\r
-if (year > 0) {\r
-this.set (1, year);\r
-} else {\r
-this.set (1, 1 - year);\r
-this.set (0, 0);\r
-}} else {\r
-year -= y_amount;\r
-if (year > 0) {\r
-this.set (1, year);\r
-} else {\r
-this.set (1, 1 - year);\r
-this.set (0, 1);\r
-}}}if (month >= 0) {\r
-this.set (2, (month % 12));\r
-} else {\r
-month %= 12;\r
-if (month < 0) {\r
-month += 12;\r
-}this.set (2, 0 + month);\r
-}this.pinDayOfMonth ();\r
-} else if (field == 0) {\r
-var era = this.internalGet (0) + amount;\r
-if (era < 0) {\r
-era = 0;\r
-}if (era > 1) {\r
-era = 1;\r
-}this.set (0, era);\r
-} else {\r
-var delta = amount;\r
-var timeOfDay = 0;\r
-switch (field) {\r
-case 10:\r
-case 11:\r
-delta *= 3600000;\r
-break;\r
-case 12:\r
-delta *= 60000;\r
-break;\r
-case 13:\r
-delta *= 1000;\r
-break;\r
-case 14:\r
-break;\r
-case 3:\r
-case 4:\r
-case 8:\r
-delta *= 7;\r
-break;\r
-case 5:\r
-case 6:\r
-case 7:\r
-break;\r
-case 9:\r
-delta = Clazz.doubleToInt (amount / 2);\r
-timeOfDay = 12 * (amount % 2);\r
-break;\r
-}\r
-if (field >= 10) {\r
-this.setTimeInMillis (this.time + delta);\r
-return;\r
-}var fd = this.getCurrentFixedDate ();\r
-timeOfDay += this.internalGet (11);\r
-timeOfDay *= 60;\r
-timeOfDay += this.internalGet (12);\r
-timeOfDay *= 60;\r
-timeOfDay += this.internalGet (13);\r
-timeOfDay *= 1000;\r
-timeOfDay += this.internalGet (14);\r
-if (timeOfDay >= 86400000) {\r
-fd++;\r
-timeOfDay -= 86400000;\r
-} else if (timeOfDay < 0) {\r
-fd--;\r
-timeOfDay += 86400000;\r
-}fd += delta;\r
-var zoneOffset = this.internalGet (15) + this.internalGet (16);\r
-this.setTimeInMillis ((fd - 719163) * 86400000 + timeOfDay - zoneOffset);\r
-zoneOffset -= this.internalGet (15) + this.internalGet (16);\r
-if (zoneOffset != 0) {\r
-this.setTimeInMillis (this.time + zoneOffset);\r
-var fd2 = this.getCurrentFixedDate ();\r
-if (fd2 != fd) {\r
-this.setTimeInMillis (this.time - zoneOffset);\r
-}}}}, "~N,~N");\r
-Clazz.defineMethod (c$, "roll", \r
-function (field, up) {\r
-this.roll (field, up ? 1 : -1);\r
-}, "~N,~B");\r
-Clazz.defineMethod (c$, "roll", \r
-function (field, amount) {\r
-if (amount == 0) {\r
-return;\r
-}if (field < 0 || field >= 15) {\r
-throw  new IllegalArgumentException ();\r
-}this.complete ();\r
-var min = this.getMinimum (field);\r
-var max = this.getMaximum (field);\r
-switch (field) {\r
-case 9:\r
-case 0:\r
-case 1:\r
-case 12:\r
-case 13:\r
-case 14:\r
-break;\r
-case 10:\r
-case 11:\r
-{\r
-var unit = max + 1;\r
-var h = this.internalGet (field);\r
-var nh = (h + amount) % unit;\r
-if (nh < 0) {\r
-nh += unit;\r
-}this.time += 3600000 * (nh - h);\r
-var d = this.calsys.getCalendarDate (this.time, this.getZone ());\r
-if (this.internalGet (5) != d.getDayOfMonth ()) {\r
-d.setDate (this.internalGet (1), this.internalGet (2) + 1, this.internalGet (5));\r
-if (field == 10) {\r
-d.addHours (12);\r
-}this.time = this.calsys.getTime (d);\r
-}var hourOfDay = d.getHours ();\r
-this.internalSet (field, hourOfDay % unit);\r
-if (field == 10) {\r
-this.internalSet (11, hourOfDay);\r
-} else {\r
-this.internalSet (9, Clazz.doubleToInt (hourOfDay / 12));\r
-this.internalSet (10, hourOfDay % 12);\r
-}var zoneOffset = d.getZoneOffset ();\r
-var saving = d.getDaylightSaving ();\r
-this.internalSet (15, zoneOffset - saving);\r
-this.internalSet (16, saving);\r
-return;\r
-}case 2:\r
-{\r
-var mon = (this.internalGet (2) + amount) % 12;\r
-if (mon < 0) {\r
-mon += 12;\r
-}this.set (2, mon);\r
-var monthLen = this.monthLength (mon);\r
-if (this.internalGet (5) > monthLen) {\r
-this.set (5, monthLen);\r
-}return;\r
-}case 3:\r
-{\r
-var y = this.cdate.getNormalizedYear ();\r
-max = this.getActualMaximum (3);\r
-this.set (7, this.internalGet (7));\r
-var woy = this.internalGet (3);\r
-var value = woy + amount;\r
-if (value > min && value < max) {\r
-this.set (3, value);\r
-return;\r
-}var fd = this.getCurrentFixedDate ();\r
-var day1 = fd - (7 * (woy - min));\r
-if (this.calsys.getYearFromFixedDate (day1) != y) {\r
-min++;\r
-}fd += 7 * (max - this.internalGet (3));\r
-if (this.calsys.getYearFromFixedDate (fd) != y) {\r
-max--;\r
-}break;\r
-}case 4:\r
-{\r
-var dow = this.internalGet (7) - this.getFirstDayOfWeek ();\r
-if (dow < 0) {\r
-dow += 7;\r
-}var fd = this.getCurrentFixedDate ();\r
-var month1;\r
-var monthLength;\r
-month1 = fd - this.internalGet (5) + 1;\r
-monthLength = this.calsys.getMonthLength (this.cdate);\r
-var monthDay1st = jssun.util.calendar.AbstractCalendar.getDayOfWeekDateOnOrBefore (month1 + 6, this.getFirstDayOfWeek ());\r
-if ((monthDay1st - month1) >= this.getMinimalDaysInFirstWeek ()) {\r
-monthDay1st -= 7;\r
-}max = this.getActualMaximum (field);\r
-var value = java.util.GregorianCalendar.getRolledValue (this.internalGet (field), amount, 1, max) - 1;\r
-var nfd = monthDay1st + value * 7 + dow;\r
-if (nfd < month1) {\r
-nfd = month1;\r
-} else if (nfd >= (month1 + monthLength)) {\r
-nfd = month1 + monthLength - 1;\r
-}var dayOfMonth;\r
-dayOfMonth = (nfd - month1) + 1;\r
-this.set (5, dayOfMonth);\r
-return;\r
-}case 5:\r
-{\r
-max = this.calsys.getMonthLength (this.cdate);\r
-break;\r
-}case 6:\r
-{\r
-max = this.getActualMaximum (field);\r
-break;\r
-}case 7:\r
-{\r
-var weekOfYear = this.internalGet (3);\r
-this.set (3, weekOfYear);\r
-max = 7;\r
-break;\r
-}case 8:\r
-{\r
-min = 1;\r
-var dom = this.internalGet (5);\r
-var monthLength = this.calsys.getMonthLength (this.cdate);\r
-var lastDays = monthLength % 7;\r
-max = Clazz.doubleToInt (monthLength / 7);\r
-var x = (dom - 1) % 7;\r
-if (x < lastDays) {\r
-max++;\r
-}this.set (7, this.internalGet (7));\r
-break;\r
-}}\r
-this.set (field, java.util.GregorianCalendar.getRolledValue (this.internalGet (field), amount, min, max));\r
-}, "~N,~N");\r
-Clazz.overrideMethod (c$, "getMinimum", \r
-function (field) {\r
-return java.util.GregorianCalendar.MIN_VALUES[field];\r
-}, "~N");\r
-Clazz.overrideMethod (c$, "getMaximum", \r
-function (field) {\r
-switch (field) {\r
-case 2:\r
-case 5:\r
-case 6:\r
-case 3:\r
-case 4:\r
-case 8:\r
-case 1:\r
-{\r
-if (this.gregorianCutoverYear > 200) {\r
-break;\r
-}var gc = this.clone ();\r
-gc.setLenient (true);\r
-gc.setTimeInMillis (this.gregorianCutover);\r
-var v1 = gc.getActualMaximum (field);\r
-gc.setTimeInMillis (this.gregorianCutover - 1);\r
-var v2 = gc.getActualMaximum (field);\r
-return Math.max (java.util.GregorianCalendar.MAX_VALUES[field], Math.max (v1, v2));\r
-}}\r
-return java.util.GregorianCalendar.MAX_VALUES[field];\r
-}, "~N");\r
-Clazz.overrideMethod (c$, "getGreatestMinimum", \r
-function (field) {\r
-return java.util.GregorianCalendar.MIN_VALUES[field];\r
-}, "~N");\r
-Clazz.overrideMethod (c$, "getLeastMaximum", \r
-function (field) {\r
-switch (field) {\r
-case 2:\r
-case 5:\r
-case 6:\r
-case 3:\r
-case 4:\r
-case 8:\r
-case 1:\r
-{\r
-var gc = this.clone ();\r
-gc.setLenient (true);\r
-gc.setTimeInMillis (this.gregorianCutover);\r
-var v1 = gc.getActualMaximum (field);\r
-gc.setTimeInMillis (this.gregorianCutover - 1);\r
-var v2 = gc.getActualMaximum (field);\r
-return Math.min (java.util.GregorianCalendar.LEAST_MAX_VALUES[field], Math.min (v1, v2));\r
-}}\r
-return java.util.GregorianCalendar.LEAST_MAX_VALUES[field];\r
-}, "~N");\r
-Clazz.overrideMethod (c$, "getActualMinimum", \r
-function (field) {\r
-if (field == 5) {\r
-}return this.getMinimum (field);\r
-}, "~N");\r
-Clazz.overrideMethod (c$, "getActualMaximum", \r
-function (field) {\r
-var fieldsForFixedMax = 130689;\r
-if ((130689 & (1 << field)) != 0) {\r
-return this.getMaximum (field);\r
-}var gc = this.getNormalizedCalendar ();\r
-var date = gc.cdate;\r
-var cal = gc.calsys;\r
-var value = -1;\r
-var d;\r
-var dd;\r
-switch (field) {\r
-case 2:\r
-{\r
-}break;\r
-case 5:\r
-value = cal.getMonthLength (date);\r
-break;\r
-case 6:\r
-value = cal.getYearLength (date);\r
-break;\r
-case 3:\r
-{\r
-dd = cal.newCalendarDate (java.util.TimeZone.NO_TIMEZONE);\r
-dd.setDate (date.getYear (), 1, 1);\r
-var dayOfWeek = cal.getDayOfWeek (dd);\r
-dayOfWeek -= this.getFirstDayOfWeek ();\r
-if (dayOfWeek < 0) {\r
-dayOfWeek += 7;\r
-}value = 52;\r
-var magic = dayOfWeek + this.getMinimalDaysInFirstWeek () - 1;\r
-if ((magic == 6) || (date.isLeapYear () && (magic == 5 || magic == 12))) {\r
-value++;\r
-}}break;\r
-case 4:\r
-dd = cal.newCalendarDate (null);\r
-dd.setDate (date.getYear (), date.getMonth (), 1);\r
-var dayOfWeek = cal.getDayOfWeek (dd);\r
-var monthLength = cal.getMonthLength (dd);\r
-dayOfWeek -= this.getFirstDayOfWeek ();\r
-if (dayOfWeek < 0) {\r
-dayOfWeek += 7;\r
-}var nDaysFirstWeek = 7 - dayOfWeek;\r
-value = 3;\r
-if (nDaysFirstWeek >= this.getMinimalDaysInFirstWeek ()) {\r
-value++;\r
-}monthLength -= nDaysFirstWeek + 21;\r
-if (monthLength > 0) {\r
-value++;\r
-if (monthLength > 7) {\r
-value++;\r
-}}break;\r
-case 8:\r
-{\r
-var ndays;\r
-var dow1;\r
-var dow = date.getDayOfWeek ();\r
-d = date.clone ();\r
-ndays = cal.getMonthLength (d);\r
-d.setDayOfMonth (1);\r
-cal.normalize (d);\r
-dow1 = d.getDayOfWeek ();\r
-var x = dow - dow1;\r
-if (x < 0) {\r
-x += 7;\r
-}ndays -= x;\r
-value = Clazz.doubleToInt ((ndays + 6) / 7);\r
-}break;\r
-case 1:\r
-{\r
-if (gc === this) {\r
-gc = this.clone ();\r
-}var current = gc.getYearOffsetInMillis ();\r
-if (gc.internalGetEra () == 1) {\r
-gc.setTimeInMillis (9223372036854775807);\r
-value = gc.get (1);\r
-var maxEnd = gc.getYearOffsetInMillis ();\r
-if (current > maxEnd) {\r
-value--;\r
-}} else {\r
-var mincal = java.util.GregorianCalendar.gcal;\r
-dd = mincal.getCalendarDate (-9223372036854775808, this.getZone ());\r
-var maxEnd = (cal.getDayOfYear (dd) - 1) * 24 + dd.getHours ();\r
-maxEnd *= 60;\r
-maxEnd += dd.getMinutes ();\r
-maxEnd *= 60;\r
-maxEnd += dd.getSeconds ();\r
-maxEnd *= 1000;\r
-maxEnd += dd.getMillis ();\r
-value = dd.getYear ();\r
-if (value <= 0) {\r
-value = 1 - value;\r
-}if (current < maxEnd) {\r
-value--;\r
-}}}break;\r
-default:\r
-throw  new ArrayIndexOutOfBoundsException (field);\r
-}\r
-return value;\r
-}, "~N");\r
-Clazz.defineMethod (c$, "getYearOffsetInMillis", \r
- function () {\r
-var t = (this.internalGet (6) - 1) * 24;\r
-t += this.internalGet (11);\r
-t *= 60;\r
-t += this.internalGet (12);\r
-t *= 60;\r
-t += this.internalGet (13);\r
-t *= 1000;\r
-return t + this.internalGet (14) - (this.internalGet (15) + this.internalGet (16));\r
-});\r
-Clazz.defineMethod (c$, "clone", \r
-function () {\r
-var other = Clazz.superCall (this, java.util.GregorianCalendar, "clone", []);\r
-other.gdate = this.gdate.clone ();\r
-if (this.cdate != null) {\r
-if (this.cdate !== this.gdate) {\r
-other.cdate = this.cdate.clone ();\r
-} else {\r
-other.cdate = other.gdate;\r
-}}other.originalFields = null;\r
-other.zoneOffsets = null;\r
-return other;\r
-});\r
-Clazz.defineMethod (c$, "getTimeZone", \r
-function () {\r
-var zone = Clazz.superCall (this, java.util.GregorianCalendar, "getTimeZone", []);\r
-this.gdate.setZone (zone);\r
-if (this.cdate != null && this.cdate !== this.gdate) {\r
-this.cdate.setZone (zone);\r
-}return zone;\r
-});\r
-Clazz.defineMethod (c$, "setTimeZone", \r
-function (zone) {\r
-Clazz.superCall (this, java.util.GregorianCalendar, "setTimeZone", [zone]);\r
-this.gdate.setZone (zone);\r
-if (this.cdate != null && this.cdate !== this.gdate) {\r
-this.cdate.setZone (zone);\r
-}}, "java.util.TimeZone");\r
-Clazz.defineMethod (c$, "computeFields", \r
-function () {\r
-var mask = 0;\r
-if (this.isPartiallyNormalized ()) {\r
-mask = this.getSetStateFields ();\r
-var fieldMask = ~mask & 131071;\r
-if (fieldMask != 0 || this.calsys == null) {\r
-mask |= this.computeFields (fieldMask, mask & (98304));\r
-}} else {\r
-mask = 131071;\r
-this.computeFields (mask, 0);\r
-}this.setFieldsComputed (mask);\r
-});\r
-Clazz.defineMethod (c$, "computeFields", \r
- function (fieldMask, tzMask) {\r
-var zoneOffset = 0;\r
-var tz = this.getZone ();\r
-if (this.zoneOffsets == null) {\r
-this.zoneOffsets =  Clazz.newIntArray (2, 0);\r
-}if (tzMask != (98304)) {\r
-if (Clazz.instanceOf (tz, jssun.util.calendar.ZoneInfo)) {\r
-zoneOffset = (tz).getOffsets (this.time, this.zoneOffsets);\r
-} else {\r
-zoneOffset = tz.getOffset (this.time);\r
-this.zoneOffsets[0] = tz.getRawOffset ();\r
-this.zoneOffsets[1] = zoneOffset - this.zoneOffsets[0];\r
-}}if (tzMask != 0) {\r
-if (java.util.Calendar.isFieldSet (tzMask, 15)) {\r
-this.zoneOffsets[0] = this.internalGet (15);\r
-}if (java.util.Calendar.isFieldSet (tzMask, 16)) {\r
-this.zoneOffsets[1] = this.internalGet (16);\r
-}zoneOffset = this.zoneOffsets[0] + this.zoneOffsets[1];\r
-}var fixedDate = Clazz.doubleToInt (zoneOffset / 86400000);\r
-var timeOfDay = zoneOffset % 86400000;\r
-fixedDate += Clazz.doubleToInt (this.time / 86400000);\r
-timeOfDay += (this.time % 86400000);\r
-if (timeOfDay >= 86400000) {\r
-timeOfDay -= 86400000;\r
-++fixedDate;\r
-} else {\r
-while (timeOfDay < 0) {\r
-timeOfDay += 86400000;\r
---fixedDate;\r
-}\r
-}fixedDate += 719163;\r
-var era = 1;\r
-var year;\r
-if (fixedDate != this.cachedFixedDate) {\r
-java.util.GregorianCalendar.gcal.getCalendarDateFromFixedDate (this.gdate, fixedDate);\r
-this.cachedFixedDate = fixedDate;\r
-}year = this.gdate.getYear ();\r
-if (year <= 0) {\r
-year = 1 - year;\r
-era = 0;\r
-}this.calsys = java.util.GregorianCalendar.gcal;\r
-this.cdate = this.gdate;\r
-this.internalSet (0, era);\r
-this.internalSet (1, year);\r
-var mask = fieldMask | (3);\r
-var month = this.cdate.getMonth () - 1;\r
-var dayOfMonth = this.cdate.getDayOfMonth ();\r
-if ((fieldMask & (164)) != 0) {\r
-this.internalSet (2, month);\r
-this.internalSet (5, dayOfMonth);\r
-this.internalSet (7, this.cdate.getDayOfWeek ());\r
-mask |= 164;\r
-}if ((fieldMask & (32256)) != 0) {\r
-if (timeOfDay != 0) {\r
-var hours = Clazz.doubleToInt (timeOfDay / 3600000);\r
-this.internalSet (11, hours);\r
-this.internalSet (9, Clazz.doubleToInt (hours / 12));\r
-this.internalSet (10, hours % 12);\r
-var r = timeOfDay % 3600000;\r
-this.internalSet (12, Clazz.doubleToInt (r / 60000));\r
-r %= 60000;\r
-this.internalSet (13, Clazz.doubleToInt (r / 1000));\r
-this.internalSet (14, r % 1000);\r
-} else {\r
-this.internalSet (11, 0);\r
-this.internalSet (9, 0);\r
-this.internalSet (10, 0);\r
-this.internalSet (12, 0);\r
-this.internalSet (13, 0);\r
-this.internalSet (14, 0);\r
-}mask |= (32256);\r
-}if ((fieldMask & (98304)) != 0) {\r
-this.internalSet (15, this.zoneOffsets[0]);\r
-this.internalSet (16, this.zoneOffsets[1]);\r
-mask |= (98304);\r
-}if ((fieldMask & (344)) != 0) {\r
-var normalizedYear = this.cdate.getNormalizedYear ();\r
-var fixedDateJan1 = this.calsys.getFixedDate (normalizedYear, 1, 1, this.cdate);\r
-var dayOfYear = (fixedDate - fixedDateJan1) + 1;\r
-var fixedDateMonth1 = fixedDate - dayOfMonth + 1;\r
-var cutoverYear = (this.calsys === java.util.GregorianCalendar.gcal) ? this.gregorianCutoverYear : this.gregorianCutoverYearJulian;\r
-var relativeDayOfMonth = dayOfMonth - 1;\r
-if (normalizedYear == cutoverYear) {\r
-var realDayOfYear = (fixedDate - fixedDateJan1) + 1;\r
-dayOfYear = realDayOfYear;\r
-relativeDayOfMonth = (fixedDate - fixedDateMonth1);\r
-}this.internalSet (6, dayOfYear);\r
-this.internalSet (8, Clazz.doubleToInt (relativeDayOfMonth / 7) + 1);\r
-var weekOfYear = this.getWeekNumber (fixedDateJan1, fixedDate);\r
-if (weekOfYear == 0) {\r
-var fixedDec31 = fixedDateJan1 - 1;\r
-var prevJan1;\r
-prevJan1 = fixedDateJan1 - 365;\r
-if (jssun.util.calendar.CalendarUtils.isGregorianLeapYear (normalizedYear - 1)) {\r
---prevJan1;\r
-}weekOfYear = this.getWeekNumber (prevJan1, fixedDec31);\r
-} else {\r
-if (normalizedYear > this.gregorianCutoverYear || normalizedYear < (this.gregorianCutoverYearJulian - 1)) {\r
-if (weekOfYear >= 52) {\r
-var nextJan1 = fixedDateJan1 + 365;\r
-if (this.cdate.isLeapYear ()) {\r
-nextJan1++;\r
-}var nextJan1st = jssun.util.calendar.AbstractCalendar.getDayOfWeekDateOnOrBefore (nextJan1 + 6, this.getFirstDayOfWeek ());\r
-var ndays = (nextJan1st - nextJan1);\r
-if (ndays >= this.getMinimalDaysInFirstWeek () && fixedDate >= (nextJan1st - 7)) {\r
-weekOfYear = 1;\r
-}}} else {\r
-var calForJan1 = this.calsys;\r
-var nextYear = normalizedYear + 1;\r
-var nextJan1 = calForJan1.getFixedDate (nextYear, 1, 1, null);\r
-if (nextJan1 < fixedDate) {\r
-nextJan1 = this.gregorianCutoverDate;\r
-calForJan1 = java.util.GregorianCalendar.gcal;\r
-}var nextJan1st = jssun.util.calendar.AbstractCalendar.getDayOfWeekDateOnOrBefore (nextJan1 + 6, this.getFirstDayOfWeek ());\r
-var ndays = (nextJan1st - nextJan1);\r
-if (ndays >= this.getMinimalDaysInFirstWeek () && fixedDate >= (nextJan1st - 7)) {\r
-weekOfYear = 1;\r
-}}}this.internalSet (3, weekOfYear);\r
-this.internalSet (4, this.getWeekNumber (fixedDateMonth1, fixedDate));\r
-mask |= (344);\r
-}return mask;\r
-}, "~N,~N");\r
-Clazz.defineMethod (c$, "getWeekNumber", \r
- function (fixedDay1, fixedDate) {\r
-var fixedDay1st = jssun.util.calendar.AbstractCalendar.getDayOfWeekDateOnOrBefore (fixedDay1 + 6, this.getFirstDayOfWeek ());\r
-var ndays = (fixedDay1st - fixedDay1);\r
-if (ndays >= this.getMinimalDaysInFirstWeek ()) {\r
-fixedDay1st -= 7;\r
-}var normalizedDayOfPeriod = (fixedDate - fixedDay1st);\r
-if (normalizedDayOfPeriod >= 0) {\r
-return Clazz.doubleToInt (normalizedDayOfPeriod / 7) + 1;\r
-}return jssun.util.calendar.CalendarUtils.floorDivide (normalizedDayOfPeriod, 7) + 1;\r
-}, "~N,~N");\r
-Clazz.overrideMethod (c$, "computeTime", \r
-function () {\r
-if (!this.isLenient ()) {\r
-if (this.originalFields == null) {\r
-this.originalFields =  Clazz.newIntArray (17, 0);\r
-}for (var field = 0; field < 17; field++) {\r
-var value = this.internalGet (field);\r
-if (this.isExternallySet (field)) {\r
-if (value < this.getMinimum (field) || value > this.getMaximum (field)) {\r
-throw  new IllegalArgumentException (java.util.Calendar.getFieldName (field));\r
-}}this.originalFields[field] = value;\r
-}\r
-}var fieldMask = this.selectFields ();\r
-var year = this.isSet (1) ? this.internalGet (1) : 1970;\r
-var era = this.internalGetEra ();\r
-if (era == 0) {\r
-year = 1 - year;\r
-} else if (era != 1) {\r
-throw  new IllegalArgumentException ("Invalid era");\r
-}if (year <= 0 && !this.isSet (0)) {\r
-fieldMask |= 1;\r
-this.setFieldsComputed (1);\r
-}var timeOfDay = 0;\r
-if (java.util.Calendar.isFieldSet (fieldMask, 11)) {\r
-timeOfDay += this.internalGet (11);\r
-} else {\r
-timeOfDay += this.internalGet (10);\r
-if (java.util.Calendar.isFieldSet (fieldMask, 9)) {\r
-timeOfDay += 12 * this.internalGet (9);\r
-}}timeOfDay *= 60;\r
-timeOfDay += this.internalGet (12);\r
-timeOfDay *= 60;\r
-timeOfDay += this.internalGet (13);\r
-timeOfDay *= 1000;\r
-timeOfDay += this.internalGet (14);\r
-var fixedDate = Clazz.doubleToInt (timeOfDay / 86400000);\r
-timeOfDay %= 86400000;\r
-while (timeOfDay < 0) {\r
-timeOfDay += 86400000;\r
---fixedDate;\r
-}\r
-calculateFixedDate : {\r
-var gfd;\r
-gfd = fixedDate + this.getFixedDate (java.util.GregorianCalendar.gcal, year, fieldMask);\r
-fixedDate = gfd;\r
-break calculateFixedDate;\r
-}var millis = (fixedDate - 719163) * 86400000 + timeOfDay;\r
-var zone = this.getZone ();\r
-if (this.zoneOffsets == null) {\r
-this.zoneOffsets =  Clazz.newIntArray (2, 0);\r
-}var tzMask = fieldMask & (98304);\r
-if (tzMask != (98304)) {\r
-if (Clazz.instanceOf (zone, jssun.util.calendar.ZoneInfo)) {\r
-(zone).getOffsetsByWall (millis, this.zoneOffsets);\r
-} else {\r
-var gmtOffset = java.util.Calendar.isFieldSet (fieldMask, 15) ? this.internalGet (15) : zone.getRawOffset ();\r
-zone.getOffsets (millis - gmtOffset, this.zoneOffsets);\r
-}}if (tzMask != 0) {\r
-if (java.util.Calendar.isFieldSet (tzMask, 15)) {\r
-this.zoneOffsets[0] = this.internalGet (15);\r
-}if (java.util.Calendar.isFieldSet (tzMask, 16)) {\r
-this.zoneOffsets[1] = this.internalGet (16);\r
-}}millis -= this.zoneOffsets[0] + this.zoneOffsets[1];\r
-this.time = millis;\r
-var mask = this.computeFields (fieldMask | this.getSetStateFields (), tzMask);\r
-if (!this.isLenient ()) {\r
-for (var field = 0; field < 17; field++) {\r
-if (!this.isExternallySet (field)) {\r
-continue;\r
-}if (this.originalFields[field] != this.internalGet (field)) {\r
-System.arraycopy (this.originalFields, 0, this.fields, 0, this.fields.length);\r
-throw  new IllegalArgumentException (java.util.Calendar.getFieldName (field));\r
-}}\r
-}this.setFieldsNormalized (mask);\r
-});\r
-Clazz.defineMethod (c$, "getFixedDate", \r
- function (cal, year, fieldMask) {\r
-var month = 0;\r
-if (java.util.Calendar.isFieldSet (fieldMask, 2)) {\r
-month = this.internalGet (2);\r
-if (month > 11) {\r
-year += Clazz.doubleToInt (month / 12);\r
-month %= 12;\r
-} else if (month < 0) {\r
-var rem =  Clazz.newIntArray (1, 0);\r
-year += jssun.util.calendar.CalendarUtils.floorDivide (month, 12, rem);\r
-month = rem[0];\r
-}}var fixedDate = cal.getFixedDate (year, month + 1, 1, cal === java.util.GregorianCalendar.gcal ? this.gdate : null);\r
-if (java.util.Calendar.isFieldSet (fieldMask, 2)) {\r
-if (java.util.Calendar.isFieldSet (fieldMask, 5)) {\r
-if (this.isSet (5)) {\r
-fixedDate += this.internalGet (5);\r
-fixedDate--;\r
-}} else {\r
-if (java.util.Calendar.isFieldSet (fieldMask, 4)) {\r
-var firstDayOfWeek = jssun.util.calendar.AbstractCalendar.getDayOfWeekDateOnOrBefore (fixedDate + 6, this.getFirstDayOfWeek ());\r
-if ((firstDayOfWeek - fixedDate) >= this.getMinimalDaysInFirstWeek ()) {\r
-firstDayOfWeek -= 7;\r
-}if (java.util.Calendar.isFieldSet (fieldMask, 7)) {\r
-firstDayOfWeek = jssun.util.calendar.AbstractCalendar.getDayOfWeekDateOnOrBefore (firstDayOfWeek + 6, this.internalGet (7));\r
-}fixedDate = firstDayOfWeek + 7 * (this.internalGet (4) - 1);\r
-} else {\r
-var dayOfWeek;\r
-if (java.util.Calendar.isFieldSet (fieldMask, 7)) {\r
-dayOfWeek = this.internalGet (7);\r
-} else {\r
-dayOfWeek = this.getFirstDayOfWeek ();\r
-}var dowim;\r
-if (java.util.Calendar.isFieldSet (fieldMask, 8)) {\r
-dowim = this.internalGet (8);\r
-} else {\r
-dowim = 1;\r
-}if (dowim >= 0) {\r
-fixedDate = jssun.util.calendar.AbstractCalendar.getDayOfWeekDateOnOrBefore (fixedDate + (7 * dowim) - 1, dayOfWeek);\r
-} else {\r
-var lastDate = this.monthLength (month, year) + (7 * (dowim + 1));\r
-fixedDate = jssun.util.calendar.AbstractCalendar.getDayOfWeekDateOnOrBefore (fixedDate + lastDate - 1, dayOfWeek);\r
-}}}} else {\r
-if (year == this.gregorianCutoverYear && cal === java.util.GregorianCalendar.gcal && fixedDate < this.gregorianCutoverDate && this.gregorianCutoverYear != this.gregorianCutoverYearJulian) {\r
-fixedDate = this.gregorianCutoverDate;\r
-}if (java.util.Calendar.isFieldSet (fieldMask, 6)) {\r
-fixedDate += this.internalGet (6);\r
-fixedDate--;\r
-} else {\r
-var firstDayOfWeek = jssun.util.calendar.AbstractCalendar.getDayOfWeekDateOnOrBefore (fixedDate + 6, this.getFirstDayOfWeek ());\r
-if ((firstDayOfWeek - fixedDate) >= this.getMinimalDaysInFirstWeek ()) {\r
-firstDayOfWeek -= 7;\r
-}if (java.util.Calendar.isFieldSet (fieldMask, 7)) {\r
-var dayOfWeek = this.internalGet (7);\r
-if (dayOfWeek != this.getFirstDayOfWeek ()) {\r
-firstDayOfWeek = jssun.util.calendar.AbstractCalendar.getDayOfWeekDateOnOrBefore (firstDayOfWeek + 6, dayOfWeek);\r
-}}fixedDate = firstDayOfWeek + 7 * (this.internalGet (3) - 1);\r
-}}return fixedDate;\r
-}, "jssun.util.calendar.BaseCalendar,~N,~N");\r
-Clazz.defineMethod (c$, "getNormalizedCalendar", \r
- function () {\r
-var gc;\r
-if (this.isFullyNormalized ()) {\r
-gc = this;\r
-} else {\r
-gc = this.clone ();\r
-gc.setLenient (true);\r
-gc.complete ();\r
-}return gc;\r
-});\r
-Clazz.defineMethod (c$, "getCalendarDate", \r
- function (fd) {\r
-var cal = java.util.GregorianCalendar.gcal;\r
-var d = cal.newCalendarDate (java.util.TimeZone.NO_TIMEZONE);\r
-cal.getCalendarDateFromFixedDate (d, fd);\r
-return d;\r
-}, "~N");\r
-Clazz.defineMethod (c$, "monthLength", \r
- function (month, year) {\r
-return this.isLeapYear (year) ? java.util.GregorianCalendar.LEAP_MONTH_LENGTH[month] : java.util.GregorianCalendar.MONTH_LENGTH[month];\r
-}, "~N,~N");\r
-Clazz.defineMethod (c$, "monthLength", \r
- function (month) {\r
-var year = this.internalGet (1);\r
-if (this.internalGetEra () == 0) {\r
-year = 1 - year;\r
-}return this.monthLength (month, year);\r
-}, "~N");\r
-Clazz.defineMethod (c$, "pinDayOfMonth", \r
- function () {\r
-var year = this.internalGet (1);\r
-var monthLen;\r
-if (year > this.gregorianCutoverYear || year < this.gregorianCutoverYearJulian) {\r
-monthLen = this.monthLength (this.internalGet (2));\r
-} else {\r
-var gc = this.getNormalizedCalendar ();\r
-monthLen = gc.getActualMaximum (5);\r
-}var dom = this.internalGet (5);\r
-if (dom > monthLen) {\r
-this.set (5, monthLen);\r
-}});\r
-Clazz.defineMethod (c$, "getCurrentFixedDate", \r
- function () {\r
-return (this.calsys === java.util.GregorianCalendar.gcal) ? this.cachedFixedDate : this.calsys.getFixedDate (this.cdate);\r
-});\r
-c$.getRolledValue = Clazz.defineMethod (c$, "getRolledValue", \r
- function (value, amount, min, max) {\r
-var range = max - min + 1;\r
-amount %= range;\r
-var n = value + amount;\r
-if (n > max) {\r
-n -= range;\r
-} else if (n < min) {\r
-n += range;\r
-}return n;\r
-}, "~N,~N,~N,~N");\r
-Clazz.defineMethod (c$, "internalGetEra", \r
- function () {\r
-return this.isSet (0) ? this.internalGet (0) : 1;\r
-});\r
-Clazz.defineStatics (c$,\r
-"BC", 0,\r
-"BCE", 0,\r
-"AD", 1,\r
-"CE", 1,\r
-"EPOCH_OFFSET", 719163,\r
-"EPOCH_YEAR", 1970,\r
-"MONTH_LENGTH",  Clazz.newIntArray (-1, [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]),\r
-"LEAP_MONTH_LENGTH",  Clazz.newIntArray (-1, [31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]),\r
-"ONE_SECOND", 1000,\r
-"ONE_MINUTE", 60000,\r
-"ONE_HOUR", 3600000,\r
-"ONE_DAY", 86400000,\r
-"MIN_VALUES",  Clazz.newIntArray (-1, [0, 1, 0, 1, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, -46800000, 0]),\r
-"LEAST_MAX_VALUES",  Clazz.newIntArray (-1, [1, 292269054, 11, 52, 4, 28, 365, 7, 4, 1, 11, 23, 59, 59, 999, 50400000, 1200000]),\r
-"MAX_VALUES",  Clazz.newIntArray (-1, [1, 292278994, 11, 53, 6, 31, 366, 7, 6, 1, 11, 23, 59, 59, 999, 50400000, 7200000]));\r
-c$.gcal = c$.prototype.gcal = jssun.util.calendar.CalendarSystem.getGregorianCalendar ();\r
-Clazz.defineStatics (c$,\r
-"DEFAULT_GREGORIAN_CUTOVER", -12219292800000);\r
-});\r
+Clazz.declarePackage ("java.util");
+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 () {
+c$ = Clazz.decorateAsClass (function () {
+this.gregorianCutover = -12219292800000;
+this.gregorianCutoverDate = 577736;
+this.gregorianCutoverYear = 1582;
+this.gregorianCutoverYearJulian = 1582;
+this.gdate = null;
+this.cdate = null;
+this.calsys = null;
+this.zoneOffsets = null;
+this.originalFields = null;
+this.cachedFixedDate = -9223372036854775808;
+Clazz.instantialize (this, arguments);
+}, java.util, "GregorianCalendar", java.util.Calendar);
+Clazz.makeConstructor (c$, 
+function () {
+this.construct (java.util.TimeZone.getDefaultRef (), java.util.Locale.getDefault ());
+this.setZoneShared (true);
+});
+Clazz.makeConstructor (c$, 
+function (zone) {
+this.construct (zone, java.util.Locale.getDefault ());
+}, "java.util.TimeZone");
+Clazz.makeConstructor (c$, 
+function (aLocale) {
+this.construct (java.util.TimeZone.getDefaultRef (), aLocale);
+this.setZoneShared (true);
+}, "java.util.Locale");
+Clazz.makeConstructor (c$, 
+function (zone, aLocale) {
+Clazz.superConstructor (this, java.util.GregorianCalendar, [zone, aLocale]);
+this.gdate = java.util.GregorianCalendar.gcal.newCalendarDate (zone);
+this.setTimeInMillis (System.currentTimeMillis ());
+}, "java.util.TimeZone,java.util.Locale");
+Clazz.makeConstructor (c$, 
+function (year, month, dayOfMonth) {
+this.construct (year, month, dayOfMonth, 0, 0, 0, 0);
+}, "~N,~N,~N");
+Clazz.makeConstructor (c$, 
+function (year, month, dayOfMonth, hourOfDay, minute) {
+this.construct (year, month, dayOfMonth, hourOfDay, minute, 0, 0);
+}, "~N,~N,~N,~N,~N");
+Clazz.makeConstructor (c$, 
+function (year, month, dayOfMonth, hourOfDay, minute, second) {
+this.construct (year, month, dayOfMonth, hourOfDay, minute, second, 0);
+}, "~N,~N,~N,~N,~N,~N");
+Clazz.makeConstructor (c$, 
+function (year, month, dayOfMonth, hourOfDay, minute, second, millis) {
+Clazz.superConstructor (this, java.util.GregorianCalendar);
+this.gdate = java.util.GregorianCalendar.gcal.newCalendarDate (this.getZone ());
+this.set (1, year);
+this.set (2, month);
+this.set (5, dayOfMonth);
+if (hourOfDay >= 12 && hourOfDay <= 23) {
+this.internalSet (9, 1);
+this.internalSet (10, hourOfDay - 12);
+} else {
+this.internalSet (10, hourOfDay);
+}this.setFieldsComputed (1536);
+this.set (11, hourOfDay);
+this.set (12, minute);
+this.set (13, second);
+this.internalSet (14, millis);
+}, "~N,~N,~N,~N,~N,~N,~N");
+Clazz.defineMethod (c$, "getGregorianChange", 
+function () {
+return  new java.util.Date (this.gregorianCutover);
+});
+Clazz.defineMethod (c$, "isLeapYear", 
+function (year) {
+if ((year & 3) != 0) {
+return false;
+}if (year > this.gregorianCutoverYear) {
+return (year % 100 != 0) || (year % 400 == 0);
+}if (year < this.gregorianCutoverYearJulian) {
+return true;
+}var gregorian;
+if (this.gregorianCutoverYear == this.gregorianCutoverYearJulian) {
+var d = this.getCalendarDate (this.gregorianCutoverDate);
+gregorian = d.getMonth () < 3;
+} else {
+gregorian = year == this.gregorianCutoverYear;
+}return gregorian ? (year % 100 != 0) || (year % 400 == 0) : true;
+}, "~N");
+Clazz.defineMethod (c$, "equals", 
+function (obj) {
+return Clazz.instanceOf (obj, java.util.GregorianCalendar) && Clazz.superCall (this, java.util.GregorianCalendar, "equals", [obj]) && this.gregorianCutover == (obj).gregorianCutover;
+}, "~O");
+Clazz.defineMethod (c$, "hashCode", 
+function () {
+return Clazz.superCall (this, java.util.GregorianCalendar, "hashCode", []) ^ this.gregorianCutoverDate;
+});
+Clazz.overrideMethod (c$, "add", 
+function (field, amount) {
+if (amount == 0) {
+return;
+}if (field < 0 || field >= 15) {
+throw  new IllegalArgumentException ();
+}this.complete ();
+if (field == 1) {
+var year = this.internalGet (1);
+if (this.internalGetEra () == 1) {
+year += amount;
+if (year > 0) {
+this.set (1, year);
+} else {
+this.set (1, 1 - year);
+this.set (0, 0);
+}} else {
+year -= amount;
+if (year > 0) {
+this.set (1, year);
+} else {
+this.set (1, 1 - year);
+this.set (0, 1);
+}}this.pinDayOfMonth ();
+} else if (field == 2) {
+var month = this.internalGet (2) + amount;
+var year = this.internalGet (1);
+var y_amount;
+if (month >= 0) {
+y_amount = Clazz.doubleToInt (month / 12);
+} else {
+y_amount = Clazz.doubleToInt ((month + 1) / 12) - 1;
+}if (y_amount != 0) {
+if (this.internalGetEra () == 1) {
+year += y_amount;
+if (year > 0) {
+this.set (1, year);
+} else {
+this.set (1, 1 - year);
+this.set (0, 0);
+}} else {
+year -= y_amount;
+if (year > 0) {
+this.set (1, year);
+} else {
+this.set (1, 1 - year);
+this.set (0, 1);
+}}}if (month >= 0) {
+this.set (2, (month % 12));
+} else {
+month %= 12;
+if (month < 0) {
+month += 12;
+}this.set (2, 0 + month);
+}this.pinDayOfMonth ();
+} else if (field == 0) {
+var era = this.internalGet (0) + amount;
+if (era < 0) {
+era = 0;
+}if (era > 1) {
+era = 1;
+}this.set (0, era);
+} else {
+var delta = amount;
+var timeOfDay = 0;
+switch (field) {
+case 10:
+case 11:
+delta *= 3600000;
+break;
+case 12:
+delta *= 60000;
+break;
+case 13:
+delta *= 1000;
+break;
+case 14:
+break;
+case 3:
+case 4:
+case 8:
+delta *= 7;
+break;
+case 5:
+case 6:
+case 7:
+break;
+case 9:
+delta = Clazz.doubleToInt (amount / 2);
+timeOfDay = 12 * (amount % 2);
+break;
+}
+if (field >= 10) {
+this.setTimeInMillis (this.time + delta);
+return;
+}var fd = this.getCurrentFixedDate ();
+timeOfDay += this.internalGet (11);
+timeOfDay *= 60;
+timeOfDay += this.internalGet (12);
+timeOfDay *= 60;
+timeOfDay += this.internalGet (13);
+timeOfDay *= 1000;
+timeOfDay += this.internalGet (14);
+if (timeOfDay >= 86400000) {
+fd++;
+timeOfDay -= 86400000;
+} else if (timeOfDay < 0) {
+fd--;
+timeOfDay += 86400000;
+}fd += delta;
+var zoneOffset = this.internalGet (15) + this.internalGet (16);
+this.setTimeInMillis ((fd - 719163) * 86400000 + timeOfDay - zoneOffset);
+zoneOffset -= this.internalGet (15) + this.internalGet (16);
+if (zoneOffset != 0) {
+this.setTimeInMillis (this.time + zoneOffset);
+var fd2 = this.getCurrentFixedDate ();
+if (fd2 != fd) {
+this.setTimeInMillis (this.time - zoneOffset);
+}}}}, "~N,~N");
+Clazz.defineMethod (c$, "roll", 
+function (field, up) {
+this.roll (field, up ? 1 : -1);
+}, "~N,~B");
+Clazz.defineMethod (c$, "roll", 
+function (field, amount) {
+if (amount == 0) {
+return;
+}if (field < 0 || field >= 15) {
+throw  new IllegalArgumentException ();
+}this.complete ();
+var min = this.getMinimum (field);
+var max = this.getMaximum (field);
+switch (field) {
+case 9:
+case 0:
+case 1:
+case 12:
+case 13:
+case 14:
+break;
+case 10:
+case 11:
+{
+var unit = max + 1;
+var h = this.internalGet (field);
+var nh = (h + amount) % unit;
+if (nh < 0) {
+nh += unit;
+}this.time += 3600000 * (nh - h);
+var d = this.calsys.getCalendarDate (this.time, this.getZone ());
+if (this.internalGet (5) != d.getDayOfMonth ()) {
+d.setDate (this.internalGet (1), this.internalGet (2) + 1, this.internalGet (5));
+if (field == 10) {
+d.addHours (12);
+}this.time = this.calsys.getTime (d);
+}var hourOfDay = d.getHours ();
+this.internalSet (field, hourOfDay % unit);
+if (field == 10) {
+this.internalSet (11, hourOfDay);
+} else {
+this.internalSet (9, Clazz.doubleToInt (hourOfDay / 12));
+this.internalSet (10, hourOfDay % 12);
+}var zoneOffset = d.getZoneOffset ();
+var saving = d.getDaylightSaving ();
+this.internalSet (15, zoneOffset - saving);
+this.internalSet (16, saving);
+return;
+}case 2:
+{
+var mon = (this.internalGet (2) + amount) % 12;
+if (mon < 0) {
+mon += 12;
+}this.set (2, mon);
+var monthLen = this.monthLength (mon);
+if (this.internalGet (5) > monthLen) {
+this.set (5, monthLen);
+}return;
+}case 3:
+{
+var y = this.cdate.getNormalizedYear ();
+max = this.getActualMaximum (3);
+this.set (7, this.internalGet (7));
+var woy = this.internalGet (3);
+var value = woy + amount;
+if (value > min && value < max) {
+this.set (3, value);
+return;
+}var fd = this.getCurrentFixedDate ();
+var day1 = fd - (7 * (woy - min));
+if (this.calsys.getYearFromFixedDate (day1) != y) {
+min++;
+}fd += 7 * (max - this.internalGet (3));
+if (this.calsys.getYearFromFixedDate (fd) != y) {
+max--;
+}break;
+}case 4:
+{
+var dow = this.internalGet (7) - this.getFirstDayOfWeek ();
+if (dow < 0) {
+dow += 7;
+}var fd = this.getCurrentFixedDate ();
+var month1;
+var monthLength;
+month1 = fd - this.internalGet (5) + 1;
+monthLength = this.calsys.getMonthLength (this.cdate);
+var monthDay1st = jssun.util.calendar.AbstractCalendar.getDayOfWeekDateOnOrBefore (month1 + 6, this.getFirstDayOfWeek ());
+if ((monthDay1st - month1) >= this.getMinimalDaysInFirstWeek ()) {
+monthDay1st -= 7;
+}max = this.getActualMaximum (field);
+var value = java.util.GregorianCalendar.getRolledValue (this.internalGet (field), amount, 1, max) - 1;
+var nfd = monthDay1st + value * 7 + dow;
+if (nfd < month1) {
+nfd = month1;
+} else if (nfd >= (month1 + monthLength)) {
+nfd = month1 + monthLength - 1;
+}var dayOfMonth;
+dayOfMonth = (nfd - month1) + 1;
+this.set (5, dayOfMonth);
+return;
+}case 5:
+{
+max = this.calsys.getMonthLength (this.cdate);
+break;
+}case 6:
+{
+max = this.getActualMaximum (field);
+break;
+}case 7:
+{
+var weekOfYear = this.internalGet (3);
+this.set (3, weekOfYear);
+max = 7;
+break;
+}case 8:
+{
+min = 1;
+var dom = this.internalGet (5);
+var monthLength = this.calsys.getMonthLength (this.cdate);
+var lastDays = monthLength % 7;
+max = Clazz.doubleToInt (monthLength / 7);
+var x = (dom - 1) % 7;
+if (x < lastDays) {
+max++;
+}this.set (7, this.internalGet (7));
+break;
+}}
+this.set (field, java.util.GregorianCalendar.getRolledValue (this.internalGet (field), amount, min, max));
+}, "~N,~N");
+Clazz.overrideMethod (c$, "getMinimum", 
+function (field) {
+return java.util.GregorianCalendar.MIN_VALUES[field];
+}, "~N");
+Clazz.overrideMethod (c$, "getMaximum", 
+function (field) {
+switch (field) {
+case 2:
+case 5:
+case 6:
+case 3:
+case 4:
+case 8:
+case 1:
+{
+if (this.gregorianCutoverYear > 200) {
+break;
+}var gc = this.clone ();
+gc.setLenient (true);
+gc.setTimeInMillis (this.gregorianCutover);
+var v1 = gc.getActualMaximum (field);
+gc.setTimeInMillis (this.gregorianCutover - 1);
+var v2 = gc.getActualMaximum (field);
+return Math.max (java.util.GregorianCalendar.MAX_VALUES[field], Math.max (v1, v2));
+}}
+return java.util.GregorianCalendar.MAX_VALUES[field];
+}, "~N");
+Clazz.overrideMethod (c$, "getGreatestMinimum", 
+function (field) {
+return java.util.GregorianCalendar.MIN_VALUES[field];
+}, "~N");
+Clazz.overrideMethod (c$, "getLeastMaximum", 
+function (field) {
+switch (field) {
+case 2:
+case 5:
+case 6:
+case 3:
+case 4:
+case 8:
+case 1:
+{
+var gc = this.clone ();
+gc.setLenient (true);
+gc.setTimeInMillis (this.gregorianCutover);
+var v1 = gc.getActualMaximum (field);
+gc.setTimeInMillis (this.gregorianCutover - 1);
+var v2 = gc.getActualMaximum (field);
+return Math.min (java.util.GregorianCalendar.LEAST_MAX_VALUES[field], Math.min (v1, v2));
+}}
+return java.util.GregorianCalendar.LEAST_MAX_VALUES[field];
+}, "~N");
+Clazz.overrideMethod (c$, "getActualMinimum", 
+function (field) {
+if (field == 5) {
+}return this.getMinimum (field);
+}, "~N");
+Clazz.overrideMethod (c$, "getActualMaximum", 
+function (field) {
+var fieldsForFixedMax = 130689;
+if ((130689 & (1 << field)) != 0) {
+return this.getMaximum (field);
+}var gc = this.getNormalizedCalendar ();
+var date = gc.cdate;
+var cal = gc.calsys;
+var value = -1;
+var d;
+var dd;
+switch (field) {
+case 2:
+{
+}break;
+case 5:
+value = cal.getMonthLength (date);
+break;
+case 6:
+value = cal.getYearLength (date);
+break;
+case 3:
+{
+dd = cal.newCalendarDate (java.util.TimeZone.NO_TIMEZONE);
+dd.setDate (date.getYear (), 1, 1);
+var dayOfWeek = cal.getDayOfWeek (dd);
+dayOfWeek -= this.getFirstDayOfWeek ();
+if (dayOfWeek < 0) {
+dayOfWeek += 7;
+}value = 52;
+var magic = dayOfWeek + this.getMinimalDaysInFirstWeek () - 1;
+if ((magic == 6) || (date.isLeapYear () && (magic == 5 || magic == 12))) {
+value++;
+}}break;
+case 4:
+dd = cal.newCalendarDate (null);
+dd.setDate (date.getYear (), date.getMonth (), 1);
+var dayOfWeek = cal.getDayOfWeek (dd);
+var monthLength = cal.getMonthLength (dd);
+dayOfWeek -= this.getFirstDayOfWeek ();
+if (dayOfWeek < 0) {
+dayOfWeek += 7;
+}var nDaysFirstWeek = 7 - dayOfWeek;
+value = 3;
+if (nDaysFirstWeek >= this.getMinimalDaysInFirstWeek ()) {
+value++;
+}monthLength -= nDaysFirstWeek + 21;
+if (monthLength > 0) {
+value++;
+if (monthLength > 7) {
+value++;
+}}break;
+case 8:
+{
+var ndays;
+var dow1;
+var dow = date.getDayOfWeek ();
+d = date.clone ();
+ndays = cal.getMonthLength (d);
+d.setDayOfMonth (1);
+cal.normalize (d);
+dow1 = d.getDayOfWeek ();
+var x = dow - dow1;
+if (x < 0) {
+x += 7;
+}ndays -= x;
+value = Clazz.doubleToInt ((ndays + 6) / 7);
+}break;
+case 1:
+{
+if (gc === this) {
+gc = this.clone ();
+}var current = gc.getYearOffsetInMillis ();
+if (gc.internalGetEra () == 1) {
+gc.setTimeInMillis (9223372036854775807);
+value = gc.get (1);
+var maxEnd = gc.getYearOffsetInMillis ();
+if (current > maxEnd) {
+value--;
+}} else {
+var mincal = java.util.GregorianCalendar.gcal;
+dd = mincal.getCalendarDate (-9223372036854775808, this.getZone ());
+var maxEnd = (cal.getDayOfYear (dd) - 1) * 24 + dd.getHours ();
+maxEnd *= 60;
+maxEnd += dd.getMinutes ();
+maxEnd *= 60;
+maxEnd += dd.getSeconds ();
+maxEnd *= 1000;
+maxEnd += dd.getMillis ();
+value = dd.getYear ();
+if (value <= 0) {
+value = 1 - value;
+}if (current < maxEnd) {
+value--;
+}}}break;
+default:
+throw  new ArrayIndexOutOfBoundsException (field);
+}
+return value;
+}, "~N");
+Clazz.defineMethod (c$, "getYearOffsetInMillis", 
+ function () {
+var t = (this.internalGet (6) - 1) * 24;
+t += this.internalGet (11);
+t *= 60;
+t += this.internalGet (12);
+t *= 60;
+t += this.internalGet (13);
+t *= 1000;
+return t + this.internalGet (14) - (this.internalGet (15) + this.internalGet (16));
+});
+Clazz.defineMethod (c$, "clone", 
+function () {
+var other = Clazz.superCall (this, java.util.GregorianCalendar, "clone", []);
+other.gdate = this.gdate.clone ();
+if (this.cdate != null) {
+if (this.cdate !== this.gdate) {
+other.cdate = this.cdate.clone ();
+} else {
+other.cdate = other.gdate;
+}}other.originalFields = null;
+other.zoneOffsets = null;
+return other;
+});
+Clazz.defineMethod (c$, "getTimeZone", 
+function () {
+var zone = Clazz.superCall (this, java.util.GregorianCalendar, "getTimeZone", []);
+this.gdate.setZone (zone);
+if (this.cdate != null && this.cdate !== this.gdate) {
+this.cdate.setZone (zone);
+}return zone;
+});
+Clazz.defineMethod (c$, "setTimeZone", 
+function (zone) {
+Clazz.superCall (this, java.util.GregorianCalendar, "setTimeZone", [zone]);
+this.gdate.setZone (zone);
+if (this.cdate != null && this.cdate !== this.gdate) {
+this.cdate.setZone (zone);
+}}, "java.util.TimeZone");
+Clazz.defineMethod (c$, "computeFields", 
+function () {
+var mask = 0;
+if (this.isPartiallyNormalized ()) {
+mask = this.getSetStateFields ();
+var fieldMask = ~mask & 131071;
+if (fieldMask != 0 || this.calsys == null) {
+mask |= this.computeFields (fieldMask, mask & (98304));
+}} else {
+mask = 131071;
+this.computeFields (mask, 0);
+}this.setFieldsComputed (mask);
+});
+Clazz.defineMethod (c$, "computeFields", 
+ function (fieldMask, tzMask) {
+var zoneOffset = 0;
+var tz = this.getZone ();
+if (this.zoneOffsets == null) {
+this.zoneOffsets =  Clazz.newIntArray (2, 0);
+}if (tzMask != (98304)) {
+if (Clazz.instanceOf (tz, jssun.util.calendar.ZoneInfo)) {
+zoneOffset = (tz).getOffsets (this.time, this.zoneOffsets);
+} else {
+zoneOffset = tz.getOffset (this.time);
+this.zoneOffsets[0] = tz.getRawOffset ();
+this.zoneOffsets[1] = zoneOffset - this.zoneOffsets[0];
+}}if (tzMask != 0) {
+if (java.util.Calendar.isFieldSet (tzMask, 15)) {
+this.zoneOffsets[0] = this.internalGet (15);
+}if (java.util.Calendar.isFieldSet (tzMask, 16)) {
+this.zoneOffsets[1] = this.internalGet (16);
+}zoneOffset = this.zoneOffsets[0] + this.zoneOffsets[1];
+}var fixedDate = Clazz.doubleToInt (zoneOffset / 86400000);
+var timeOfDay = zoneOffset % 86400000;
+fixedDate += Clazz.doubleToInt (this.time / 86400000);
+timeOfDay += (this.time % 86400000);
+if (timeOfDay >= 86400000) {
+timeOfDay -= 86400000;
+++fixedDate;
+} else {
+while (timeOfDay < 0) {
+timeOfDay += 86400000;
+--fixedDate;
+}
+}fixedDate += 719163;
+var era = 1;
+var year;
+if (fixedDate != this.cachedFixedDate) {
+java.util.GregorianCalendar.gcal.getCalendarDateFromFixedDate (this.gdate, fixedDate);
+this.cachedFixedDate = fixedDate;
+}year = this.gdate.getYear ();
+if (year <= 0) {
+year = 1 - year;
+era = 0;
+}this.calsys = java.util.GregorianCalendar.gcal;
+this.cdate = this.gdate;
+this.internalSet (0, era);
+this.internalSet (1, year);
+var mask = fieldMask | (3);
+var month = this.cdate.getMonth () - 1;
+var dayOfMonth = this.cdate.getDayOfMonth ();
+if ((fieldMask & (164)) != 0) {
+this.internalSet (2, month);
+this.internalSet (5, dayOfMonth);
+this.internalSet (7, this.cdate.getDayOfWeek ());
+mask |= 164;
+}if ((fieldMask & (32256)) != 0) {
+if (timeOfDay != 0) {
+var hours = Clazz.doubleToInt (timeOfDay / 3600000);
+this.internalSet (11, hours);
+this.internalSet (9, Clazz.doubleToInt (hours / 12));
+this.internalSet (10, hours % 12);
+var r = timeOfDay % 3600000;
+this.internalSet (12, Clazz.doubleToInt (r / 60000));
+r %= 60000;
+this.internalSet (13, Clazz.doubleToInt (r / 1000));
+this.internalSet (14, r % 1000);
+} else {
+this.internalSet (11, 0);
+this.internalSet (9, 0);
+this.internalSet (10, 0);
+this.internalSet (12, 0);
+this.internalSet (13, 0);
+this.internalSet (14, 0);
+}mask |= (32256);
+}if ((fieldMask & (98304)) != 0) {
+this.internalSet (15, this.zoneOffsets[0]);
+this.internalSet (16, this.zoneOffsets[1]);
+mask |= (98304);
+}if ((fieldMask & (344)) != 0) {
+var normalizedYear = this.cdate.getNormalizedYear ();
+var fixedDateJan1 = this.calsys.getFixedDate (normalizedYear, 1, 1, this.cdate);
+var dayOfYear = (fixedDate - fixedDateJan1) + 1;
+var fixedDateMonth1 = fixedDate - dayOfMonth + 1;
+var cutoverYear = (this.calsys === java.util.GregorianCalendar.gcal) ? this.gregorianCutoverYear : this.gregorianCutoverYearJulian;
+var relativeDayOfMonth = dayOfMonth - 1;
+if (normalizedYear == cutoverYear) {
+var realDayOfYear = (fixedDate - fixedDateJan1) + 1;
+dayOfYear = realDayOfYear;
+relativeDayOfMonth = (fixedDate - fixedDateMonth1);
+}this.internalSet (6, dayOfYear);
+this.internalSet (8, Clazz.doubleToInt (relativeDayOfMonth / 7) + 1);
+var weekOfYear = this.getWeekNumber (fixedDateJan1, fixedDate);
+if (weekOfYear == 0) {
+var fixedDec31 = fixedDateJan1 - 1;
+var prevJan1;
+prevJan1 = fixedDateJan1 - 365;
+if (jssun.util.calendar.CalendarUtils.isGregorianLeapYear (normalizedYear - 1)) {
+--prevJan1;
+}weekOfYear = this.getWeekNumber (prevJan1, fixedDec31);
+} else {
+if (normalizedYear > this.gregorianCutoverYear || normalizedYear < (this.gregorianCutoverYearJulian - 1)) {
+if (weekOfYear >= 52) {
+var nextJan1 = fixedDateJan1 + 365;
+if (this.cdate.isLeapYear ()) {
+nextJan1++;
+}var nextJan1st = jssun.util.calendar.AbstractCalendar.getDayOfWeekDateOnOrBefore (nextJan1 + 6, this.getFirstDayOfWeek ());
+var ndays = (nextJan1st - nextJan1);
+if (ndays >= this.getMinimalDaysInFirstWeek () && fixedDate >= (nextJan1st - 7)) {
+weekOfYear = 1;
+}}} else {
+var calForJan1 = this.calsys;
+var nextYear = normalizedYear + 1;
+var nextJan1 = calForJan1.getFixedDate (nextYear, 1, 1, null);
+if (nextJan1 < fixedDate) {
+nextJan1 = this.gregorianCutoverDate;
+calForJan1 = java.util.GregorianCalendar.gcal;
+}var nextJan1st = jssun.util.calendar.AbstractCalendar.getDayOfWeekDateOnOrBefore (nextJan1 + 6, this.getFirstDayOfWeek ());
+var ndays = (nextJan1st - nextJan1);
+if (ndays >= this.getMinimalDaysInFirstWeek () && fixedDate >= (nextJan1st - 7)) {
+weekOfYear = 1;
+}}}this.internalSet (3, weekOfYear);
+this.internalSet (4, this.getWeekNumber (fixedDateMonth1, fixedDate));
+mask |= (344);
+}return mask;
+}, "~N,~N");
+Clazz.defineMethod (c$, "getWeekNumber", 
+ function (fixedDay1, fixedDate) {
+var fixedDay1st = jssun.util.calendar.AbstractCalendar.getDayOfWeekDateOnOrBefore (fixedDay1 + 6, this.getFirstDayOfWeek ());
+var ndays = (fixedDay1st - fixedDay1);
+if (ndays >= this.getMinimalDaysInFirstWeek ()) {
+fixedDay1st -= 7;
+}var normalizedDayOfPeriod = (fixedDate - fixedDay1st);
+if (normalizedDayOfPeriod >= 0) {
+return Clazz.doubleToInt (normalizedDayOfPeriod / 7) + 1;
+}return jssun.util.calendar.CalendarUtils.floorDivide (normalizedDayOfPeriod, 7) + 1;
+}, "~N,~N");
+Clazz.overrideMethod (c$, "computeTime", 
+function () {
+if (!this.isLenient ()) {
+if (this.originalFields == null) {
+this.originalFields =  Clazz.newIntArray (17, 0);
+}for (var field = 0; field < 17; field++) {
+var value = this.internalGet (field);
+if (this.isExternallySet (field)) {
+if (value < this.getMinimum (field) || value > this.getMaximum (field)) {
+throw  new IllegalArgumentException (java.util.Calendar.getFieldName (field));
+}}this.originalFields[field] = value;
+}
+}var fieldMask = this.selectFields ();
+var year = this.isSet (1) ? this.internalGet (1) : 1970;
+var era = this.internalGetEra ();
+if (era == 0) {
+year = 1 - year;
+} else if (era != 1) {
+throw  new IllegalArgumentException ("Invalid era");
+}if (year <= 0 && !this.isSet (0)) {
+fieldMask |= 1;
+this.setFieldsComputed (1);
+}var timeOfDay = 0;
+if (java.util.Calendar.isFieldSet (fieldMask, 11)) {
+timeOfDay += this.internalGet (11);
+} else {
+timeOfDay += this.internalGet (10);
+if (java.util.Calendar.isFieldSet (fieldMask, 9)) {
+timeOfDay += 12 * this.internalGet (9);
+}}timeOfDay *= 60;
+timeOfDay += this.internalGet (12);
+timeOfDay *= 60;
+timeOfDay += this.internalGet (13);
+timeOfDay *= 1000;
+timeOfDay += this.internalGet (14);
+var fixedDate = Clazz.doubleToInt (timeOfDay / 86400000);
+timeOfDay %= 86400000;
+while (timeOfDay < 0) {
+timeOfDay += 86400000;
+--fixedDate;
+}
+calculateFixedDate : {
+var gfd;
+gfd = fixedDate + this.getFixedDate (java.util.GregorianCalendar.gcal, year, fieldMask);
+fixedDate = gfd;
+break calculateFixedDate;
+}var millis = (fixedDate - 719163) * 86400000 + timeOfDay;
+var zone = this.getZone ();
+if (this.zoneOffsets == null) {
+this.zoneOffsets =  Clazz.newIntArray (2, 0);
+}var tzMask = fieldMask & (98304);
+if (tzMask != (98304)) {
+if (Clazz.instanceOf (zone, jssun.util.calendar.ZoneInfo)) {
+(zone).getOffsetsByWall (millis, this.zoneOffsets);
+} else {
+var gmtOffset = java.util.Calendar.isFieldSet (fieldMask, 15) ? this.internalGet (15) : zone.getRawOffset ();
+zone.getOffsets (millis - gmtOffset, this.zoneOffsets);
+}}if (tzMask != 0) {
+if (java.util.Calendar.isFieldSet (tzMask, 15)) {
+this.zoneOffsets[0] = this.internalGet (15);
+}if (java.util.Calendar.isFieldSet (tzMask, 16)) {
+this.zoneOffsets[1] = this.internalGet (16);
+}}millis -= this.zoneOffsets[0] + this.zoneOffsets[1];
+this.time = millis;
+var mask = this.computeFields (fieldMask | this.getSetStateFields (), tzMask);
+if (!this.isLenient ()) {
+for (var field = 0; field < 17; field++) {
+if (!this.isExternallySet (field)) {
+continue;
+}if (this.originalFields[field] != this.internalGet (field)) {
+System.arraycopy (this.originalFields, 0, this.fields, 0, this.fields.length);
+throw  new IllegalArgumentException (java.util.Calendar.getFieldName (field));
+}}
+}this.setFieldsNormalized (mask);
+});
+Clazz.defineMethod (c$, "getFixedDate", 
+ function (cal, year, fieldMask) {
+var month = 0;
+if (java.util.Calendar.isFieldSet (fieldMask, 2)) {
+month = this.internalGet (2);
+if (month > 11) {
+year += Clazz.doubleToInt (month / 12);
+month %= 12;
+} else if (month < 0) {
+var rem =  Clazz.newIntArray (1, 0);
+year += jssun.util.calendar.CalendarUtils.floorDivide (month, 12, rem);
+month = rem[0];
+}}var fixedDate = cal.getFixedDate (year, month + 1, 1, cal === java.util.GregorianCalendar.gcal ? this.gdate : null);
+if (java.util.Calendar.isFieldSet (fieldMask, 2)) {
+if (java.util.Calendar.isFieldSet (fieldMask, 5)) {
+if (this.isSet (5)) {
+fixedDate += this.internalGet (5);
+fixedDate--;
+}} else {
+if (java.util.Calendar.isFieldSet (fieldMask, 4)) {
+var firstDayOfWeek = jssun.util.calendar.AbstractCalendar.getDayOfWeekDateOnOrBefore (fixedDate + 6, this.getFirstDayOfWeek ());
+if ((firstDayOfWeek - fixedDate) >= this.getMinimalDaysInFirstWeek ()) {
+firstDayOfWeek -= 7;
+}if (java.util.Calendar.isFieldSet (fieldMask, 7)) {
+firstDayOfWeek = jssun.util.calendar.AbstractCalendar.getDayOfWeekDateOnOrBefore (firstDayOfWeek + 6, this.internalGet (7));
+}fixedDate = firstDayOfWeek + 7 * (this.internalGet (4) - 1);
+} else {
+var dayOfWeek;
+if (java.util.Calendar.isFieldSet (fieldMask, 7)) {
+dayOfWeek = this.internalGet (7);
+} else {
+dayOfWeek = this.getFirstDayOfWeek ();
+}var dowim;
+if (java.util.Calendar.isFieldSet (fieldMask, 8)) {
+dowim = this.internalGet (8);
+} else {
+dowim = 1;
+}if (dowim >= 0) {
+fixedDate = jssun.util.calendar.AbstractCalendar.getDayOfWeekDateOnOrBefore (fixedDate + (7 * dowim) - 1, dayOfWeek);
+} else {
+var lastDate = this.monthLength (month, year) + (7 * (dowim + 1));
+fixedDate = jssun.util.calendar.AbstractCalendar.getDayOfWeekDateOnOrBefore (fixedDate + lastDate - 1, dayOfWeek);
+}}}} else {
+if (year == this.gregorianCutoverYear && cal === java.util.GregorianCalendar.gcal && fixedDate < this.gregorianCutoverDate && this.gregorianCutoverYear != this.gregorianCutoverYearJulian) {
+fixedDate = this.gregorianCutoverDate;
+}if (java.util.Calendar.isFieldSet (fieldMask, 6)) {
+fixedDate += this.internalGet (6);
+fixedDate--;
+} else {
+var firstDayOfWeek = jssun.util.calendar.AbstractCalendar.getDayOfWeekDateOnOrBefore (fixedDate + 6, this.getFirstDayOfWeek ());
+if ((firstDayOfWeek - fixedDate) >= this.getMinimalDaysInFirstWeek ()) {
+firstDayOfWeek -= 7;
+}if (java.util.Calendar.isFieldSet (fieldMask, 7)) {
+var dayOfWeek = this.internalGet (7);
+if (dayOfWeek != this.getFirstDayOfWeek ()) {
+firstDayOfWeek = jssun.util.calendar.AbstractCalendar.getDayOfWeekDateOnOrBefore (firstDayOfWeek + 6, dayOfWeek);
+}}fixedDate = firstDayOfWeek + 7 * (this.internalGet (3) - 1);
+}}return fixedDate;
+}, "jssun.util.calendar.BaseCalendar,~N,~N");
+Clazz.defineMethod (c$, "getNormalizedCalendar", 
+ function () {
+var gc;
+if (this.isFullyNormalized ()) {
+gc = this;
+} else {
+gc = this.clone ();
+gc.setLenient (true);
+gc.complete ();
+}return gc;
+});
+Clazz.defineMethod (c$, "getCalendarDate", 
+ function (fd) {
+var cal = java.util.GregorianCalendar.gcal;
+var d = cal.newCalendarDate (java.util.TimeZone.NO_TIMEZONE);
+cal.getCalendarDateFromFixedDate (d, fd);
+return d;
+}, "~N");
+Clazz.defineMethod (c$, "monthLength", 
+ function (month, year) {
+return this.isLeapYear (year) ? java.util.GregorianCalendar.LEAP_MONTH_LENGTH[month] : java.util.GregorianCalendar.MONTH_LENGTH[month];
+}, "~N,~N");
+Clazz.defineMethod (c$, "monthLength", 
+ function (month) {
+var year = this.internalGet (1);
+if (this.internalGetEra () == 0) {
+year = 1 - year;
+}return this.monthLength (month, year);
+}, "~N");
+Clazz.defineMethod (c$, "pinDayOfMonth", 
+ function () {
+var year = this.internalGet (1);
+var monthLen;
+if (year > this.gregorianCutoverYear || year < this.gregorianCutoverYearJulian) {
+monthLen = this.monthLength (this.internalGet (2));
+} else {
+var gc = this.getNormalizedCalendar ();
+monthLen = gc.getActualMaximum (5);
+}var dom = this.internalGet (5);
+if (dom > monthLen) {
+this.set (5, monthLen);
+}});
+Clazz.defineMethod (c$, "getCurrentFixedDate", 
+ function () {
+return (this.calsys === java.util.GregorianCalendar.gcal) ? this.cachedFixedDate : this.calsys.getFixedDate (this.cdate);
+});
+c$.getRolledValue = Clazz.defineMethod (c$, "getRolledValue", 
+ function (value, amount, min, max) {
+var range = max - min + 1;
+amount %= range;
+var n = value + amount;
+if (n > max) {
+n -= range;
+} else if (n < min) {
+n += range;
+}return n;
+}, "~N,~N,~N,~N");
+Clazz.defineMethod (c$, "internalGetEra", 
+ function () {
+return this.isSet (0) ? this.internalGet (0) : 1;
+});
+Clazz.defineStatics (c$,
+"BC", 0,
+"BCE", 0,
+"AD", 1,
+"CE", 1,
+"EPOCH_OFFSET", 719163,
+"EPOCH_YEAR", 1970,
+"MONTH_LENGTH",  Clazz.newIntArray (-1, [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]),
+"LEAP_MONTH_LENGTH",  Clazz.newIntArray (-1, [31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]),
+"ONE_SECOND", 1000,
+"ONE_MINUTE", 60000,
+"ONE_HOUR", 3600000,
+"ONE_DAY", 86400000,
+"MIN_VALUES",  Clazz.newIntArray (-1, [0, 1, 0, 1, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, -46800000, 0]),
+"LEAST_MAX_VALUES",  Clazz.newIntArray (-1, [1, 292269054, 11, 52, 4, 28, 365, 7, 4, 1, 11, 23, 59, 59, 999, 50400000, 1200000]),
+"MAX_VALUES",  Clazz.newIntArray (-1, [1, 292278994, 11, 53, 6, 31, 366, 7, 6, 1, 11, 23, 59, 59, 999, 50400000, 7200000]));
+c$.gcal = c$.prototype.gcal = jssun.util.calendar.CalendarSystem.getGregorianCalendar ();
+Clazz.defineStatics (c$,
+"DEFAULT_GREGORIAN_CUTOVER", -12219292800000);
+});