1 Clazz.load (["java.lang.Comparable", "$.Number"], "java.lang.Short", null, function () {
\r
2 java.lang.Short = Short = function () {
\r
3 Clazz.instantialize (this, arguments);
\r
5 Clazz.decorateAsType (Short, "Short", Number, Comparable, null, true);
\r
6 Short.prototype.valueOf = function () { return 0; };
\r
7 Short.toString = Short.prototype.toString = function () {
\r
8 if (arguments.length != 0) {
\r
9 return "" + arguments[0];
\r
10 } else if (this === Short) {
\r
11 return "class java.lang.Short"; // Short.class.toString
\r
13 return "" + this.valueOf ();
\r
15 Clazz.makeConstructor (Short,
\r
17 this.valueOf = function () {
\r
21 Clazz.makeConstructor (Short,
\r
23 var v = Math.round (value) & 0xffffffff;
\r
24 this.valueOf = function () {
\r
28 Clazz.makeConstructor (Short,
\r
30 var value = Short.parseShort (s, 10);
\r
31 this.valueOf = function () {
\r
35 Short.serialVersionUID = Short.prototype.serialVersionUID = 7515723908773894738;
\r
36 Short.MIN_VALUE = Short.prototype.MIN_VALUE = -32768;
\r
37 Short.MAX_VALUE = Short.prototype.MAX_VALUE = 32767;
\r
38 Short.TYPE = Short.prototype.TYPE = Short;
\r
40 Clazz.defineMethod (Short, "parseShort",
\r
41 function (s, radix) {
\r
43 throw new NumberFormatException ("null");
\r
45 throw new NumberFormatException ("radix " + radix + " less than Character.MIN_RADIX");
\r
47 throw new NumberFormatException ("radix " + radix + " greater than Character.MAX_RADIX");
\r
49 var integer = parseInt (s, radix);
51 throw new NumberFormatException ("Not a Number : " + s);
54 }, "String, Number");
\r
55 Short.parseShort = Short.prototype.parseShort;
\r
56 Clazz.defineMethod (Short, "parseShort",
\r
58 return Short.parseShort (s, 10);
\r
61 Short.parseShort = Short.prototype.parseShort;
\r
63 Clazz.defineMethod (Short, "$valueOf",
\r
65 return new Short(Short.parseShort (s, 10));
\r
68 Clazz.defineMethod (Short, "$valueOf",
\r
70 return new Short(s);
\r
73 Clazz.defineMethod (Short, "$valueOf",
\r
75 return new Short(Short.parseShort (s, r));
\r
78 Short.$valueOf = Short.prototype.$valueOf;
79 Clazz.defineMethod (Short, "equals",
\r
81 if(s == null || !Clazz.instanceOf(s, Short) ){
84 return s.valueOf() == this.valueOf();
\r
86 Short.toHexString = Short.prototype.toHexString = function (i) {
\r
87 return i.toString (16);
\r
89 Short.toOctalString = Short.prototype.toOctalString = function (i) {
\r
90 return i.toString (8);
\r
92 Short.toBinaryString = Short.prototype.toBinaryString = function (i) {
\r
93 return i.toString (2);
\r
95 Short.decode = Clazz.defineMethod (Short, "decode",
\r
99 var negative = false;
\r
101 if (nm.startsWith ("-")) {
\r
104 }if (nm.startsWith ("0x", index) || nm.startsWith ("0X", index)) {
\r
107 } else if (nm.startsWith ("#", index)) {
\r
110 } else if (nm.startsWith ("0", index) && nm.length > 1 + index) {
\r
113 }if (nm.startsWith ("-", index)) throw new NumberFormatException ("Negative sign in wrong position");
\r
115 result = Short.$valueOf (nm.substring (index), radix);
\r
116 result = negative ? new Short (-result.shortValue ()) : result;
\r
118 if (Clazz.instanceOf (e, NumberFormatException)) {
\r
119 var constant = negative ? String.instantialize ("-" + nm.substring (index)) : nm.substring (index);
\r
120 result = Short.$valueOf (constant, radix);
\r