4 // This library will be wrapped by an additional anonymous function using ANT in
5 // build_03_tojs.xml. This task will also modify variable names. References
6 // to Clazz._ will not be changed, but other Clazz.xxx will be changed to
7 // (local scope) Clazz_xxx, allowing them to be further compressed using
8 // Google Closure Compiler in that same ANT task.
10 // BH 7/24/2015 7:21:51 AM renamed from JSmolJavaExt.js
11 // BH 5/31/2015 5:53:04 PM Number.compareTo added
12 // BH 5/21/2015 5:46:30 PM Number("0xFFFFFFFF") is not -1
13 // BH 4/23/2015 9:08:59 AM xx.getComponentType() is nonfunctional. Array.newInstance now defines a wrapper for .getClass().getComponentType() that works
14 // BH 4/12/2015 1:37:44 PM adding Math.rint = Math.round
15 // BH 1/16/2015 10:09:38 AM Chrome failure jqGrig due to new String("x").toString() not being a simple string
16 // BH 8/14/2014 6:49:22 PM Character class efficiencies
17 // BH 7/24/2014 9:02:18 AM most browsers do not support String.codePointAt()
18 // BH 7/11/2014 4:17:22 PM fix for Boolean.valueOf("false") not being false
19 // BH 5/27/2014 6:29:59 AM ensure floats and doubles have decimal point in toString
20 // BH 4/1/2014 12:23:41 PM Encoding moved to Clazz._Encoding;
21 // BH 4/1/2014 7:51:46 AM removing java.lang.B00lean
22 // BH 3/7/2014 9:17:10 AM removing Array.toString; moving that code here from j2sJmol.js
23 // BH 1/30/2014 9:04:25 AM adding Throwable.getStackTrace() as a STRING
24 // BH 12/4/2013 9:20:44 PM fix for reassigning Date.prototype.toString()
25 // BH 12/3/2013 11:43:10 AM bizarre Safari bug in reassigning Boolean (OK, I admit, we shouldn't have done that...)
26 // BH 12/1/2013 6:50:16 AM evit Number.prototype.toString assignment removed!
27 // BH 11/30/2013 1:46:31 PM fixing Byte, Short, Long, Integer, Float, Double to reflect proper bounds and error conditions
28 // BH 11/29/2013 8:58:49 PM removing Boolean.toString(boolean)
29 // BH 11/4/2013 7:34:26 AM changing "var nativeClazz" to "var nativeClass" to avoid ANT replacement of "nativeClazz." to "nativeClazz_"
30 // BH 10/19/2013 1:29:27 PM fixed String.$replace()
31 // BH 10/18/2013 6:09:23 PM fixed (Double|Float).valueOf(NaN).valueOf(), which should return NaN, not throw an error
32 // BH 10/12/2013 11:18:44 AM fixed bug in Double(String) and Float(String) that was returning typeof "string"
33 // BH 10/10/2013 2:40:20 PM added Math.log10
34 // BH 7/23/2013 7:24:01 AM fixing Number.shortValue() and Number.byteValue() for negative values
35 // BH 6/16/2013 1:31:30 PM adding /| in String.replace -- thank you David Koes
36 // BH 3/13/2013 12:49:23 PM setting Boolean.valueOf() "@"
37 // BH 3/2/2013 10:46:45 PM removed Double.valueOf(String)
38 // BH 11/6/2012 8:26:33 PM added instanceof Int32Array in String.instantialize
39 // BH 10/13/2012 11:38:07 PM corrected Integer.parseInt to allow only +-0123456789; created Integer.parseIntRadix
40 // BH 11/1/2012 added Short
41 // BH 9/10/2012 6:27:21 AM added java.net.URL... classes
42 // BH 1/7/2013 7:40:06 AM added Clazz.dateToString
46 // moved here from package.js
47 // these classes will be created as objects prior to any others
48 // and are then available immediately
50 Clazz._Loader.registerPackages("java", [ "io", "lang", "lang.reflect", "util" ]);
52 var sJU = "java.util";
55 //Clazz._Loader.registerPackages (sJU, ["regex", "zip"]);
58 var javautil = java.util;
60 Clazz._Loader.ignore([
61 "net.sf.j2s.ajax.HttpRequest",
62 sJU + ".MapEntry.Type",
63 //"java.net.UnknownServiceException",
65 "java.security.AccessController",
66 "java.security.PrivilegedExceptionAction",
68 "java.io.FileInputStream",
70 "java.io.OutputStreamWriter",
71 // sJU + ".Calendar", // bypassed in ModelCollection
72 // "java.text.SimpleDateFormat", // not used
73 // "java.text.DateFormat", // not used
74 sJU + ".concurrent.Executors"
77 Math.rint = Math.round;
79 Math.log10||(Math.log10=function(a){return Math.log(a)/2.302585092994046});
81 if(Clazz._supportsNativeObject){
82 // Number and Array are special -- do not override prototype.toString -- "length - 2" here
83 for(var i=0;i<Clazz._extendedObjectMethods.length - 2;i++){
84 var p=Clazz._extendedObjectMethods[i];
85 Array.prototype[p] = Clazz._O.prototype[p];
86 Number.prototype[p] = Clazz._O.prototype[p];
90 java.lang.Number=Number;
91 Number.__CLASS_NAME__="Number";
92 Clazz.implementOf(Number,java.io.Serializable);
93 Number.equals=Clazz._innerFunctions.equals;
94 Number.getName=Clazz._innerFunctions.getName;
95 Number.prototype.compareTo = function(x) { var a = this.value, b = x.value; return (a < b ? -1 : a == b ? 0 : 1) };
97 Clazz.defineMethod(Number,"shortValue",
99 var x = Math.round(this)&0xffff;
100 return (this < 0 && x > 0 ? x - 0x10000 : x);
103 Clazz.defineMethod(Number,"byteValue",
105 var x = Math.round(this)&0xff;
106 return (this < 0 && x > 0 ? x - 0x100 : x);
109 Clazz.defineMethod(Number,"intValue",
111 return Math.round(this)&0xffffffff;
114 Clazz.defineMethod(Number,"longValue",
116 return Math.round(this);
119 Clazz.defineMethod(Number,"floatValue",
121 return this.valueOf();
123 Clazz.defineMethod(Number,"doubleValue",
125 return parseFloat(this.valueOf());
128 Clazz.overrideMethod(Number,"hashCode",
130 return this.valueOf();
133 java.lang.Integer=Integer=function(){
134 Clazz.instantialize(this,arguments);
136 Clazz.decorateAsType(Integer,"Integer",Number,Comparable,null,true);
137 Integer.prototype.valueOf=function(){return 0;};
138 Integer.toString=Integer.prototype.toString=function(){
139 if(arguments.length!=0){
140 return""+arguments[0];
141 } else if(this===Integer){
142 return"class java.lang.Integer";
144 return""+this.valueOf();
149 Clazz.makeConstructor(Integer,
151 this.valueOf=function(){
158 Clazz.overrideConstructor(Integer, function(v){
159 v == null && (v = 0);
160 if (typeof v != "number")
161 v = Integer.parseIntRadix(v, 10);
162 this.valueOf=function(){return v;};
165 Clazz.makeConstructor(Integer,
167 var value=Integer.parseInt(s,10);
168 this.valueOf=function(){
173 Integer.MIN_VALUE=Integer.prototype.MIN_VALUE=-0x80000000;
174 Integer.MAX_VALUE=Integer.prototype.MAX_VALUE=0x7fffffff;
175 Integer.TYPE=Integer.prototype.TYPE=Integer;
178 Clazz.defineMethod(Integer,"bitCount",
180 i = i - ((i >>> 1) & 0x55555555);
181 i = (i & 0x33333333) + ((i >>> 2) & 0x33333333);
182 i = (i + (i >>> 4)) & 0x0f0f0f0f;
187 Integer.bitCount=Integer.prototype.bitCount;
189 Clazz.defineMethod(Integer,"numberOfLeadingZeros",
191 if (i == 0) return 32;
193 if (i >>> 16 == 0) { n += 16; i <<= 16; }
194 if (i >>> 24 == 0) { n += 8; i <<= 8; }
195 if (i >>> 28 == 0) { n += 4; i <<= 4; }
196 if (i >>> 30 == 0) { n += 2; i <<= 2; }
200 Integer.numberOfLeadingZeros=Integer.prototype.numberOfLeadingZeros;
202 Clazz.defineMethod(Integer,"numberOfTrailingZeros",
204 if (i == 0) return 32;
206 var y = i <<16; if (y != 0) { n = n -16; i = y; }
207 y = i << 8; if (y != 0) { n = n - 8; i = y; }
208 y = i << 4; if (y != 0) { n = n - 4; i = y; }
209 y = i << 2; if (y != 0) { n = n - 2; i = y; }
210 return n - ((i << 1) >>> 31);
212 Integer.numberOfTrailingZeros=Integer.prototype.numberOfTrailingZeros;
214 Clazz.defineMethod(Integer,"parseIntRadix",
217 throw new NumberFormatException("null");
219 throw new NumberFormatException("radix "+radix+" less than Character.MIN_RADIX");
221 throw new NumberFormatException("radix "+radix+" greater than Character.MAX_RADIX");
224 for (var i = s.length; --i >= 0;) {
225 var c = s.charCodeAt(i);
226 if (c >= 48 && c <= 57) continue;
227 if (i > 0 || c != 43 && c != 45)
228 throw new NumberFormatException("Not a Number : "+s);
232 var i=parseInt(s,radix);
234 throw new NumberFormatException("Not a Number : "+s);
238 Integer.parseIntRadix=Integer.prototype.parseIntRadix;
240 Clazz.defineMethod(Integer,"parseInt",
242 return Integer.parseIntRadix(s,10);
244 Integer.parseInt=Integer.prototype.parseInt;
247 Clazz.defineMethod(Integer,"$valueOf",
249 return new Integer(Integer.parseIntRadix(s,10));
253 Clazz.overrideMethod(Integer,"$valueOf",
255 return new Integer(s);
259 Clazz.defineMethod(Integer,"$valueOf",
261 return new Integer(Integer.parseIntRadix(s,r));
265 Integer.$valueOf=Integer.prototype.$valueOf;
268 Clazz.overrideMethod(Integer,"equals",
270 if(s==null||!Clazz.instanceOf(s,Integer)){
273 return s.valueOf()==this.valueOf();
275 Integer.toHexString=Integer.prototype.toHexString=function(d){
276 if(d.valueOf)d=d.valueOf();
278 var b = d & 0xFFFFFF;
279 var c = ((d>>24)&0xFF);
280 return c._numberToString(16) + (b = "000000" + b._numberToString(16)).substring(b.length - 6);
282 return d._numberToString(16);};
283 Integer.toOctalString=Integer.prototype.toOctalString=function(d){if(d.valueOf)d=d.valueOf();return d._numberToString(8);};
284 Integer.toBinaryString=Integer.prototype.toBinaryString=function(d){if(d.valueOf)d=d.valueOf();return d._numberToString(2);};
286 Integer.decodeRaw=Clazz.defineMethod(Integer,"decodeRaw", function(n){
287 if (n.indexOf(".") >= 0)n = "";
288 var i = (n.startsWith("-") ? 1 : 0);
289 n = n.replace(/\#/, "0x").toLowerCase();
290 var radix=(n.startsWith("0x", i) ? 16 : n.startsWith("0", i) ? 8 : 10);
291 // The general problem with parseInt is that is not strict -- ParseInt("10whatever") == 10.
292 // Number is strict, but Number("055") does not work, though ParseInt("055", 8) does.
293 // need to make sure negative numbers are negative
294 n = Number(n) & 0xFFFFFFFF;
295 return (radix == 8 ? parseInt(n, 8) : n);
298 Integer.decode=Clazz.defineMethod(Integer,"decode", function(n){
299 n = Integer.decodeRaw(n);
300 if (isNaN(n) || n < Integer.MIN_VALUE|| n > Integer.MAX_VALUE)
301 throw new NumberFormatException("Invalid Integer");
302 return new Integer(n);
305 Clazz.overrideMethod(Integer,"hashCode",
307 return this.valueOf();
310 // Note that Long is problematic in JavaScript
312 java.lang.Long=Long=function(){
313 Clazz.instantialize(this,arguments);
315 Clazz.decorateAsType(Long,"Long",Number,Comparable,null,true);
316 Long.prototype.valueOf=function(){return 0;};
317 Long.toString=Long.prototype.toString=function(){
318 if(arguments.length!=0){
319 return""+arguments[0];
320 }else if(this===Long){
321 return"class java.lang.Long";
323 return""+this.valueOf();
326 Clazz.overrideConstructor(Long, function(v){
327 v == null && (v = 0);
328 v = (typeof v == "number" ? Math.round(v) : Integer.parseIntRadix(v, 10));
329 this.valueOf=function(){return v;};
332 //Long.MIN_VALUE=Long.prototype.MIN_VALUE=-0x8000000000000000;
333 //Long.MAX_VALUE=Long.prototype.MAX_VALUE=0x7fffffffffffffff;
334 Long.TYPE=Long.prototype.TYPE=Long;
336 Clazz.defineMethod(Long,"parseLong",
338 return Integer.parseInt(s, radix || 10);
341 Long.parseLong=Long.prototype.parseLong;
343 Clazz.overrideMethod(Long,"$valueOf",
348 Clazz.defineMethod(Long,"$valueOf",
353 Clazz.defineMethod(Long,"$valueOf",
355 return new Long(Long.parseLong(s,r));
358 Long.$valueOf=Long.prototype.$valueOf;
359 Clazz.overrideMethod(Long,"equals",
361 if(s==null||!Clazz.instanceOf(s,Long)){
364 return s.valueOf()==this.valueOf();
366 Long.toHexString=Long.prototype.toHexString=function(i){
367 return i.toString(16);
369 Long.toOctalString=Long.prototype.toOctalString=function(i){
370 return i.toString(8);
372 Long.toBinaryString=Long.prototype.toBinaryString=function(i){
373 return i.toString(2);
377 Long.decode=Clazz.defineMethod(Long,"decode",
379 n = Integer.decodeRaw(n);
381 throw new NumberFormatException("Invalid Long");
385 java.lang.Short = Short = function () {
386 Clazz.instantialize (this, arguments);
388 Clazz.decorateAsType (Short, "Short", Number, Comparable, null, true);
389 Short.prototype.valueOf = function () { return 0; };
390 Short.toString = Short.prototype.toString = function () {
391 if (arguments.length != 0) {
392 return "" + arguments[0];
393 } else if (this === Short) {
394 return "class java.lang.Short"; // Short.class.toString
396 return "" + this.valueOf ();
399 Clazz.overrideConstructor(Short,
401 v == null && (v = 0);
402 if (typeof v != "number")
403 v = Integer.parseIntRadix(v, 10);
405 this.valueOf = function () {return v;};
409 Short.MIN_VALUE = Short.prototype.MIN_VALUE = -32768;
410 Short.MAX_VALUE = Short.prototype.MAX_VALUE = 32767;
411 Short.TYPE = Short.prototype.TYPE = Short;
413 Clazz.defineMethod(Short, "parseShortRadix",
414 function (s, radix) {
415 return Integer.parseIntRadix(s, radix).shortValue();
416 }, "String, Number");
417 Short.parseShortRadix = Short.prototype.parseShortRadix;
419 Clazz.defineMethod(Short, "parseShort",
421 return Short.parseShortRadix (s, 10);
424 Short.parseShort = Short.prototype.parseShort;
427 Clazz.defineMethod(Short, "$valueOf",
429 return new Short(Short.parseShort (s, 10));
433 Clazz.overrideMethod(Short, "$valueOf",
439 Clazz.defineMethod(Short, "$valueOf",
441 return new Short(Short.parseShort (s, r));
442 }, "String, Number");
445 Short.$valueOf = Short.prototype.$valueOf;
446 Clazz.overrideMethod(Short, "equals",
448 if(s == null || !Clazz.instanceOf(s, Short) ){
451 return s.valueOf() == this.valueOf();
453 Short.toHexString = Short.prototype.toHexString = function (i) {
454 return i.toString (16);
456 Short.toOctalString = Short.prototype.toOctalString = function (i) {
457 return i.toString (8);
459 Short.toBinaryString = Short.prototype.toBinaryString = function (i) {
460 return i.toString (2);
462 Short.decode = Clazz.defineMethod(Short, "decode",
464 n = Integer.decodeRaw(n);
465 if (isNaN(n) || n < -32768|| n > 32767)
466 throw new NumberFormatException("Invalid Short");
470 java.lang.Byte=Byte=function(){
471 Clazz.instantialize(this,arguments);
473 Clazz.decorateAsType(Byte,"Byte",Number,Comparable,null,true);
474 Byte.prototype.valueOf=function(){return 0;};
475 Byte.toString=Byte.prototype.toString=function(){
476 if(arguments.length!=0){
477 return""+arguments[0];
478 }else if(this===Byte){
479 return"class java.lang.Byte";
481 return""+this.valueOf();
483 Clazz.makeConstructor(Byte,
485 if (typeof v != "number")
486 v = Integer.parseIntRadix(v, 10);
488 this.valueOf=function(){
493 Byte.serialVersionUID=Byte.prototype.serialVersionUID=-7183698231559129828;
494 Byte.MIN_VALUE=Byte.prototype.MIN_VALUE=-128;
495 Byte.MAX_VALUE=Byte.prototype.MAX_VALUE=127;
496 Byte.SIZE=Byte.prototype.SIZE=8;
497 Byte.TYPE=Byte.prototype.TYPE=Byte;
499 Clazz.defineMethod(Byte,"parseByteRadix",
501 return Integer.parseIntRadix(s, radix).byteValue();
503 Byte.parseByteRadix=Byte.prototype.parseByteRadix;
505 Clazz.defineMethod(Byte,"parseByte",
507 return Byte.parseByte(s,10);
510 Byte.parseByte=Byte.prototype.parseByte;
512 Clazz.overrideMethod(Byte, "$valueOf",
517 Byte.$valueOf=Byte.prototype.$valueOf;
518 Clazz.overrideMethod(Byte,"equals",
520 if(s==null||!Clazz.instanceOf(s,Byte)){
523 return s.valueOf()==this.valueOf();
525 Byte.toHexString=Byte.prototype.toHexString=function(i){
526 return i.toString(16);
528 Byte.toOctalString=Byte.prototype.toOctalString=function(i){
529 return i.toString(8);
531 Byte.toBinaryString=Byte.prototype.toBinaryString=function(i){
532 return i.toString(2);
534 Byte.decode=Clazz.defineMethod(Byte,"decode",
536 n = Integer.decodeRaw(n);
537 if (isNaN(n) || n < -128|| n > 127)
538 throw new NumberFormatException("Invalid Byte");
542 Clazz._floatToString = function(f) {
544 if (s.indexOf(".") < 0 && s.indexOf("e") < 0)
549 java.lang.Float=Float=function(){
550 Clazz.instantialize(this,arguments);
552 Clazz.decorateAsType(Float,"Float",Number,Comparable,null,true);
553 Float.prototype.valueOf=function(){return 0;};
554 Float.toString=Float.prototype.toString=function(){
555 if(arguments.length!=0){
556 return Clazz._floatToString(arguments[0]);
557 }else if(this===Float){
558 return"class java.lang.Float";
560 return Clazz._floatToString(this.valueOf());
563 Clazz.overrideConstructor(Float, function(v){
564 v == null && (v = 0);
565 if (typeof v != "number")
567 this.valueOf=function(){return v;}
570 Float.serialVersionUID=Float.prototype.serialVersionUID=-2671257302660747028;
571 Float.MIN_VALUE=Float.prototype.MIN_VALUE=3.4028235e+38;
572 Float.MAX_VALUE=Float.prototype.MAX_VALUE=1.4e-45;
573 Float.NEGATIVE_INFINITY=Number.NEGATIVE_INFINITY;
574 Float.POSITIVE_INFINITY=Number.POSITIVE_INFINITY;
575 Float.NaN=Number.NaN;
576 Float.TYPE=Float.prototype.TYPE=Float;
578 Clazz.defineMethod(Float,"parseFloat",
581 throw new NumberFormatException("null");
583 if (typeof s == "number")return s; // important -- typeof NaN is "number" and is OK here
584 var floatVal=Number(s);
586 throw new NumberFormatException("Not a Number : "+s);
590 Float.parseFloat=Float.prototype.parseFloat;
592 Clazz.overrideMethod(Float,"$valueOf",
597 Float.$valueOf=Float.prototype.$valueOf;
599 Clazz.defineMethod(Float,"isNaN",
603 Float.isNaN=Float.prototype.isNaN;
604 Clazz.defineMethod(Float,"isInfinite",
606 return!isFinite(num);
608 Float.isInfinite=Float.prototype.isInfinite;
610 Clazz.overrideMethod(Float,"equals",
612 if(s==null||!Clazz.instanceOf(s,Float)){
615 return s.valueOf()==this.valueOf();
618 java.lang.Double=Double=function(){
619 Clazz.instantialize(this,arguments);
621 Clazz.decorateAsType(Double,"Double",Number,Comparable,null,true);
622 Double.prototype.valueOf=function(){return 0;};
623 Double.toString=Double.prototype.toString=function(){
624 if(arguments.length!=0){
625 return Clazz._floatToString(arguments[0]);
626 }else if(this===Double){
627 return"class java.lang.Double";
629 return Clazz._floatToString(this.valueOf());
632 Clazz.overrideConstructor(Double, function(v){
633 v == null && (v = 0);
634 if (typeof v != "number")
635 v = Double.parseDouble(v);
636 this.valueOf=function(){return v;};
639 Double.serialVersionUID=Double.prototype.serialVersionUID=-9172774392245257468;
640 Double.MIN_VALUE=Double.prototype.MIN_VALUE=4.9e-324;
641 Double.MAX_VALUE=Double.prototype.MAX_VALUE=1.7976931348623157e+308;
642 Double.NEGATIVE_INFINITY=Number.NEGATIVE_INFINITY;
643 Double.POSITIVE_INFINITY=Number.POSITIVE_INFINITY;
644 Double.NaN=Number.NaN;
645 Double.TYPE=Double.prototype.TYPE=Double;
647 Clazz.defineMethod(Double,"isNaN",
651 Double.isNaN=Double.prototype.isNaN;
652 Clazz.defineMethod(Double,"isInfinite",
654 return!isFinite(num);
656 Double.isInfinite=Double.prototype.isInfinite;
658 Clazz.defineMethod(Double,"parseDouble",
661 throw new NumberFormatException("null");
663 if (typeof s == "number")return s; // important -- typeof NaN is "number" and is OK here
664 var doubleVal=Number(s);
665 if(isNaN(doubleVal)){
666 throw new NumberFormatException("Not a Number : "+s);
670 Double.parseDouble=Double.prototype.parseDouble;
673 Clazz.defineMethod(Double,"$valueOf",
675 return new Double(this.parseDouble(s));
679 Clazz.defineMethod(Double,"$valueOf",
681 return new Double(v);
684 Double.$valueOf=Double.prototype.$valueOf;
686 Clazz.overrideMethod(Double,"equals",
688 if(s==null||!Clazz.instanceOf(s,Double)){
691 return s.valueOf()==this.valueOf();
695 //java.lang.B00lean = Boolean; ?? BH why this?
696 Boolean = java.lang.Boolean = Boolean || function () {Clazz.instantialize (this, arguments);};
697 if (Clazz._supportsNativeObject) {
698 for (var i = 0; i < Clazz._extendedObjectMethods.length; i++) {
699 var p = Clazz._extendedObjectMethods[i];
700 Boolean.prototype[p] = Clazz._O.prototype[p];
703 Boolean.__CLASS_NAME__="Boolean";
704 Clazz.implementOf(Boolean,[java.io.Serializable,java.lang.Comparable]);
705 Boolean.equals=Clazz._innerFunctions.equals;
706 Boolean.getName=Clazz._innerFunctions.getName;
707 Boolean.serialVersionUID=Boolean.prototype.serialVersionUID=-3665804199014368530;
709 //Clazz.makeConstructor(Boolean,
711 //this.valueOf=function(){
716 Clazz.overrideConstructor(Boolean,
718 var b = ((typeof s == "string" ? Boolean.toBoolean(s) : s) ? true : false);
719 this.valueOf=function(){return b;};
722 Boolean.parseBoolean=Clazz.defineMethod(Boolean,"parseBoolean",
724 return Boolean.toBoolean(s);
726 Clazz.defineMethod(Boolean,"booleanValue",
728 return this.valueOf();
730 Boolean.$valueOf=Clazz.overrideMethod(Boolean,"$valueOf",
732 return((typeof b == "string"? "true".equalsIgnoreCase(b) : b)?Boolean.TRUE:Boolean.FALSE);
736 Boolean.toString=Clazz.defineMethod(Boolean,"toString",
738 return b?"true":"false";
742 Clazz.overrideMethod(Boolean,"toString",
744 return this.valueOf()?"true":"false";
746 Clazz.overrideMethod(Boolean,"hashCode",
748 return this.valueOf()?1231:1237;
750 Clazz.overrideMethod(Boolean,"equals",
752 if(Clazz.instanceOf(obj,Boolean)){
753 return this.booleanValue()==obj.booleanValue();
756 Boolean.getBoolean=Clazz.defineMethod(Boolean,"getBoolean",
760 result=Boolean.toBoolean(System.getProperty(name));
762 if(Clazz.instanceOf(e,IllegalArgumentException)){
763 }else if(Clazz.instanceOf(e,NullPointerException)){
770 Clazz.overrideMethod(Boolean,"compareTo",
772 return(b.value==this.value?0:(this.value?1:-1));
774 Boolean.toBoolean=Clazz.defineMethod(Boolean,"toBoolean",
776 return((name!=null)&&name.equalsIgnoreCase("true"));
777 },$fz.isPrivate=true,$fz),"~S");
778 Boolean.TRUE=Boolean.prototype.TRUE=new Boolean(true);
779 Boolean.FALSE=Boolean.prototype.FALSE=new Boolean(false);
780 Boolean.TYPE=Boolean.prototype.TYPE=Boolean;
783 Clazz._Encoding=new Object();
785 (function(Encoding) {
787 Encoding.UTF8="utf-8";
788 Encoding.UTF16="utf-16";
789 Encoding.ASCII="ascii";
792 Encoding.guessEncoding=function(str){
793 if(str.charCodeAt(0)==0xEF&&str.charCodeAt(1)==0xBB&&str.charCodeAt(2)==0xBF){
794 return Encoding.UTF8;
795 }else if(str.charCodeAt(0)==0xFF&&str.charCodeAt(1)==0xFE){
796 return Encoding.UTF16;
798 return Encoding.ASCII;
802 Encoding.readUTF8=function(str){
803 var encoding=this.guessEncoding(str);
805 if(encoding==Encoding.UTF8){
807 }else if(encoding==Encoding.UTF16){
810 var arrs=new Array();
811 for(var i=startIdx;i<str.length;i++){
812 var charCode=str.charCodeAt(i);
814 arrs[arrs.length]=str.charAt(i);
815 }else if(charCode>0xc0&&charCode<0xe0){
816 var c1=charCode&0x1f;
818 var c2=str.charCodeAt(i)&0x3f;
820 arrs[arrs.length]=String.fromCharCode(c);
821 }else if(charCode>=0xe0){
822 var c1=charCode&0x0f;
824 var c2=str.charCodeAt(i)&0x3f;
826 var c3=str.charCodeAt(i)&0x3f;
827 var c=(c1<<12)+(c2<<6)+c3;
828 arrs[arrs.length]=String.fromCharCode(c);
831 return arrs.join('');
834 Encoding.convert2UTF8=function(str){
835 var encoding=this.guessEncoding(str);
837 if(encoding==Encoding.UTF8){
839 }else if(encoding==Encoding.UTF16){
844 var arrs=new Array(offset+str.length-startIdx);
846 for(var i=startIdx;i<str.length;i++){
847 var charCode=str.charCodeAt(i);
849 arrs[offset+i-startIdx]=str.charAt(i);
850 }else if(charCode<=0x07ff){
851 var c1=0xc0+((charCode&0x07c0)>>6);
852 var c2=0x80+(charCode&0x003f);
853 arrs[offset+i-startIdx]=String.fromCharCode(c1)+String.fromCharCode(c2);
855 var c1=0xe0+((charCode&0xf000)>>12);
856 var c2=0x80+((charCode&0x0fc0)>>6);
857 var c3=0x80+(charCode&0x003f);
858 arrs[offset+i-startIdx]=String.fromCharCode(c1)+String.fromCharCode(c2)+String.fromCharCode(c3);
861 return arrs.join('');
863 Encoding.base64Chars=new Array(
864 'A','B','C','D','E','F','G','H',
865 'I','J','K','L','M','N','O','P',
866 'Q','R','S','T','U','V','W','X',
867 'Y','Z','a','b','c','d','e','f',
868 'g','h','i','j','k','l','m','n',
869 'o','p','q','r','s','t','u','v',
870 'w','x','y','z','0','1','2','3',
871 '4','5','6','7','8','9','+','/'
873 Encoding.encodeBase64=function(str){
874 if(str==null||str.length==0)return str;
875 var b64=Encoding.base64Chars;
876 var length=str.length;
881 c0=str.charCodeAt(index++);
882 buf[buf.length]=b64[c0>>2];
884 c1=str.charCodeAt(index++);
885 buf[buf.length]=b64[((c0<<4)&0x30)|(c1>>4)];
887 c2=str.charCodeAt(index++);
888 buf[buf.length]=b64[((c1<<2)&0x3c)|(c2>>6)];
889 buf[buf.length]=b64[c2&0x3F];
891 buf[buf.length]=b64[((c1<<2)&0x3c)];
895 buf[buf.length]=b64[(c0<<4)&0x30];
902 Encoding.decodeBase64=function(str){
903 if(str==null||str.length==0)return str;
904 var b64=Encoding.base64Chars;
905 var xb64=Encoding.xBase64Chars;
906 if(Encoding.xBase64Chars==null){
908 for(var i=0;i<b64.length;i++){
911 Encoding.xBase64Chars=xb64;
913 var length=str.length;
918 while(index<length&&c++<60000){
919 c0=xb64[str.charAt(index++)];
920 c1=xb64[str.charAt(index++)];
921 c2=xb64[str.charAt(index++)];
922 c3=xb64[str.charAt(index++)];
923 buf[buf.length]=String.fromCharCode(((c0<<2)&0xff)|c1>>4);
925 buf[buf.length]=String.fromCharCode(((c1<<4)&0xff)|c2>>2);
927 buf[buf.length]=String.fromCharCode(((c2<<6)&0xff)|c3);
934 if(String.prototype.$replace==null){
935 java.lang.String=String;
936 if(Clazz._supportsNativeObject){
937 for(var i=0;i<Clazz._extendedObjectMethods.length;i++){
938 var p=Clazz._extendedObjectMethods[i];
939 if("to$tring"==p||"toString"==p||"equals"==p||"hashCode"==p){
942 String.prototype[p]=Clazz._O.prototype[p];
946 Clazz.implementOf(String,[java.io.Serializable,CharSequence,Comparable]);
948 String.getName=Clazz._innerFunctions.getName;
950 String.serialVersionUID=String.prototype.serialVersionUID=-6849794470754667710;
955 sp.$replace=function(c1,c2){
956 if (c1 == c2 || this.indexOf (c1) < 0) return "" + this;
957 if (c1.length == 1) {
958 if ("\\$.*+|?^{}()[]".indexOf(c1) >= 0) c1 = "\\" + c1;
960 c1=c1.replace(/([\\\$\.\*\+\|\?\^\{\}\(\)\[\]])/g,function($0,$1){return"\\"+$1;});
962 return this.replace(new RegExp(c1,"gm"),c2);
964 sp.$generateExpFunction=function(str){
970 for(;i<str.length;i++){
971 var ch=str.charAt(i);
972 if(i!=str.length-1&&ch=='\\'){
979 }else if(i!=str.length-1&&ch=='$'){
981 orders[idx]=parseInt(str.charAt(i));
996 var funStr="f = function (";
997 var max=Math.max.apply({},orders);
1004 funStr+=") { return ";
1005 for(i=0;i<arr.length-1;i++){
1006 funStr+="\""+arr[i]+"\" + $"+orders[i]+" + ";
1008 funStr+="\""+arr[i]+"\"; }";
1014 sp.replaceAll=function(exp,str){
1015 var regExp=new RegExp(exp,"gm");
1016 return this.replace(regExp,this.$generateExpFunction(str));
1018 sp.replaceFirst=function(exp,str){
1019 var regExp=new RegExp(exp,"m");
1020 return this.replace(regExp,this.$generateExpFunction(str));
1022 sp.matches=function(exp){
1026 var regExp=new RegExp(exp,"gm");
1027 var m=this.match(regExp);
1028 return m!=null&&m.length!=0;
1030 sp.regionMatches=function(ignoreCase,toffset,
1033 if(typeof ignoreCase=="number"
1034 ||(ignoreCase!=true&&ignoreCase!=false)){
1044 if((ooffset<0)||(toffset<0)||(toffset>this.length-len)||
1045 (ooffset>other.length-len)){
1048 var s1=this.substring(toffset,toffset+len);
1049 var s2=other.substring(ooffset,ooffset+len);
1051 s1=s1.toLowerCase();
1052 s2=s2.toLowerCase();
1059 sp.$plit=function(regex,limit){
1060 if (!limit && regex == " ")
1061 return this.split(regex);
1063 if(limit!=null&&limit>0){
1067 var regExp=new RegExp("("+regex+")","gm");
1069 var s=this.replace(regExp,function($0,$1){
1073 }else if(count>limit){
1079 regExp=new RegExp(regex,"gm");
1080 var arr=this.split(regExp);
1081 if(arr.length>limit){
1082 arr[limit-1]=s.substring(s.indexOf("@@_@@")+5);
1087 var regExp=new RegExp(regex,"gm");
1088 return this.split(regExp);
1093 var len=this.length;
1096 while((st<len)&&(this.charAt(st)<=' ')){
1099 while((st<len)&&(this.charAt(len-1)<=' ')){
1102 return((st>0)||(len<len))?this.substring(st,len):this;
1110 return this.replace(/^\s+/g,'').replace(/\s+$/g,'');
1113 if (!sp.startsWith || !sp.endsWith) {
1114 var sn=function(s, prefix,toffset){
1117 var pc=prefix.length;
1119 if((toffset<0)||(toffset>s.length-pc)){
1123 if(s.charAt(to++)!=prefix.charAt(po++)){
1130 sp.startsWith=function(prefix){
1131 if(arguments.length==1){
1132 return sn(this,arguments[0],0);
1133 }else if(arguments.length==2){
1134 return sn(this,arguments[0],arguments[1]);
1140 sp.endsWith=function(suffix){
1141 return sn(this, suffix,this.length-suffix.length);
1146 sp.equals=function(anObject){
1147 return this.valueOf()==anObject;
1150 sp.equalsIgnoreCase=function(anotherString){
1151 return(anotherString==null)?false:(this==anotherString
1152 ||this.toLowerCase()==anotherString.toLowerCase());
1158 sp.hashCode=function(){
1162 var len=this.length;
1163 for(var i=0;i<len;i++){
1164 h=31*h+this.charCodeAt(off++);
1172 sp.getBytes=function(){
1173 if(arguments.length==4){
1174 return this.getChars(arguments[0],arguments[1],arguments[2],arguments[3]);
1177 if(arguments.length==1){
1178 var cs=arguments[0].toString().toLowerCase();
1180 "utf-8","UTF8","us-ascii","iso-8859-1","8859_1","gb2312","gb18030","gbk"
1183 for(var i=0;i<charset.length;i++){
1190 throw new java.io.UnsupportedEncodingException();
1192 if(cs=="utf-8"||cs=="utf8"){
1193 s=Encoding.convert2UTF8(this);
1196 var arrs=new Array(s.length);
1198 for(var i=0;i<s.length;i++){
1203 arrs[ii+2]=(c&0xff00)>>8;
1214 sp.compareTo=function(anotherString){
1215 if(anotherString==null){
1216 throw new java.lang.NullPointerException();
1218 var len1=this.length;
1219 var len2=anotherString.length;
1220 var n=Math.min(len1,len2);
1223 var c1=this.charCodeAt(k);
1224 var c2=anotherString.charCodeAt(k);
1235 sp.contains = function(a) {return this.indexOf(a) >= 0} // bh added
1236 sp.compareTo = function(a){return this > a ? 1 : this < a ? -1 : 0} // bh added
1240 sp.toCharArray=function(){
1241 var result=new Array(this.length);
1242 for(var i=0;i<this.length;i++){
1243 result[i]=this.charAt(i);
1247 String.value0f=String.valueOf;
1248 String.valueOf=function(o){
1250 return String.value0f();
1252 if(o instanceof Array){
1253 if(arguments.length==1){
1256 var off=arguments[1];
1257 var len=arguments[2];
1258 var oo=new Array(len);
1259 for(var i=0;i<len;i++){
1268 sp.subSequence=function(beginIndex,endIndex){
1269 return this.substring(beginIndex,endIndex);
1272 sp.compareToIgnoreCase=function(str){
1274 throw new NullPointerException();
1276 var s1=this.toUpperCase();
1277 var s2=str.toUpperCase();
1281 var s1=this.toLowerCase();
1282 var s2=str.toLowerCase();
1293 sp.contentEquals=function(sb){
1294 if(this.length!=sb.length()){
1297 var v=sb.getValue();
1302 if(this.charCodeAt(i++)!=v[j++]){
1309 sp.getChars=function(srcBegin,srcEnd,dst,dstBegin){
1311 throw new StringIndexOutOfBoundsException(srcBegin);
1313 if(srcEnd>this.length){
1314 throw new StringIndexOutOfBoundsException(srcEnd);
1316 if(srcBegin>srcEnd){
1317 throw new StringIndexOutOfBoundsException(srcEnd-srcBegin);
1320 throw new NullPointerException();
1322 for(var i=0;i<srcEnd-srcBegin;i++){
1323 dst[dstBegin+i]=this.charAt(srcBegin+i);
1326 sp.$concat=sp.concat;
1327 sp.concat=function(s){
1329 throw new NullPointerException();
1331 return this.$concat(s);
1334 sp.$lastIndexOf=sp.lastIndexOf;
1335 sp.lastIndexOf=function(s,last){
1336 if(last!=null&&last+this.length<=0){
1340 return this.$lastIndexOf(s,last);
1342 return this.$lastIndexOf(s);
1346 sp.intern=function(){
1347 return this.valueOf();
1349 String.copyValueOf=sp.copyValueOf=function(){
1350 if(arguments.length==1){
1351 return String.instantialize(arguments[0]);
1353 return String.instantialize(arguments[0],arguments[1],arguments[2]);
1357 sp.codePointAt || (sp.codePointAt = sp.charCodeAt); // Firefox only
1360 })(String.prototype);
1364 String.indexOf=function(source,sourceOffset,sourceCount,
1365 target,targetOffset,targetCount,fromIndex){
1366 if(fromIndex>=sourceCount){
1367 return(targetCount==0?sourceCount:-1);
1376 var first=target[targetOffset];
1377 var i=sourceOffset+fromIndex;
1378 var max=sourceOffset+(sourceCount-targetCount);
1380 startSearchForFirstChar:
1383 while(i<=max&&source[i]!=first){
1392 var end=j+targetCount-1;
1393 var k=targetOffset+1;
1395 if(source[j++]!=target[k++]){
1398 continue startSearchForFirstChar;
1401 return i-sourceOffset;
1407 String.instantialize=function(){
1408 if(arguments.length==0){
1409 return new String();
1410 }else if(arguments.length==1){
1412 if(typeof x=="string"||x instanceof String){
1413 return new String(x);
1414 }else if(x instanceof Array){
1415 if(x.length>0&&typeof x[0]=="number"){
1416 var arr=new Array(x.length);
1417 for(var i=0;i<x.length;i++){
1418 arr[i]=String.fromCharCode(x[i]&0xff);
1420 return Encoding.readUTF8(arr.join(''));
1423 }else if(x.__CLASS_NAME__=="StringBuffer"
1424 ||x.__CLASS_NAME__=="java.lang.StringBuffer"){
1425 var value=x.shareValue();
1426 var length=x.length();
1427 var valueCopy=new Array(length);
1428 for(var i=0;i<length;i++){
1429 valueCopy[i]=value[i];
1431 return valueCopy.join('')
1436 }else if(arguments.length==2){
1438 var hibyte=arguments[1];
1439 if(typeof hibyte=="string"){
1440 return String.instantialize(x,0,x.length,hibyte);
1442 return String.instantialize(x,hibyte,0,x.length);
1444 }else if(arguments.length==3){
1445 var bytes=arguments[0];
1446 var offset=arguments[1];
1447 var length=arguments[2];
1448 if(arguments[2]instanceof Array){
1450 offset=arguments[0];
1451 length=arguments[1];
1453 var arr=new Array(length);
1454 if(offset<0||length+offset>bytes.length){
1455 throw new IndexOutOfBoundsException();
1458 var isChar=(bytes[offset].length!=null);
1460 for(var i=0;i<length;i++){
1461 arr[i]=bytes[offset+i];
1464 for(var i=0;i<length;i++){
1465 arr[i]=String.fromCharCode(bytes[offset+i]);
1469 return arr.join('');
1470 }else if(arguments.length==4){
1471 var bytes=arguments[0];
1473 if(typeof y=="string"||y instanceof String){
1474 var offset=arguments[1];
1475 var length=arguments[2];
1476 var arr=new Array(length);
1477 for(var i=0;i<length;i++){
1478 arr[i]=bytes[offset+i];
1479 if(typeof arr[i]=="number"){
1480 arr[i]=String.fromCharCode(arr[i]&0xff);
1483 var cs=y.toLowerCase();
1484 if(cs=="utf-8"||cs=="utf8"){
1485 return Encoding.readUTF8(arr.join(''));
1487 return arr.join('');
1490 var count=arguments[3];
1491 var offset=arguments[2];
1492 var hibyte=arguments[1];
1493 var value=new Array(count);
1495 for(var i=count;i-->0;){
1496 value[i]=String.fromCharCode(bytes[i+offset]&0xff);
1500 for(var i=count;i-->0;){
1501 value[i]=String.fromCharCode(hibyte|(bytes[i+offset]&0xff));
1504 return value.join('');
1508 for(var i=0;i<arguments.length;i++){
1519 String.instantialize=function(){
1520 switch (arguments.length) {
1522 return new String();
1525 if(typeof x=="string"||x instanceof String){
1526 return new String(x);
1528 if(x instanceof Array || x instanceof Int32Array){
1531 if(typeof x[0]!="number")
1533 var arr=new Array(x.length);
1534 for(var i=0;i<x.length;i++)
1535 arr[i]=String.fromCharCode(x[i]&0xff);
1536 return Encoding.readUTF8(arr.join(''));
1538 if(x.__CLASS_NAME__=="StringBuffer"||x.__CLASS_NAME__=="java.lang.StringBuffer"){
1539 var value=x.shareValue();
1540 var length=x.length();
1541 var valueCopy=new Array(length);
1542 for(var i=0;i<length;i++){
1543 valueCopy[i]=value[i];
1545 return valueCopy.join('')
1550 var hibyte=arguments[1];
1551 if(typeof hibyte=="string"){
1552 return String.instantialize(x,0,x.length,hibyte);
1554 return String.instantialize(x,hibyte,0,x.length);
1556 var bytes=arguments[0];
1557 var offset=arguments[1];
1558 var length=arguments[2];
1559 if(arguments[2]instanceof Array){
1561 offset=arguments[0];
1562 length=arguments[1];
1564 var arr=new Array(length);
1565 if(offset<0||length+offset>bytes.length){
1566 throw new IndexOutOfBoundsException();
1569 var isChar=(bytes[offset].length!=null);
1571 for(var i=0;i<length;i++){
1572 arr[i]=bytes[offset+i];
1575 for(var i=0;i<length;i++){
1576 arr[i]=String.fromCharCode(bytes[offset+i]);
1580 return arr.join('');
1582 var bytes=arguments[0];
1584 if(typeof y=="string"||y instanceof String){
1585 var offset=arguments[1];
1586 var length=arguments[2];
1587 var arr=new Array(length);
1588 for(var i=0;i<length;i++){
1589 arr[i]=bytes[offset+i];
1590 if(typeof arr[i]=="number"){
1591 arr[i]=String.fromCharCode(arr[i]&0xff);
1594 var cs=y.toLowerCase();
1595 if(cs=="utf-8"||cs=="utf8"){
1596 return Encoding.readUTF8(arr.join(''));
1598 return arr.join('');
1600 var count=arguments[3];
1601 var offset=arguments[2];
1602 var hibyte=arguments[1];
1603 var value=new Array(count);
1605 for(var i=count;i-->0;){
1606 value[i]=String.fromCharCode(bytes[i+offset]&0xff);
1610 for(var i=count;i-->0;){
1611 value[i]=String.fromCharCode(hibyte|(bytes[i+offset]&0xff));
1614 return value.join('');
1617 for(var i=0;i<arguments.length;i++){
1624 if(navigator.userAgent.toLowerCase().indexOf("chrome")!=-1){
1625 String.prototype.toString=function(){return this.valueOf();};
1630 })(Clazz._Encoding);
1634 c$=Clazz.decorateAsClass(function(){
1636 Clazz.instantialize(this,arguments);
1637 },java.lang,"Character",null,[java.io.Serializable,Comparable]);
1638 Clazz.makeConstructor(c$,
1642 Clazz.defineMethod(c$,"charValue",
1646 Clazz.overrideMethod(c$,"hashCode",
1648 return(this.value).charCodeAt(0);
1650 Clazz.overrideMethod(c$,"equals",
1652 if(Clazz.instanceOf(obj,Character)){
1653 return(this.value).charCodeAt(0)==((obj).charValue()).charCodeAt(0);
1656 Clazz.overrideMethod(c$,"compareTo",
1658 return(this.value).charCodeAt(0)-(c.value).charCodeAt(0);
1660 c$.toLowerCase=Clazz.defineMethod(c$,"toLowerCase",
1662 return(""+c).toLowerCase().charAt(0);
1664 c$.toUpperCase=Clazz.defineMethod(c$,"toUpperCase",
1666 return(""+c).toUpperCase().charAt(0);
1668 c$.isDigit=Clazz.defineMethod(c$,"isDigit",
1670 c = c.charCodeAt(0);
1671 return (48 <= c && c <= 57);
1673 c$.isUpperCase=Clazz.defineMethod(c$,"isUpperCase",
1675 c = c.charCodeAt(0);
1676 return (65 <= c && c <= 90);
1678 c$.isLowerCase=Clazz.defineMethod(c$,"isLowerCase",
1680 c = c.charCodeAt(0);
1681 return (97 <= c && c <= 122);
1683 c$.isWhitespace=Clazz.defineMethod(c$,"isWhitespace",
1685 c = (c).charCodeAt(0);
1686 return (c >= 0x1c && c <= 0x20 || c >= 0x9 && c <= 0xd || c == 0x1680
1687 || c >= 0x2000 && c != 0x2007 && (c <= 0x200b || c == 0x2028 || c == 0x2029 || c == 0x3000));
1689 c$.isLetter=Clazz.defineMethod(c$,"isLetter",
1691 c = c.charCodeAt(0);
1692 return (65 <= c && c <= 90 || 97 <= c && c <= 122);
1694 c$.isLetterOrDigit=Clazz.defineMethod(c$,"isLetterOrDigit",
1696 c = c.charCodeAt(0);
1697 return (65 <= c && c <= 90 || 97 <= c && c <= 122 || 48 <= c && c <= 57);
1699 c$.isSpaceChar=Clazz.defineMethod(c$,"isSpaceChar",
1701 var i = c.charCodeAt(0);
1702 if(i==0x20||i==0xa0||i==0x1680)return true;
1703 if(i<0x2000)return false;
1704 return i<=0x200b||i==0x2028||i==0x2029||i==0x202f||i==0x3000;
1706 c$.digit=Clazz.defineMethod(c$,"digit",
1708 var i = c.charCodeAt(0);
1709 if(radix >= 2 && radix <= 36){
1712 if(48 <= i && i <= 57){
1714 }else if(97 <= i && i <= 122){
1716 }else if(65 <= i && i <= 90){
1719 return (result < radix ? result : -1);
1724 Clazz.overrideMethod(c$,"toString",
1726 var buf=[this.value];
1727 return String.valueOf(buf);
1729 c$.toString=Clazz.overrideMethod(c$,"toString",
1732 if(this===Character){
1733 return"class java.lang.Character";
1735 }return String.valueOf(c);
1737 Clazz.defineStatics(c$,
1738 "MIN_VALUE",'\u0000',
1739 "MAX_VALUE",'\uffff',
1744 java.lang.Character.TYPE=java.lang.Character.prototype.TYPE=java.lang.Character;
1748 Clazz._ArrayWrapper = function(a, type) {
1751 __CLASS_NAME__:"Array",
1753 getComponentType: function() {return type},
1754 instanceOf: function(o) { return Clazz.instanceOf(type, o) },
1755 getName: function() { return this.__CLASS_NAME__ }
1758 c$=Clazz_declareType(java.lang.reflect,"Array");
1759 c$.newInstance=Clazz_defineMethod(c$,"newInstance",
1760 function(componentType,size){
1761 var a = Clazz_newArray(size);
1762 a.getClass = function() { return new Clazz._ArrayWrapper(this, componentType);};
1767 Date.TYPE="javautil.Date";
1768 Date.__CLASS_NAME__="Date";
1769 Clazz.implementOf(Date,[java.io.Serializable,java.lang.Comparable]);
1771 Clazz.defineMethod(javautil.Date,"clone",
1773 return new Date(this.getTime());
1776 Clazz.defineMethod(javautil.Date,"before",
1778 return this.getTime()<when.getTime();
1780 Clazz.defineMethod(javautil.Date,"after",
1782 return this.getTime()>when.getTime();
1784 Clazz.defineMethod(javautil.Date,"equals",
1786 return Clazz.instanceOf(obj,javautil.Date)&&this.getTime()==(obj).getTime();
1788 Clazz.defineMethod(javautil.Date,"compareTo",
1789 function(anotherDate){
1790 var thisTime=this.getTime();
1791 var anotherTime=anotherDate.getTime();
1792 return(thisTime<anotherTime?-1:(thisTime==anotherTime?0:1));
1794 Clazz.defineMethod(javautil.Date,"compareTo",
1796 return this.compareTo(o);
1798 Clazz.overrideMethod(javautil.Date,"hashCode",
1800 var ht=this.getTime();
1801 return parseInt(ht)^parseInt((ht>>32));
1804 c$=Clazz.decorateAsClass(function(){
1806 Clazz.instantialize(this,arguments);
1807 },javautil,"EventObject",null,java.io.Serializable);
1808 Clazz.makeConstructor(c$,
1810 if(source!=null)this.source=source;
1811 else throw new IllegalArgumentException();
1813 Clazz.defineMethod(c$,"getSource",
1817 Clazz.overrideMethod(c$,"toString",
1819 return this.getClass().getName()+"[source="+String.valueOf(this.source)+']';
1821 Clazz.declareInterface(javautil,"EventListener");
1823 c$=Clazz.decorateAsClass(function(){
1825 Clazz.instantialize(this,arguments);
1826 },javautil,"EventListenerProxy",null,javautil.EventListener);
1827 Clazz.makeConstructor(c$,
1829 this.listener=listener;
1830 },"javautil.EventListener");
1831 Clazz.defineMethod(c$,"getListener",
1833 return this.listener;
1835 Clazz.declareInterface(javautil,"Iterator");
1837 Clazz.declareInterface(javautil,"ListIterator",javautil.Iterator);
1838 Clazz.declareInterface(javautil,"Enumeration");
1839 Clazz.declareInterface(javautil,"Collection",Iterable);
1841 Clazz.declareInterface(javautil,"Set",javautil.Collection);
1842 Clazz.declareInterface(javautil,"Map");
1843 Clazz.declareInterface(javautil.Map,"Entry");
1845 Clazz.declareInterface(javautil,"List",javautil.Collection);
1847 Clazz.declareInterface(javautil,"Queue",javautil.Collection);
1848 Clazz.declareInterface(javautil,"RandomAccess");
1849 c$=Clazz.decorateAsClass(function(){
1850 this.detailMessage=null;
1852 this.stackTrace=null;
1853 Clazz.instantialize(this,arguments);
1854 },java.lang,"Throwable",null,java.io.Serializable);
1855 Clazz.prepareFields(c$,function(){
1857 //alert("e0 "+ arguments.callee.caller.caller.caller.caller.caller)
1859 Clazz.makeConstructor(c$,
1861 this.fillInStackTrace();
1863 Clazz.makeConstructor(c$,
1865 this.fillInStackTrace();
1866 this.detailMessage=message;
1868 Clazz.makeConstructor(c$,
1869 function(message,cause){
1870 this.fillInStackTrace();
1871 this.detailMessage=message;
1874 Clazz.makeConstructor(c$,
1876 this.fillInStackTrace();
1877 this.detailMessage=(cause==null?null:cause.toString());
1880 Clazz.defineMethod(c$,"getMessage",
1882 return (this.message || this.detailMessage || this.toString());
1884 Clazz.defineMethod(c$,"getLocalizedMessage",
1886 return this.getMessage();
1888 Clazz.defineMethod(c$,"getCause",
1890 return(this.cause===this?null:this.cause);
1892 Clazz.defineMethod(c$,"initCause",
1894 if(this.cause!==this)throw new IllegalStateException("Can't overwrite cause");
1895 if(cause===this)throw new IllegalArgumentException("Self-causation not permitted");
1899 Clazz.overrideMethod(c$,"toString",
1901 var s=this.getClass().getName();
1902 var message=this.message || this.detailMessage;
1903 return(message ? s+": "+message : s);
1905 Clazz.defineMethod(c$,"printStackTrace",
1907 System.err.println(this.getStackTrace ? this.getStackTrace() : this.message + " " + Clazz.getStackTrace());
1910 Clazz.defineMethod(c$,"getStackTrace",
1912 var s = "" + this + "\n";
1913 for(var i=0;i<this.stackTrace.length;i++){
1914 var t=this.stackTrace[i];
1915 var x=t.methodName.indexOf("(");
1916 var n=t.methodName.substring(0,x).replace(/\s+/g,"");
1917 if(n!="construct"||t.nativeClazz==null
1918 ||Clazz.getInheritedLevel(t.nativeClazz,Throwable)<0){
1926 Clazz.defineMethod(c$,"printStackTrace",
1928 this.printStackTrace();
1929 },"java.io.PrintStream");
1930 Clazz.defineMethod(c$,"printStackTrace",
1932 this.printStackTrace();
1933 },"java.io.PrintWriter");
1934 Clazz.defineMethod(c$,"fillInStackTrace",
1936 this.stackTrace=new Array();
1937 var caller=arguments.callee.caller;
1938 var superCaller=null;
1939 var callerList=new Array();
1940 var index=Clazz._callingStackTraces.length-1;
1942 while(index>-1||caller!=null){
1944 var nativeClass=null;
1945 if(!noLooping||caller==Clazz.tryToSearchAndExecute||caller==Clazz.superCall||caller==null){
1950 superCaller=Clazz._callingStackTraces[index].caller;
1951 nativeClass=Clazz._callingStackTraces[index].owner;
1955 if(superCaller.claxxOwner!=null){
1956 nativeClass=superCaller.claxxOwner;
1957 }else if(superCaller.exClazz!=null){
1958 nativeClass=superCaller.exClazz;
1961 var st=new StackTraceElement(
1962 ((nativeClass!=null&&nativeClass.__CLASS_NAME__.length!=0)?
1963 nativeClass.__CLASS_NAME__:"anonymous"),
1964 ((superCaller.exName==null)?"anonymous":superCaller.exName)
1965 +" ("+Clazz.getParamsType(superCaller.arguments)+")",
1967 st.nativeClazz=nativeClass;
1968 this.stackTrace[this.stackTrace.length]=st;
1969 for(var i=0;i<callerList.length;i++){
1970 if(callerList[i]==superCaller){
1972 var st=new StackTraceElement("lost","missing",null,-3);
1973 st.nativeClazz=null;
1974 this.stackTrace[this.stackTrace.length]=st;
1979 if(superCaller!=null){
1980 callerList[callerList.length]=superCaller;
1982 caller=superCaller.arguments.callee.caller;
1984 Clazz._initializingException=false;
1987 Clazz.defineMethod(c$,"setStackTrace",
1988 function(stackTrace){
1989 var defensiveCopy=stackTrace.clone();
1990 for(var i=0;i<defensiveCopy.length;i++)if(defensiveCopy[i]==null)throw new NullPointerException("stackTrace["+i+"]");
1992 this.stackTrace=defensiveCopy;
1995 c$=Clazz.decorateAsClass(function(){
1996 this.declaringClass=null;
1997 this.methodName=null;
2000 Clazz.instantialize(this,arguments);
2001 },java.lang,"StackTraceElement",null,java.io.Serializable);
2002 Clazz.makeConstructor(c$,
2003 function(cls,method,file,line){
2004 if(cls==null||method==null){
2005 throw new NullPointerException();
2006 }this.declaringClass=cls;
2007 this.methodName=method;
2009 this.lineNumber=line;
2011 Clazz.overrideMethod(c$,"equals",
2013 if(!(Clazz.instanceOf(obj,StackTraceElement))){
2016 if((this.methodName==null)||(castObj.methodName==null)){
2018 }if(!this.getMethodName().equals(castObj.getMethodName())){
2020 }if(!this.getClassName().equals(castObj.getClassName())){
2022 }var localFileName=this.getFileName();
2023 if(localFileName==null){
2024 if(castObj.getFileName()!=null){
2027 if(!localFileName.equals(castObj.getFileName())){
2029 }}if(this.getLineNumber()!=castObj.getLineNumber()){
2033 Clazz.defineMethod(c$,"getClassName",
2035 return(this.declaringClass==null)?"<unknown class>":this.declaringClass;
2037 Clazz.defineMethod(c$,"getFileName",
2039 return this.fileName;
2041 Clazz.defineMethod(c$,"getLineNumber",
2043 return this.lineNumber;
2045 Clazz.defineMethod(c$,"getMethodName",
2047 return(this.methodName==null)?"<unknown method>":this.methodName;
2049 Clazz.overrideMethod(c$,"hashCode",
2051 if(this.methodName==null){
2053 }return this.methodName.hashCode()^this.declaringClass.hashCode();
2055 Clazz.defineMethod(c$,"isNativeMethod",
2057 return this.lineNumber==-2;
2059 Clazz.overrideMethod(c$,"toString",
2061 var buf=new StringBuilder(80);
2062 buf.append(this.getClassName());
2064 buf.append(this.getMethodName());
2065 if(this.isNativeMethod()){
2066 buf.append("(Native Method)");
2068 var fName=this.getFileName();
2070 buf.append("(Unknown Source)");
2072 var lineNum=this.getLineNumber();
2077 buf.append(lineNum);
2079 }}return buf.toString();
2081 TypeError.prototype.getMessage || (TypeError.prototype.getMessage = function(){ return (this.message || this.toString()) + (this.getStackTrace ? this.getStackTrace() : Clazz.getStackTrace())});
2082 c$=Clazz.declareType(java.lang,"Error",Throwable);
2084 c$=Clazz.declareType(java.lang,"LinkageError",Error);
2086 c$=Clazz.declareType(java.lang,"IncompatibleClassChangeError",LinkageError);
2088 c$=Clazz.declareType(java.lang,"AbstractMethodError",IncompatibleClassChangeError);
2090 c$=Clazz.declareType(java.lang,"AssertionError",Error);
2091 Clazz.makeConstructor(c$,
2092 function(detailMessage){
2093 Clazz.superConstructor(this,AssertionError,[String.valueOf(detailMessage),(Clazz.instanceOf(detailMessage,Throwable)?detailMessage:null)]);
2095 Clazz.makeConstructor(c$,
2096 function(detailMessage){
2097 this.construct("" + detailMessage);
2099 Clazz.makeConstructor(c$,
2100 function(detailMessage){
2101 this.construct("" + detailMessage);
2104 c$=Clazz.declareType(java.lang,"ClassCircularityError",LinkageError);
2106 c$=Clazz.declareType(java.lang,"ClassFormatError",LinkageError);
2108 c$=Clazz.decorateAsClass(function(){
2109 this.exception=null;
2110 Clazz.instantialize(this,arguments);
2111 },java.lang,"ExceptionInInitializerError",LinkageError);
2112 Clazz.makeConstructor(c$,
2114 Clazz.superConstructor(this,ExceptionInInitializerError);
2115 this.initCause(null);
2117 Clazz.makeConstructor(c$,
2118 function(detailMessage){
2119 Clazz.superConstructor(this,ExceptionInInitializerError,[detailMessage]);
2120 this.initCause(null);
2122 Clazz.makeConstructor(c$,
2123 function(exception){
2124 Clazz.superConstructor(this,ExceptionInInitializerError);
2125 this.exception=exception;
2126 this.initCause(exception);
2128 Clazz.defineMethod(c$,"getException",
2130 return this.exception;
2132 Clazz.overrideMethod(c$,"getCause",
2134 return this.exception;
2137 c$=Clazz.declareType(java.lang,"IllegalAccessError",IncompatibleClassChangeError);
2139 c$=Clazz.declareType(java.lang,"InstantiationError",IncompatibleClassChangeError);
2141 c$=Clazz.declareType(java.lang,"VirtualMachineError",Error);
2143 c$=Clazz.declareType(java.lang,"InternalError",VirtualMachineError);
2145 c$=Clazz.declareType(java.lang,"NoClassDefFoundError",LinkageError);
2147 c$=Clazz.declareType(java.lang,"NoSuchFieldError",IncompatibleClassChangeError);
2149 c$=Clazz.declareType(java.lang,"NoSuchMethodError",IncompatibleClassChangeError);
2151 c$=Clazz.declareType(java.lang,"OutOfMemoryError",VirtualMachineError);
2153 c$=Clazz.declareType(java.lang,"StackOverflowError",VirtualMachineError);
2155 c$=Clazz.declareType(java.lang,"UnknownError",VirtualMachineError);
2157 c$=Clazz.declareType(java.lang,"UnsatisfiedLinkError",LinkageError);
2159 c$=Clazz.declareType(java.lang,"UnsupportedClassVersionError",ClassFormatError);
2161 c$=Clazz.declareType(java.lang,"VerifyError",LinkageError);
2163 c$=Clazz.declareType(java.lang,"ThreadDeath",Error);
2164 Clazz.makeConstructor(c$,
2166 Clazz.superConstructor(this,ThreadDeath,[]);
2169 c$=Clazz.declareType(java.lang,"Exception",Throwable);
2171 c$=Clazz.declareType(java.lang,"RuntimeException",Exception);
2173 c$=Clazz.declareType(java.lang,"ArithmeticException",RuntimeException);
2175 c$=Clazz.declareType(java.lang,"IndexOutOfBoundsException",RuntimeException);
2177 c$=Clazz.declareType(java.lang,"ArrayIndexOutOfBoundsException",IndexOutOfBoundsException);
2178 Clazz.makeConstructor(c$,
2180 Clazz.superConstructor(this,ArrayIndexOutOfBoundsException,["Array index out of range: "+index]);
2183 c$=Clazz.declareType(java.lang,"ArrayStoreException",RuntimeException);
2185 c$=Clazz.declareType(java.lang,"ClassCastException",RuntimeException);
2187 c$=Clazz.decorateAsClass(function(){
2189 Clazz.instantialize(this,arguments);
2190 },java.lang,"ClassNotFoundException",Exception);
2191 Clazz.makeConstructor(c$,
2193 Clazz.superConstructor(this,ClassNotFoundException,[Clazz.castNullAs("Throwable")]);
2195 Clazz.makeConstructor(c$,
2196 function(detailMessage){
2197 Clazz.superConstructor(this,ClassNotFoundException,[detailMessage,null]);
2199 Clazz.makeConstructor(c$,
2200 function(detailMessage,exception){
2201 Clazz.superConstructor(this,ClassNotFoundException,[detailMessage]);
2204 Clazz.defineMethod(c$,"getException",
2208 Clazz.overrideMethod(c$,"getCause",
2213 c$=Clazz.declareType(java.lang,"CloneNotSupportedException",Exception);
2215 c$=Clazz.declareType(java.lang,"IllegalAccessException",Exception);
2217 c$=Clazz.declareType(java.lang,"IllegalArgumentException",RuntimeException);
2218 Clazz.makeConstructor(c$,
2220 Clazz.superConstructor(this,IllegalArgumentException,[(cause==null?null:cause.toString()),cause]);
2223 c$=Clazz.declareType(java.lang,"IllegalMonitorStateException",RuntimeException);
2225 c$=Clazz.declareType(java.lang,"IllegalStateException",RuntimeException);
2226 Clazz.makeConstructor(c$,
2228 Clazz.superConstructor(this,IllegalStateException,[(cause==null?null:cause.toString()),cause]);
2231 c$=Clazz.declareType(java.lang,"IllegalThreadStateException",IllegalArgumentException);
2233 c$=Clazz.declareType(java.lang,"InstantiationException",Exception);
2235 c$=Clazz.declareType(java.lang,"InterruptedException",Exception);
2237 c$=Clazz.declareType(java.lang,"NegativeArraySizeException",RuntimeException);
2239 c$=Clazz.declareType(java.lang,"NoSuchFieldException",Exception);
2241 c$=Clazz.declareType(java.lang,"NoSuchMethodException",Exception);
2243 c$=Clazz.declareType(java.lang,"NullPointerException",RuntimeException);
2245 c$=Clazz.declareType(java.lang,"NumberFormatException",IllegalArgumentException);
2247 c$=Clazz.declareType(java.lang,"SecurityException",RuntimeException);
2248 Clazz.makeConstructor(c$,
2250 Clazz.superConstructor(this,SecurityException,[(cause==null?null:cause.toString()),cause]);
2253 c$=Clazz.declareType(java.lang,"StringIndexOutOfBoundsException",IndexOutOfBoundsException);
2254 Clazz.makeConstructor(c$,
2256 Clazz.superConstructor(this,StringIndexOutOfBoundsException,["String index out of range: "+index]);
2259 c$=Clazz.declareType(java.lang,"UnsupportedOperationException",RuntimeException);
2260 Clazz.makeConstructor(c$,
2262 Clazz.superConstructor(this,UnsupportedOperationException,[]);
2264 Clazz.makeConstructor(c$,
2266 Clazz.superConstructor(this,UnsupportedOperationException,[(cause==null?null:cause.toString()),cause]);
2269 c$=Clazz.decorateAsClass(function(){
2271 Clazz.instantialize(this,arguments);
2272 },java.lang.reflect,"InvocationTargetException",Exception);
2273 Clazz.makeConstructor(c$,
2275 Clazz.superConstructor(this,java.lang.reflect.InvocationTargetException,[Clazz.castNullAs("Throwable")]);
2277 Clazz.makeConstructor(c$,
2278 function(exception){
2279 Clazz.superConstructor(this,java.lang.reflect.InvocationTargetException,[null,exception]);
2280 this.target=exception;
2282 Clazz.makeConstructor(c$,
2283 function(exception,detailMessage){
2284 Clazz.superConstructor(this,java.lang.reflect.InvocationTargetException,[detailMessage,exception]);
2285 this.target=exception;
2287 Clazz.defineMethod(c$,"getTargetException",
2291 Clazz.overrideMethod(c$,"getCause",
2296 c$=Clazz.decorateAsClass(function(){
2297 this.undeclaredThrowable=null;
2298 Clazz.instantialize(this,arguments);
2299 },java.lang.reflect,"UndeclaredThrowableException",RuntimeException);
2300 Clazz.makeConstructor(c$,
2301 function(exception){
2302 Clazz.superConstructor(this,java.lang.reflect.UndeclaredThrowableException);
2303 this.undeclaredThrowable=exception;
2304 this.initCause(exception);
2306 Clazz.makeConstructor(c$,
2307 function(exception,detailMessage){
2308 Clazz.superConstructor(this,java.lang.reflect.UndeclaredThrowableException,[detailMessage]);
2309 this.undeclaredThrowable=exception;
2310 this.initCause(exception);
2312 Clazz.defineMethod(c$,"getUndeclaredThrowable",
2314 return this.undeclaredThrowable;
2316 Clazz.overrideMethod(c$,"getCause",
2318 return this.undeclaredThrowable;
2321 c$=Clazz.declareType(java.io,"IOException",Exception);
2324 c$=Clazz.declareType(java.io,"CharConversionException",java.io.IOException);
2326 c$=Clazz.declareType(java.io,"EOFException",java.io.IOException);
2328 c$=Clazz.declareType(java.io,"FileNotFoundException",java.io.IOException);
2330 c$=Clazz.decorateAsClass(function(){
2331 this.bytesTransferred=0;
2332 Clazz.instantialize(this,arguments);
2333 },java.io,"InterruptedIOException",java.io.IOException);
2335 c$=Clazz.declareType(java.io,"ObjectStreamException",java.io.IOException);
2337 c$=Clazz.decorateAsClass(function(){
2338 this.classname=null;
2339 Clazz.instantialize(this,arguments);
2340 },java.io,"InvalidClassException",java.io.ObjectStreamException);
2341 Clazz.makeConstructor(c$,
2342 function(className,detailMessage){
2343 Clazz.superConstructor(this,java.io.InvalidClassException,[detailMessage]);
2344 this.classname=className;
2346 Clazz.defineMethod(c$,"getMessage",
2348 var msg=Clazz.superCall(this,java.io.InvalidClassException,"getMessage",[]);
2349 if(this.classname!=null){
2350 msg=this.classname+';' + ' '+msg;
2354 c$=Clazz.declareType(java.io,"InvalidObjectException",java.io.ObjectStreamException);
2356 c$=Clazz.declareType(java.io,"NotActiveException",java.io.ObjectStreamException);
2358 c$=Clazz.declareType(java.io,"NotSerializableException",java.io.ObjectStreamException);
2360 c$=Clazz.decorateAsClass(function(){
2363 Clazz.instantialize(this,arguments);
2364 },java.io,"OptionalDataException",java.io.ObjectStreamException);
2366 c$=Clazz.declareType(java.io,"StreamCorruptedException",java.io.ObjectStreamException);
2368 c$=Clazz.declareType(java.io,"SyncFailedException",java.io.IOException);
2370 c$=Clazz.declareType(java.io,"UnsupportedEncodingException",java.io.IOException);
2372 c$=Clazz.declareType(java.io,"UTFDataFormatException",java.io.IOException);
2374 c$=Clazz.decorateAsClass(function(){
2376 Clazz.instantialize(this,arguments);
2377 },java.io,"WriteAbortedException",java.io.ObjectStreamException);
2378 Clazz.makeConstructor(c$,
2379 function(detailMessage,rootCause){
2380 Clazz.superConstructor(this,java.io.WriteAbortedException,[detailMessage]);
2381 this.detail=rootCause;
2382 this.initCause(rootCause);
2384 Clazz.defineMethod(c$,"getMessage",
2386 var msg=Clazz.superCall(this,java.io.WriteAbortedException,"getMessage",[]);
2387 return (this.detail ? msg + "; "+this.detail.toString() : msg);
2389 Clazz.overrideMethod(c$,"getCause",
2394 c$=Clazz.declareType(javautil,"ConcurrentModificationException",RuntimeException);
2395 Clazz.makeConstructor(c$,
2397 Clazz.superConstructor(this,javautil.ConcurrentModificationException,[]);
2400 c$=Clazz.declareType(javautil,"EmptyStackException",RuntimeException);
2402 c$=Clazz.decorateAsClass(function(){
2403 this.className=null;
2405 Clazz.instantialize(this,arguments);
2406 },javautil,"MissingResourceException",RuntimeException);
2407 Clazz.makeConstructor(c$,
2408 function(detailMessage,className,resourceName){
2409 Clazz.superConstructor(this,javautil.MissingResourceException,[detailMessage]);
2410 this.className=className;
2411 this.key=resourceName;
2413 Clazz.defineMethod(c$,"getClassName",
2415 return this.className;
2417 Clazz.defineMethod(c$,"getKey",
2422 c$=Clazz.declareType(javautil,"NoSuchElementException",RuntimeException);
2424 c$=Clazz.declareType(javautil,"TooManyListenersException",Exception);
2426 c$=Clazz.declareType(java.lang,"Void");
2427 Clazz.defineStatics(c$,
2430 java.lang.Void.TYPE=java.lang.Void;
2431 }Clazz.declareInterface(java.lang.reflect,"GenericDeclaration");
2432 Clazz.declareInterface(java.lang.reflect,"AnnotatedElement");
2434 c$=Clazz.declareType(java.lang.reflect,"AccessibleObject",null,java.lang.reflect.AnnotatedElement);
2435 Clazz.makeConstructor(c$,
2438 Clazz.defineMethod(c$,"isAccessible",
2442 c$.setAccessible=Clazz.defineMethod(c$,"setAccessible",
2443 function(objects,flag){
2446 Clazz.defineMethod(c$,"setAccessible",
2450 Clazz.overrideMethod(c$,"isAnnotationPresent",
2451 function(annotationType){
2454 Clazz.overrideMethod(c$,"getDeclaredAnnotations",
2456 return new Array(0);
2458 Clazz.overrideMethod(c$,"getAnnotations",
2460 return new Array(0);
2462 Clazz.overrideMethod(c$,"getAnnotation",
2463 function(annotationType){
2466 c$.marshallArguments=Clazz.defineMethod(c$,"marshallArguments",
2467 function(parameterTypes,args){
2470 Clazz.defineMethod(c$,"invokeV",
2471 function(receiver,args){
2474 Clazz.defineMethod(c$,"invokeL",
2475 function(receiver,args){
2478 Clazz.defineMethod(c$,"invokeI",
2479 function(receiver,args){
2482 Clazz.defineMethod(c$,"invokeJ",
2483 function(receiver,args){
2486 Clazz.defineMethod(c$,"invokeF",
2487 function(receiver,args){
2490 Clazz.defineMethod(c$,"invokeD",
2491 function(receiver,args){
2494 c$.emptyArgs=c$.prototype.emptyArgs=new Array(0);
2495 Clazz.declareInterface(java.lang.reflect,"InvocationHandler");
2496 c$=Clazz.declareInterface(java.lang.reflect,"Member");
2497 Clazz.defineStatics(c$,
2501 c$=Clazz.declareType(java.lang.reflect,"Modifier");
2502 Clazz.makeConstructor(c$,
2505 c$.isAbstract=Clazz.defineMethod(c$,"isAbstract",
2506 function(modifiers){
2507 return((modifiers&1024)!=0);
2509 c$.isFinal=Clazz.defineMethod(c$,"isFinal",
2510 function(modifiers){
2511 return((modifiers&16)!=0);
2513 c$.isInterface=Clazz.defineMethod(c$,"isInterface",
2514 function(modifiers){
2515 return((modifiers&512)!=0);
2517 c$.isNative=Clazz.defineMethod(c$,"isNative",
2518 function(modifiers){
2519 return((modifiers&256)!=0);
2521 c$.isPrivate=Clazz.defineMethod(c$,"isPrivate",
2522 function(modifiers){
2523 return((modifiers&2)!=0);
2525 c$.isProtected=Clazz.defineMethod(c$,"isProtected",
2526 function(modifiers){
2527 return((modifiers&4)!=0);
2529 c$.isPublic=Clazz.defineMethod(c$,"isPublic",
2530 function(modifiers){
2531 return((modifiers&1)!=0);
2533 c$.isStatic=Clazz.defineMethod(c$,"isStatic",
2534 function(modifiers){
2535 return((modifiers&8)!=0);
2537 c$.isStrict=Clazz.defineMethod(c$,"isStrict",
2538 function(modifiers){
2539 return((modifiers&2048)!=0);
2541 c$.isSynchronized=Clazz.defineMethod(c$,"isSynchronized",
2542 function(modifiers){
2543 return((modifiers&32)!=0);
2545 c$.isTransient=Clazz.defineMethod(c$,"isTransient",
2546 function(modifiers){
2547 return((modifiers&128)!=0);
2549 c$.isVolatile=Clazz.defineMethod(c$,"isVolatile",
2550 function(modifiers){
2551 return((modifiers&64)!=0);
2553 c$.toString=Clazz.defineMethod(c$,"toString",
2554 function(modifiers){
2555 var sb=new Array(0);
2556 if(java.lang.reflect.Modifier.isPublic(modifiers))sb[sb.length]="public";
2557 if(java.lang.reflect.Modifier.isProtected(modifiers))sb[sb.length]="protected";
2558 if(java.lang.reflect.Modifier.isPrivate(modifiers))sb[sb.length]="private";
2559 if(java.lang.reflect.Modifier.isAbstract(modifiers))sb[sb.length]="abstract";
2560 if(java.lang.reflect.Modifier.isStatic(modifiers))sb[sb.length]="static";
2561 if(java.lang.reflect.Modifier.isFinal(modifiers))sb[sb.length]="final";
2562 if(java.lang.reflect.Modifier.isTransient(modifiers))sb[sb.length]="transient";
2563 if(java.lang.reflect.Modifier.isVolatile(modifiers))sb[sb.length]="volatile";
2564 if(java.lang.reflect.Modifier.isSynchronized(modifiers))sb[sb.length]="synchronized";
2565 if(java.lang.reflect.Modifier.isNative(modifiers))sb[sb.length]="native";
2566 if(java.lang.reflect.Modifier.isStrict(modifiers))sb[sb.length]="strictfp";
2567 if(java.lang.reflect.Modifier.isInterface(modifiers))sb[sb.length]="interface";
2569 return sb.join(" ");
2572 Clazz.defineStatics(c$,
2578 "SYNCHRONIZED",0x20,
2588 "ANNOTATION",0x2000,
2591 c$=Clazz.decorateAsClass(function(){
2593 this.parameterTypes=null;
2594 this.exceptionTypes=null;
2596 Clazz.instantialize(this,arguments);
2597 },java.lang.reflect,"Constructor",java.lang.reflect.AccessibleObject,[java.lang.reflect.GenericDeclaration,java.lang.reflect.Member]);
2598 Clazz.makeConstructor(c$,
2599 function(declaringClass,parameterTypes,checkedExceptions,modifiers){
2600 Clazz.superConstructor(this,java.lang.reflect.Constructor,[]);
2601 this.clazz=declaringClass;
2602 this.parameterTypes=parameterTypes;
2603 this.exceptionTypes=checkedExceptions;
2604 this.modifiers=modifiers;
2605 },"Class,~A,~A,~N");
2606 Clazz.overrideMethod(c$,"getTypeParameters",
2610 Clazz.defineMethod(c$,"toGenericString",
2614 Clazz.defineMethod(c$,"getGenericParameterTypes",
2618 Clazz.defineMethod(c$,"getGenericExceptionTypes",
2622 Clazz.defineMethod(c$,"getParameterAnnotations",
2626 Clazz.defineMethod(c$,"isVarArgs",
2630 Clazz.overrideMethod(c$,"isSynthetic",
2634 Clazz.overrideMethod(c$,"equals",
2636 if(object!=null&&Clazz.instanceOf(object,java.lang.reflect.Constructor)){
2638 if(this.getDeclaringClass()===other.getDeclaringClass()){
2639 var params1=this.parameterTypes;
2640 var params2=other.parameterTypes;
2641 if(params1.length==params2.length){
2642 for(var i=0;i<params1.length;i++){
2643 if(params1[i]!==params2[i])return false;
2648 Clazz.overrideMethod(c$,"getDeclaringClass",
2652 Clazz.defineMethod(c$,"getExceptionTypes",
2654 return this.exceptionTypes;
2656 Clazz.overrideMethod(c$,"getModifiers",
2658 return this.modifiers;
2660 Clazz.overrideMethod(c$,"getName",
2662 return this.getDeclaringClass().getName();
2664 Clazz.defineMethod(c$,"getParameterTypes",
2666 return this.parameterTypes;
2668 Clazz.overrideMethod(c$,"hashCode",
2670 return this.getDeclaringClass().getName().hashCode();
2672 Clazz.defineMethod(c$,"newInstance",
2674 var instance=new this.clazz(Clazz.inheritArgs);
2675 Clazz.instantialize(instance,args);
2678 Clazz.overrideMethod(c$,"toString",
2683 c$=Clazz.declareType(java.lang.reflect,"Field",java.lang.reflect.AccessibleObject,java.lang.reflect.Member);
2684 Clazz.overrideMethod(c$,"isSynthetic",
2688 Clazz.defineMethod(c$,"toGenericString",
2692 Clazz.defineMethod(c$,"isEnumConstant",
2696 Clazz.defineMethod(c$,"getGenericType",
2700 Clazz.overrideMethod(c$,"equals",
2704 Clazz.overrideMethod(c$,"getDeclaringClass",
2708 Clazz.overrideMethod(c$,"getName",
2712 Clazz.defineMethod(c$,"getType",
2716 Clazz.overrideMethod(c$,"hashCode",
2720 Clazz.overrideMethod(c$,"toString",
2725 c$=Clazz.decorateAsClass(function(){
2728 this.returnType=null;
2729 this.parameterTypes=null;
2730 this.exceptionTypes=null;
2732 Clazz.instantialize(this,arguments);
2733 },java.lang.reflect,"Method",java.lang.reflect.AccessibleObject,[java.lang.reflect.GenericDeclaration,java.lang.reflect.Member]);
2734 Clazz.makeConstructor(c$,
2735 function(declaringClass,name,parameterTypes,returnType,checkedExceptions,modifiers){
2736 Clazz.superConstructor(this,java.lang.reflect.Method,[]);
2737 this.clazz=declaringClass;
2739 this.parameterTypes=parameterTypes;
2740 this.returnType=returnType;
2741 this.exceptionTypes=checkedExceptions;
2742 this.modifiers=modifiers;
2743 },"Class,~S,~A,Class,~A,~N");
2744 Clazz.overrideMethod(c$,"getTypeParameters",
2748 Clazz.defineMethod(c$,"toGenericString",
2752 Clazz.defineMethod(c$,"getGenericParameterTypes",
2756 Clazz.defineMethod(c$,"getGenericExceptionTypes",
2760 Clazz.defineMethod(c$,"getGenericReturnType",
2764 Clazz.defineMethod(c$,"getParameterAnnotations",
2768 Clazz.defineMethod(c$,"isVarArgs",
2772 Clazz.defineMethod(c$,"isBridge",
2776 Clazz.overrideMethod(c$,"isSynthetic",
2780 Clazz.defineMethod(c$,"getDefaultValue",
2784 Clazz.overrideMethod(c$,"equals",
2786 if(object!=null&&Clazz.instanceOf(object,java.lang.reflect.Method)){
2788 if((this.getDeclaringClass()===other.getDeclaringClass())&&(this.getName()===other.getName())){
2789 var params1=this.parameterTypes;
2790 var params2=other.parameterTypes;
2791 if(params1.length==params2.length){
2792 for(var i=0;i<params1.length;i++){
2793 if(params1[i]!==params2[i])return false;
2798 Clazz.overrideMethod(c$,"getDeclaringClass",
2802 Clazz.defineMethod(c$,"getExceptionTypes",
2804 return this.exceptionTypes;
2806 Clazz.overrideMethod(c$,"getModifiers",
2808 return this.modifiers;
2810 Clazz.overrideMethod(c$,"getName",
2814 Clazz.defineMethod(c$,"getParameterTypes",
2816 return this.parameterTypes;
2818 Clazz.defineMethod(c$,"getReturnType",
2820 return this.returnType;
2822 Clazz.overrideMethod(c$,"hashCode",
2824 return this.getDeclaringClass().getName().hashCode()^this.getName().hashCode();
2826 Clazz.defineMethod(c$,"invoke",
2827 function(receiver,args){
2828 var m=this.clazz.prototype[this.getName()];
2830 m=this.clazz[this.getName()];
2833 m.apply(receiver,args);
2838 Clazz.overrideMethod(c$,"toString",