Merge branch 'master' of https://source.jalview.org/git/jalviewjs.git
[jalviewjs.git] / site / swingjs / j2s / java / util / TimeZone.js
index 5ffe33b..f1cecf0 100644 (file)
-Clazz.declarePackage ("java.util");\r
-Clazz.load (null, "java.util.TimeZone", ["java.lang.InternalError", "$.NullPointerException", "java.util.Date", "$.HashMap"], function () {\r
-c$ = Clazz.decorateAsClass (function () {\r
-this.ID = "GMT";\r
-Clazz.instantialize (this, arguments);\r
-}, java.util, "TimeZone", null, Cloneable);\r
-Clazz.makeConstructor (c$, \r
-function () {\r
-});\r
-Clazz.defineMethod (c$, "getOffset", \r
-function (date) {\r
-if (this.inDaylightTime ( new java.util.Date (date))) {\r
-return this.getRawOffset () + this.getDSTSavings ();\r
-}return this.getRawOffset ();\r
-}, "~N");\r
-Clazz.defineMethod (c$, "getOffsets", \r
-function (date, offsets) {\r
-var rawoffset = this.getRawOffset ();\r
-var dstoffset = 0;\r
-if (this.inDaylightTime ( new java.util.Date (date))) {\r
-dstoffset = this.getDSTSavings ();\r
-}if (offsets != null) {\r
-offsets[0] = rawoffset;\r
-offsets[1] = dstoffset;\r
-}return rawoffset + dstoffset;\r
-}, "~N,~A");\r
-Clazz.defineMethod (c$, "getID", \r
-function () {\r
-return this.ID;\r
-});\r
-Clazz.defineMethod (c$, "setID", \r
-function (ID) {\r
-if (ID == null) {\r
-throw  new NullPointerException ();\r
-}this.ID = ID;\r
-}, "~S");\r
-Clazz.defineMethod (c$, "getDSTSavings", \r
-function () {\r
-if (this.useDaylightTime ()) {\r
-return 3600000;\r
-}return 0;\r
-});\r
-c$.getTimeZone = Clazz.defineMethod (c$, "getTimeZone", \r
-function (ID) {\r
-return java.util.TimeZone.getTimeZone (ID, true);\r
-}, "~S");\r
-c$.getTimeZone = Clazz.defineMethod (c$, "getTimeZone", \r
- function (ID, fallback) {\r
-var tz = null;\r
-tz = java.util.TimeZone.parseCustomTimeZone (ID);\r
-if (tz == null && fallback) {\r
-tz =  new jssun.util.calendar.ZoneInfo ("GMT", 0);\r
-}return tz;\r
-}, "~S,~B");\r
-c$.getAvailableIDs = Clazz.defineMethod (c$, "getAvailableIDs", \r
-function (rawOffset) {\r
-return null;\r
-}, "~N");\r
-c$.getAvailableIDs = Clazz.defineMethod (c$, "getAvailableIDs", \r
-function () {\r
-return null;\r
-});\r
-c$.getDefault = Clazz.defineMethod (c$, "getDefault", \r
-function () {\r
-return java.util.TimeZone.getDefaultRef ().clone ();\r
-});\r
-c$.getDefaultRef = Clazz.defineMethod (c$, "getDefaultRef", \r
-function () {\r
-if (java.util.TimeZone.defaultTimeZone == null) {\r
-var ms = java.util.TimeZone.getTimeZoneOffsetMillis ();\r
-var gmtOffsetID = java.util.TimeZone.getGMTID (ms);\r
-java.util.TimeZone.defaultTimeZone = java.util.TimeZone.getTimeZone (gmtOffsetID, true);\r
-java.util.TimeZone.addToCache (gmtOffsetID,  new jssun.util.calendar.ZoneInfo (gmtOffsetID, ms));\r
-}return java.util.TimeZone.defaultTimeZone;\r
-});\r
-c$.getTimeZoneOffsetMillis = Clazz.defineMethod (c$, "getTimeZoneOffsetMillis", \r
- function () {\r
-{\r
-return -(new Date()).getTimezoneOffset() * 60000;\r
-}});\r
-c$.setDefault = Clazz.defineMethod (c$, "setDefault", \r
-function (zone) {\r
-}, "java.util.TimeZone");\r
-Clazz.defineMethod (c$, "hasSameRules", \r
-function (other) {\r
-return other != null && this.getRawOffset () == other.getRawOffset () && this.useDaylightTime () == other.useDaylightTime ();\r
-}, "java.util.TimeZone");\r
-Clazz.defineMethod (c$, "clone", \r
-function () {\r
-try {\r
-var other = Clazz.superCall (this, java.util.TimeZone, "clone", []);\r
-other.ID = this.ID;\r
-return other;\r
-} catch (e) {\r
-if (Clazz.exceptionOf (e, CloneNotSupportedException)) {\r
-throw  new InternalError ();\r
-} else {\r
-throw e;\r
-}\r
-}\r
-});\r
-c$.parseCustomTimeZone = Clazz.defineMethod (c$, "parseCustomTimeZone", \r
- function (id) {\r
-if ((id.length) < (5) || id.indexOf ("GMT") != 0) {\r
-return null;\r
-}var zi;\r
-var neghrmin = java.util.TimeZone.getOffsetHHMM (id);\r
-if (neghrmin == null) return null;\r
-var gmtOffset = (neghrmin[0]) * (neghrmin[1] * 60 + neghrmin[2]) * 60 * 1000;\r
-var gmtID = java.util.TimeZone.getGMTID (gmtOffset);\r
-zi =  new jssun.util.calendar.ZoneInfo ();\r
-if (gmtOffset == 0) {\r
-} else {\r
-zi.setRawOffsetReally (gmtOffset);\r
-}zi.setID (gmtID);\r
-return zi;\r
-}, "~S");\r
-c$.getOffsetHHMM = Clazz.defineMethod (c$, "getOffsetHHMM", \r
- function (id) {\r
-var index = 3;\r
-var length = id.length;\r
-var negative = false;\r
-var c = id.charAt (index++);\r
-if (c == '-') {\r
-negative = true;\r
-} else if (c != '+') {\r
-return null;\r
-}var hours = 0;\r
-var num = 0;\r
-var countDelim = 0;\r
-var len = 0;\r
-while (index < length) {\r
-c = id.charAt (index++);\r
-if (c == ':') {\r
-if (countDelim > 0) {\r
-return null;\r
-}if (len > 2) {\r
-return null;\r
-}hours = num;\r
-countDelim++;\r
-num = 0;\r
-len = 0;\r
-continue;\r
-}if (c < '0' || c > '9') {\r
-return null;\r
-}num = num * 10 + (c.charCodeAt (0) - 48);\r
-len++;\r
-}\r
-if (index != length) {\r
-return null;\r
-}if (countDelim == 0) {\r
-if (len <= 2) {\r
-hours = num;\r
-num = 0;\r
-} else {\r
-hours = Clazz.doubleToInt (num / 100);\r
-num %= 100;\r
-}} else {\r
-if (len != 2) {\r
-return null;\r
-}}if (hours > 23 || num > 59) {\r
-return null;\r
-}return  Clazz.newIntArray (-1, [(negative ? -1 : 1), hours, num]);\r
-}, "~S");\r
-c$.getGMTID = Clazz.defineMethod (c$, "getGMTID", \r
- function (gmtOffset) {\r
-var isNegative = (gmtOffset < 0);\r
-if (isNegative) gmtOffset = -gmtOffset;\r
-gmtOffset = Clazz.doubleToInt (gmtOffset / 60000);\r
-var hours = Clazz.doubleToInt (gmtOffset / 60);\r
-var min = gmtOffset - hours * 60;\r
-var NN = "00" + hours;\r
-NN = NN.substring (NN.length - 2);\r
-var MM = "00" + min;\r
-MM = MM.substring (MM.length - 2);\r
-return "GMT" + (isNegative ? "-" : "") + NN;\r
-}, "~N");\r
-c$.getCustomTimeZone = Clazz.defineMethod (c$, "getCustomTimeZone", \r
-function (originalId, gmtOffset) {\r
-var id = java.util.TimeZone.toCustomID (gmtOffset);\r
-var zi = java.util.TimeZone.getFromCache (id);\r
-if (zi == null) {\r
-zi =  new jssun.util.calendar.ZoneInfo (id, gmtOffset);\r
-zi = java.util.TimeZone.addToCache (id, zi);\r
-if (originalId != null && !id.equals (originalId)) {\r
-zi = java.util.TimeZone.addToCache (originalId, zi);\r
-}}return zi.clone ();\r
-}, "~S,~N");\r
-c$.toCustomID = Clazz.defineMethod (c$, "toCustomID", \r
-function (gmtOffset) {\r
-var sign;\r
-var offset = Clazz.doubleToInt (gmtOffset / 60000);\r
-if (offset >= 0) {\r
-sign = '+';\r
-} else {\r
-sign = '-';\r
-offset = -offset;\r
-}var hh = Clazz.doubleToInt (offset / 60);\r
-var mm = offset % 60;\r
-var buf =  Clazz.newCharArray (-1, ['G', 'M', 'T', sign, '0', '0', ':', '0', '0']);\r
-if (hh >= 10) {\r
-buf[4] = String.fromCharCode ((buf[4]).charCodeAt (0) + (Clazz.doubleToInt (hh / 10)));\r
-}buf[5] = String.fromCharCode ((buf[5]).charCodeAt (0) + (hh % 10));\r
-if (mm != 0) {\r
-buf[7] = String.fromCharCode ((buf[7]).charCodeAt (0) + (Clazz.doubleToInt (mm / 10)));\r
-buf[8] = String.fromCharCode ((buf[8]).charCodeAt (0) + (mm % 10));\r
-}return  String.instantialize (buf);\r
-}, "~N");\r
-c$.getFromCache = Clazz.defineMethod (c$, "getFromCache", \r
-function (id) {\r
-if (java.util.TimeZone.zoneInfoObjects == null) {\r
-return null;\r
-}return java.util.TimeZone.zoneInfoObjects.get (id);\r
-}, "~S");\r
-c$.addToCache = Clazz.defineMethod (c$, "addToCache", \r
-function (id, zi) {\r
-if (java.util.TimeZone.zoneInfoObjects == null) {\r
-java.util.TimeZone.zoneInfoObjects =  new java.util.HashMap ();\r
-} else {\r
-var zone = java.util.TimeZone.zoneInfoObjects.get (id);\r
-if (zone != null) {\r
-return zone;\r
-}}java.util.TimeZone.zoneInfoObjects.put (id, zi);\r
-return zi;\r
-}, "~S,jssun.util.calendar.ZoneInfo");\r
-Clazz.defineStatics (c$,\r
-"SHORT", 0,\r
-"LONG", 1,\r
-"NO_TIMEZONE", null,\r
-"defaultTimeZone", null,\r
-"GMT_ID", "GMT",\r
-"GMT_ID_LENGTH", 3,\r
-"zoneInfoObjects", null);\r
-});\r
+Clazz.declarePackage ("java.util");
+Clazz.load (null, "java.util.TimeZone", ["java.lang.InternalError", "$.NullPointerException", "java.util.Date", "$.HashMap"], function () {
+c$ = Clazz.decorateAsClass (function () {
+this.ID = "GMT";
+Clazz.instantialize (this, arguments);
+}, java.util, "TimeZone", null, Cloneable);
+Clazz.makeConstructor (c$, 
+function () {
+});
+Clazz.defineMethod (c$, "getOffset", 
+function (date) {
+if (this.inDaylightTime ( new java.util.Date (date))) {
+return this.getRawOffset () + this.getDSTSavings ();
+}return this.getRawOffset ();
+}, "~N");
+Clazz.defineMethod (c$, "getOffsets", 
+function (date, offsets) {
+var rawoffset = this.getRawOffset ();
+var dstoffset = 0;
+if (this.inDaylightTime ( new java.util.Date (date))) {
+dstoffset = this.getDSTSavings ();
+}if (offsets != null) {
+offsets[0] = rawoffset;
+offsets[1] = dstoffset;
+}return rawoffset + dstoffset;
+}, "~N,~A");
+Clazz.defineMethod (c$, "getID", 
+function () {
+return this.ID;
+});
+Clazz.defineMethod (c$, "setID", 
+function (ID) {
+if (ID == null) {
+throw  new NullPointerException ();
+}this.ID = ID;
+}, "~S");
+Clazz.defineMethod (c$, "getDSTSavings", 
+function () {
+if (this.useDaylightTime ()) {
+return 3600000;
+}return 0;
+});
+c$.getTimeZone = Clazz.defineMethod (c$, "getTimeZone", 
+function (ID) {
+return java.util.TimeZone.getTimeZone (ID, true);
+}, "~S");
+c$.getTimeZone = Clazz.defineMethod (c$, "getTimeZone", 
+ function (ID, fallback) {
+var tz = null;
+tz = java.util.TimeZone.parseCustomTimeZone (ID);
+if (tz == null && fallback) {
+tz =  new jssun.util.calendar.ZoneInfo ("GMT", 0);
+}return tz;
+}, "~S,~B");
+c$.getAvailableIDs = Clazz.defineMethod (c$, "getAvailableIDs", 
+function (rawOffset) {
+return null;
+}, "~N");
+c$.getAvailableIDs = Clazz.defineMethod (c$, "getAvailableIDs", 
+function () {
+return null;
+});
+c$.getDefault = Clazz.defineMethod (c$, "getDefault", 
+function () {
+return java.util.TimeZone.getDefaultRef ().clone ();
+});
+c$.getDefaultRef = Clazz.defineMethod (c$, "getDefaultRef", 
+function () {
+if (java.util.TimeZone.defaultTimeZone == null) {
+var ms = java.util.TimeZone.getTimeZoneOffsetMillis ();
+var gmtOffsetID = java.util.TimeZone.getGMTID (ms);
+java.util.TimeZone.defaultTimeZone = java.util.TimeZone.getTimeZone (gmtOffsetID, true);
+java.util.TimeZone.addToCache (gmtOffsetID,  new jssun.util.calendar.ZoneInfo (gmtOffsetID, ms));
+}return java.util.TimeZone.defaultTimeZone;
+});
+c$.getTimeZoneOffsetMillis = Clazz.defineMethod (c$, "getTimeZoneOffsetMillis", 
+ function () {
+{
+return -(new Date()).getTimezoneOffset() * 60000;
+}});
+c$.setDefault = Clazz.defineMethod (c$, "setDefault", 
+function (zone) {
+}, "java.util.TimeZone");
+Clazz.defineMethod (c$, "hasSameRules", 
+function (other) {
+return other != null && this.getRawOffset () == other.getRawOffset () && this.useDaylightTime () == other.useDaylightTime ();
+}, "java.util.TimeZone");
+Clazz.defineMethod (c$, "clone", 
+function () {
+try {
+var other = Clazz.superCall (this, java.util.TimeZone, "clone", []);
+other.ID = this.ID;
+return other;
+} catch (e) {
+if (Clazz.exceptionOf (e, CloneNotSupportedException)) {
+throw  new InternalError ();
+} else {
+throw e;
+}
+}
+});
+c$.parseCustomTimeZone = Clazz.defineMethod (c$, "parseCustomTimeZone", 
+ function (id) {
+if ((id.length) < (5) || id.indexOf ("GMT") != 0) {
+return null;
+}var zi;
+var neghrmin = java.util.TimeZone.getOffsetHHMM (id);
+if (neghrmin == null) return null;
+var gmtOffset = (neghrmin[0]) * (neghrmin[1] * 60 + neghrmin[2]) * 60 * 1000;
+var gmtID = java.util.TimeZone.getGMTID (gmtOffset);
+zi =  new jssun.util.calendar.ZoneInfo ();
+if (gmtOffset == 0) {
+} else {
+zi.setRawOffsetReally (gmtOffset);
+}zi.setID (gmtID);
+return zi;
+}, "~S");
+c$.getOffsetHHMM = Clazz.defineMethod (c$, "getOffsetHHMM", 
+ function (id) {
+var index = 3;
+var length = id.length;
+var negative = false;
+var c = id.charAt (index++);
+if (c == '-') {
+negative = true;
+} else if (c != '+') {
+return null;
+}var hours = 0;
+var num = 0;
+var countDelim = 0;
+var len = 0;
+while (index < length) {
+c = id.charAt (index++);
+if (c == ':') {
+if (countDelim > 0) {
+return null;
+}if (len > 2) {
+return null;
+}hours = num;
+countDelim++;
+num = 0;
+len = 0;
+continue;
+}if (c < '0' || c > '9') {
+return null;
+}num = num * 10 + (c.charCodeAt (0) - 48);
+len++;
+}
+if (index != length) {
+return null;
+}if (countDelim == 0) {
+if (len <= 2) {
+hours = num;
+num = 0;
+} else {
+hours = Clazz.doubleToInt (num / 100);
+num %= 100;
+}} else {
+if (len != 2) {
+return null;
+}}if (hours > 23 || num > 59) {
+return null;
+}return  Clazz.newIntArray (-1, [(negative ? -1 : 1), hours, num]);
+}, "~S");
+c$.getGMTID = Clazz.defineMethod (c$, "getGMTID", 
+ function (gmtOffset) {
+var isNegative = (gmtOffset < 0);
+if (isNegative) gmtOffset = -gmtOffset;
+gmtOffset = Clazz.doubleToInt (gmtOffset / 60000);
+var hours = Clazz.doubleToInt (gmtOffset / 60);
+var min = gmtOffset - hours * 60;
+var NN = "00" + hours;
+NN = NN.substring (NN.length - 2);
+var MM = "00" + min;
+MM = MM.substring (MM.length - 2);
+return "GMT" + (isNegative ? "-" : "") + NN;
+}, "~N");
+c$.getCustomTimeZone = Clazz.defineMethod (c$, "getCustomTimeZone", 
+function (originalId, gmtOffset) {
+var id = java.util.TimeZone.toCustomID (gmtOffset);
+var zi = java.util.TimeZone.getFromCache (id);
+if (zi == null) {
+zi =  new jssun.util.calendar.ZoneInfo (id, gmtOffset);
+zi = java.util.TimeZone.addToCache (id, zi);
+if (originalId != null && !id.equals (originalId)) {
+zi = java.util.TimeZone.addToCache (originalId, zi);
+}}return zi.clone ();
+}, "~S,~N");
+c$.toCustomID = Clazz.defineMethod (c$, "toCustomID", 
+function (gmtOffset) {
+var sign;
+var offset = Clazz.doubleToInt (gmtOffset / 60000);
+if (offset >= 0) {
+sign = '+';
+} else {
+sign = '-';
+offset = -offset;
+}var hh = Clazz.doubleToInt (offset / 60);
+var mm = offset % 60;
+var buf =  Clazz.newCharArray (-1, ['G', 'M', 'T', sign, '0', '0', ':', '0', '0']);
+if (hh >= 10) {
+buf[4] = String.fromCharCode ((buf[4]).charCodeAt (0) + (Clazz.doubleToInt (hh / 10)));
+}buf[5] = String.fromCharCode ((buf[5]).charCodeAt (0) + (hh % 10));
+if (mm != 0) {
+buf[7] = String.fromCharCode ((buf[7]).charCodeAt (0) + (Clazz.doubleToInt (mm / 10)));
+buf[8] = String.fromCharCode ((buf[8]).charCodeAt (0) + (mm % 10));
+}return  String.instantialize (buf);
+}, "~N");
+c$.getFromCache = Clazz.defineMethod (c$, "getFromCache", 
+function (id) {
+if (java.util.TimeZone.zoneInfoObjects == null) {
+return null;
+}return java.util.TimeZone.zoneInfoObjects.get (id);
+}, "~S");
+c$.addToCache = Clazz.defineMethod (c$, "addToCache", 
+function (id, zi) {
+if (java.util.TimeZone.zoneInfoObjects == null) {
+java.util.TimeZone.zoneInfoObjects =  new java.util.HashMap ();
+} else {
+var zone = java.util.TimeZone.zoneInfoObjects.get (id);
+if (zone != null) {
+return zone;
+}}java.util.TimeZone.zoneInfoObjects.put (id, zi);
+return zi;
+}, "~S,jssun.util.calendar.ZoneInfo");
+Clazz.defineStatics (c$,
+"SHORT", 0,
+"LONG", 1,
+"NO_TIMEZONE", null,
+"defaultTimeZone", null,
+"GMT_ID", "GMT",
+"GMT_ID_LENGTH", 3,
+"zoneInfoObjects", null);
+});