1 Clazz.declarePackage ("jssun.util.calendar");
2 Clazz.load (null, "jssun.util.calendar.CalendarDate", ["java.lang.InternalError", "$.StringBuilder", "java.util.TimeZone", "jssun.util.calendar.CalendarUtils"], function () {
3 c$ = Clazz.decorateAsClass (function () {
8 this.dayOfWeek = -2147483648;
15 this.normalized = false;
18 this.daylightSaving = 0;
19 this.forceStandardTime = false;
21 Clazz.instantialize (this, arguments);
22 }, jssun.util.calendar, "CalendarDate", null, Cloneable);
23 Clazz.makeConstructor (c$,
25 this.construct (java.util.TimeZone.getDefault ());
27 Clazz.makeConstructor (c$,
30 }, "java.util.TimeZone");
31 Clazz.defineMethod (c$, "getEra",
35 Clazz.defineMethod (c$, "setEra",
37 if (this.era === era) {
40 this.normalized = false;
42 }, "jssun.util.calendar.Era");
43 Clazz.defineMethod (c$, "getYear",
47 Clazz.defineMethod (c$, "setYear",
49 if (this.year != year) {
51 this.normalized = false;
54 Clazz.defineMethod (c$, "addYear",
58 this.normalized = false;
61 Clazz.defineMethod (c$, "isLeapYear",
65 Clazz.defineMethod (c$, "setLeapYear",
67 this.leapYear = leapYear;
69 Clazz.defineMethod (c$, "getMonth",
73 Clazz.defineMethod (c$, "setMonth",
75 if (this.month != month) {
77 this.normalized = false;
80 Clazz.defineMethod (c$, "addMonth",
84 this.normalized = false;
87 Clazz.defineMethod (c$, "getDayOfMonth",
89 return this.dayOfMonth;
91 Clazz.defineMethod (c$, "setDayOfMonth",
93 if (this.dayOfMonth != date) {
94 this.dayOfMonth = date;
95 this.normalized = false;
98 Clazz.defineMethod (c$, "addDayOfMonth",
101 this.dayOfMonth += n;
102 this.normalized = false;
105 Clazz.defineMethod (c$, "getDayOfWeek",
107 if (!this.isNormalized ()) {
108 this.dayOfWeek = -2147483648;
109 }return this.dayOfWeek;
111 Clazz.defineMethod (c$, "getHours",
115 Clazz.defineMethod (c$, "setHours",
117 if (this.hours != hours) {
119 this.normalized = false;
122 Clazz.defineMethod (c$, "addHours",
126 this.normalized = false;
129 Clazz.defineMethod (c$, "getMinutes",
133 Clazz.defineMethod (c$, "setMinutes",
135 if (this.minutes != minutes) {
136 this.minutes = minutes;
137 this.normalized = false;
140 Clazz.defineMethod (c$, "addMinutes",
144 this.normalized = false;
147 Clazz.defineMethod (c$, "getSeconds",
151 Clazz.defineMethod (c$, "setSeconds",
153 if (this.seconds != seconds) {
154 this.seconds = seconds;
155 this.normalized = false;
158 Clazz.defineMethod (c$, "addSeconds",
162 this.normalized = false;
165 Clazz.defineMethod (c$, "getMillis",
169 Clazz.defineMethod (c$, "setMillis",
171 if (this.millis != millis) {
172 this.millis = millis;
173 this.normalized = false;
176 Clazz.defineMethod (c$, "addMillis",
180 this.normalized = false;
183 Clazz.defineMethod (c$, "getTimeOfDay",
185 if (!this.isNormalized ()) {
186 return this.fraction = -9223372036854775808;
187 }return this.fraction;
189 Clazz.defineMethod (c$, "setDate",
190 function (year, month, dayOfMonth) {
192 this.setMonth (month);
193 this.setDayOfMonth (dayOfMonth);
196 Clazz.defineMethod (c$, "addDate",
197 function (year, month, dayOfMonth) {
199 this.addMonth (month);
200 this.addDayOfMonth (dayOfMonth);
203 Clazz.defineMethod (c$, "setTimeOfDay",
204 function (hours, minutes, seconds, millis) {
205 this.setHours (hours);
206 this.setMinutes (minutes);
207 this.setSeconds (seconds);
208 this.setMillis (millis);
211 Clazz.defineMethod (c$, "addTimeOfDay",
212 function (hours, minutes, seconds, millis) {
213 this.addHours (hours);
214 this.addMinutes (minutes);
215 this.addSeconds (seconds);
216 this.addMillis (millis);
219 Clazz.defineMethod (c$, "setTimeOfDay",
220 function (fraction) {
221 this.fraction = fraction;
223 Clazz.defineMethod (c$, "isNormalized",
225 return this.normalized;
227 Clazz.defineMethod (c$, "isStandardTime",
229 return this.forceStandardTime;
231 Clazz.defineMethod (c$, "setStandardTime",
232 function (standardTime) {
233 this.forceStandardTime = standardTime;
235 Clazz.defineMethod (c$, "isDaylightTime",
237 if (this.isStandardTime ()) {
239 }return this.daylightSaving != 0;
241 Clazz.defineMethod (c$, "setLocale",
244 }, "java.util.Locale");
245 Clazz.defineMethod (c$, "getZone",
247 return this.zoneinfo;
249 Clazz.defineMethod (c$, "setZone",
250 function (zoneinfo) {
251 this.zoneinfo = zoneinfo;
253 }, "java.util.TimeZone");
254 Clazz.defineMethod (c$, "isSameDate",
256 return this.getDayOfWeek () == date.getDayOfWeek () && this.getMonth () == date.getMonth () && this.getYear () == date.getYear () && this.getEra () === date.getEra ();
257 }, "jssun.util.calendar.CalendarDate");
258 Clazz.defineMethod (c$, "equals",
260 if (!(Clazz.instanceOf (obj, jssun.util.calendar.CalendarDate))) {
263 if (this.isNormalized () != that.isNormalized ()) {
265 }var hasZone = this.zoneinfo != null;
266 var thatHasZone = that.zoneinfo != null;
267 if (hasZone != thatHasZone) {
269 }if (hasZone && !this.zoneinfo.equals (that.zoneinfo)) {
271 }return (this.getEra () === that.getEra () && this.year == that.year && this.month == that.month && this.dayOfMonth == that.dayOfMonth && this.hours == that.hours && this.minutes == that.minutes && this.seconds == that.seconds && this.millis == that.millis && this.zoneOffset == that.zoneOffset);
273 Clazz.defineMethod (c$, "hashCode",
275 var hash = (((((this.year - 1970) * 12) + (this.month - 1)) * 30) + this.dayOfMonth) * 24;
276 hash = ((((((hash + this.hours) * 60) + this.minutes) * 60) + this.seconds) * 1000) + this.millis;
277 hash -= this.zoneOffset;
278 var normalized = this.isNormalized () ? 1 : 0;
280 var e = this.getEra ();
283 }var zone = this.zoneinfo != null ? this.zoneinfo.hashCode () : 0;
284 return hash * (hash >> 32) ^ era ^ normalized ^ zone;
286 Clazz.defineMethod (c$, "clone",
289 return Clazz.superCall (this, jssun.util.calendar.CalendarDate, "clone", []);
291 if (Clazz.exceptionOf (e, CloneNotSupportedException)) {
292 throw new InternalError ();
298 Clazz.overrideMethod (c$, "toString",
300 var sb = new StringBuilder ();
301 jssun.util.calendar.CalendarUtils.sprintf0d (sb, this.year, 4).append ('-');
302 jssun.util.calendar.CalendarUtils.sprintf0d (sb, this.month, 2).append ('-');
303 jssun.util.calendar.CalendarUtils.sprintf0d (sb, this.dayOfMonth, 2).append ('T');
304 jssun.util.calendar.CalendarUtils.sprintf0d (sb, this.hours, 2).append (':');
305 jssun.util.calendar.CalendarUtils.sprintf0d (sb, this.minutes, 2).append (':');
306 jssun.util.calendar.CalendarUtils.sprintf0d (sb, this.seconds, 2).append ('.');
307 jssun.util.calendar.CalendarUtils.sprintf0d (sb, this.millis, 3);
308 if (this.zoneOffset == 0) {
310 } else if (this.zoneOffset != -2147483648) {
313 if (this.zoneOffset > 0) {
314 offset = this.zoneOffset;
317 offset = -this.zoneOffset;
319 }offset = Clazz.doubleToInt (offset / 60000);
321 jssun.util.calendar.CalendarUtils.sprintf0d (sb, Clazz.doubleToInt (offset / 60), 2);
322 jssun.util.calendar.CalendarUtils.sprintf0d (sb, offset % 60, 2);
324 sb.append (" local time");
325 }return sb.toString ();
327 Clazz.defineMethod (c$, "setDayOfWeek",
328 function (dayOfWeek) {
329 this.dayOfWeek = dayOfWeek;
331 Clazz.defineMethod (c$, "setNormalized",
332 function (normalized) {
333 this.normalized = normalized;
335 Clazz.defineMethod (c$, "getZoneOffset",
337 return this.zoneOffset;
339 Clazz.defineMethod (c$, "setZoneOffset",
341 this.zoneOffset = offset;
343 Clazz.defineMethod (c$, "getDaylightSaving",
345 return this.daylightSaving;
347 Clazz.defineMethod (c$, "setDaylightSaving",
348 function (daylightSaving) {
349 this.daylightSaving = daylightSaving;
351 Clazz.defineStatics (c$,
352 "FIELD_UNDEFINED", -2147483648,
353 "TIME_UNDEFINED", -9223372036854775808);