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