1 Clazz.declarePackage ("jssun.util.calendar");
\r
2 Clazz.load (null, "jssun.util.calendar.Era", ["java.lang.StringBuilder", "jssun.util.calendar.CalendarSystem", "$.ImmutableGregorianDate"], function () {
\r
3 c$ = Clazz.decorateAsClass (function () {
\r
7 this.sinceDate = null;
\r
8 this.localTime = false;
\r
10 Clazz.instantialize (this, arguments);
\r
11 }, jssun.util.calendar, "Era");
\r
12 Clazz.makeConstructor (c$,
\r
13 function (name, abbr, since, localTime) {
\r
17 this.localTime = localTime;
\r
18 var gcal = jssun.util.calendar.CalendarSystem.getGregorianCalendar ();
\r
19 var d = gcal.newCalendarDate (null);
\r
20 gcal.getCalendarDate (since, d);
\r
21 this.sinceDate = new jssun.util.calendar.ImmutableGregorianDate (d);
\r
23 Clazz.defineMethod (c$, "getName",
\r
27 Clazz.defineMethod (c$, "getDisplayName",
\r
30 }, "java.util.Locale");
\r
31 Clazz.defineMethod (c$, "getAbbreviation",
\r
35 Clazz.defineMethod (c$, "getDiaplayAbbreviation",
\r
38 }, "java.util.Locale");
\r
39 Clazz.defineMethod (c$, "getSince",
\r
41 if (zone == null || !this.localTime) {
\r
43 }var offset = zone.getOffset (this.since);
\r
44 return this.since - offset;
\r
45 }, "java.util.TimeZone");
\r
46 Clazz.defineMethod (c$, "getSinceDate",
\r
48 return this.sinceDate;
\r
50 Clazz.defineMethod (c$, "isLocalTime",
\r
52 return this.localTime;
\r
54 Clazz.overrideMethod (c$, "equals",
\r
56 if (!(Clazz.instanceOf (o, jssun.util.calendar.Era))) {
\r
59 return this.name.equals (that.name) && this.abbr.equals (that.abbr) && this.since == that.since && this.localTime == that.localTime;
\r
61 Clazz.overrideMethod (c$, "hashCode",
\r
63 if (this.hash == 0) {
\r
64 this.hash = this.name.hashCode () ^ this.abbr.hashCode () ^ this.since ^ (this.since >> 32) ^ (this.localTime ? 1 : 0);
\r
67 Clazz.overrideMethod (c$, "toString",
\r
69 var sb = new StringBuilder ();
\r
71 sb.append (this.getName ()).append (" (");
\r
72 sb.append (this.getAbbreviation ()).append (')');
\r
73 sb.append (" since ").append (this.getSinceDate ());
\r
74 if (this.localTime) {
\r
75 sb.setLength (sb.length () - 1);
\r
76 sb.append (" local time");
\r
78 return sb.toString ();
\r