X-Git-Url: http://source.jalview.org/gitweb/?p=jalviewjs.git;a=blobdiff_plain;f=site%2Fj2s%2Fjava%2Flang%2FDouble.js;h=c258ca68a9c67f58d885c46faf3b5042c20dbb99;hp=60a64287caa9098b2cadf8f45e1a805206f7e50a;hb=b9b7a352eee79b7764c3b09c9d19663075061d8c;hpb=8ffd05b3abe52c0b6b79b011c0966361f82d5fe6 diff --git a/site/j2s/java/lang/Double.js b/site/j2s/java/lang/Double.js index 60a6428..c258ca6 100644 --- a/site/j2s/java/lang/Double.js +++ b/site/j2s/java/lang/Double.js @@ -1,87 +1,87 @@ -Clazz.load (["java.lang.Comparable", "$.Number"], "java.lang.Double", null, function () { -java.lang.Double = Double = function () { -Clazz.instantialize (this, arguments); -}; -Clazz.decorateAsType (Double, "Double", Number, Comparable, null, true); -Double.prototype.valueOf = function () { return 0; }; -Double.toString = Double.prototype.toString = function () { - if (arguments.length != 0) { - return "" + arguments[0]; - } else if (this === Double) { - return "class java.lang.Double"; // Double.class.toString - } - return "" + this.valueOf (); -}; -Clazz.makeConstructor (Double, -function () { -this.valueOf = function () { - return 0.0; -}; -}); -Clazz.makeConstructor (Double, -function (value) { -this.valueOf = function () { - return value; -}; -}, "Number"); -Clazz.makeConstructor (Double, -function (s) { -var value = Double.parseDouble (s); -this.valueOf = function () { - return value; -}; -}, "String"); - -Double.serialVersionUID = Double.prototype.serialVersionUID = -9172774392245257468; -Double.MIN_VALUE = Double.prototype.MIN_VALUE = 4.9e-324; -Double.MAX_VALUE = Double.prototype.MAX_VALUE = 1.7976931348623157e+308; -Double.NEGATIVE_INFINITY = Number.NEGATIVE_INFINITY; -Double.POSITIVE_INFINITY = Number.POSITIVE_INFINITY; -Double.NaN = Number.NaN; -Double.TYPE = Double.prototype.TYPE = Double; - -Clazz.defineMethod (Double, "isNaN", -function (num) { -return isNaN (num); -}, "Number"); -Double.isNaN = Double.prototype.isNaN; -Clazz.defineMethod (Double, "isInfinite", -function (num) { -return !isFinite (num); -}, "Number"); -Double.isInfinite = Double.prototype.isInfinite; - -Clazz.defineMethod (Double, "parseDouble", -function (s) { -if (s == null) { -throw new NumberFormatException ("null"); +Clazz.load (["java.lang.Comparable", "$.Number"], "java.lang.Double", null, function () { +java.lang.Double = Double = function () { +Clazz.instantialize (this, arguments); +}; +Clazz.decorateAsType (Double, "Double", Number, Comparable, null, true); +Double.prototype.valueOf = function () { return 0; }; +Double.toString = Double.prototype.toString = function () { + if (arguments.length != 0) { + return "" + arguments[0]; + } else if (this === Double) { + return "class java.lang.Double"; // Double.class.toString + } + return "" + this.valueOf (); +}; +Clazz.makeConstructor (Double, +function () { +this.valueOf = function () { + return 0.0; +}; +}); +Clazz.makeConstructor (Double, +function (value) { +this.valueOf = function () { + return value; +}; +}, "Number"); +Clazz.makeConstructor (Double, +function (s) { +var value = Double.parseDouble (s); +this.valueOf = function () { + return value; +}; +}, "String"); + +Double.serialVersionUID = Double.prototype.serialVersionUID = -9172774392245257468; +Double.MIN_VALUE = Double.prototype.MIN_VALUE = 4.9e-324; +Double.MAX_VALUE = Double.prototype.MAX_VALUE = 1.7976931348623157e+308; +Double.NEGATIVE_INFINITY = Number.NEGATIVE_INFINITY; +Double.POSITIVE_INFINITY = Number.POSITIVE_INFINITY; +Double.NaN = Number.NaN; +Double.TYPE = Double.prototype.TYPE = Double; + +Clazz.defineMethod (Double, "isNaN", +function (num) { +return isNaN (num); +}, "Number"); +Double.isNaN = Double.prototype.isNaN; +Clazz.defineMethod (Double, "isInfinite", +function (num) { +return !isFinite (num); +}, "Number"); +Double.isInfinite = Double.prototype.isInfinite; + +Clazz.defineMethod (Double, "parseDouble", +function (s) { +if (s == null) { +throw new NumberFormatException ("null"); } var doubleVal = parseFloat (s); if(isNaN(doubleVal)){ throw new NumberFormatException ("Not a Number : " + s); } -return doubleVal; -}, "String"); +return doubleVal; +}, "String"); Double.parseDouble = Double.prototype.parseDouble; - -Clazz.defineMethod (Double, "$valueOf", + +Clazz.defineMethod (Double, "$valueOf", function (s) { -return new Double(this.parseDouble(s)); +return new Double(this.parseDouble(s)); }, "String"); -Clazz.defineMethod (Double, "$valueOf", -function (v) { -return new Double(v); +Clazz.defineMethod (Double, "$valueOf", +function (v) { +return new Double(v); }, "Number"); - + Double.$valueOf = Double.prototype.$valueOf; - -Clazz.overrideMethod(Double, "equals", -function (s) { -if(s == null || ! Clazz.instanceOf(s, Double) ){ - return false; -} -return s.valueOf() == this.valueOf(); -}, "Object"); -}); - + +Clazz.overrideMethod(Double, "equals", +function (s) { +if(s == null || ! Clazz.instanceOf(s, Double) ){ + return false; +} +return s.valueOf() == this.valueOf(); +}, "Object"); +}); +