209bbf9eb2487fcc3e045a98cb2a6ac2bcb22329
[jalviewjs.git] / site / swingjs / j2s / org / xml / sax / helpers / AttributeListImpl.js
1 Clazz.declarePackage ("org.xml.sax.helpers");
2 Clazz.load (["org.xml.sax.AttributeList", "java.util.Vector"], "org.xml.sax.helpers.AttributeListImpl", null, function () {
3 c$ = Clazz.decorateAsClass (function () {
4 this.names = null;
5 this.types = null;
6 this.values = null;
7 Clazz.instantialize (this, arguments);
8 }, org.xml.sax.helpers, "AttributeListImpl", null, org.xml.sax.AttributeList);
9 Clazz.prepareFields (c$, function () {
10 this.names =  new java.util.Vector ();
11 this.types =  new java.util.Vector ();
12 this.values =  new java.util.Vector ();
13 });
14 Clazz.makeConstructor (c$, 
15 function () {
16 });
17 Clazz.makeConstructor (c$, 
18 function (atts) {
19 this.setAttributeList (atts);
20 }, "org.xml.sax.AttributeList");
21 Clazz.defineMethod (c$, "setAttributeList", 
22 function (atts) {
23 var count = atts.getLength ();
24 this.clear ();
25 for (var i = 0; i < count; i++) {
26 this.addAttribute (atts.getName (i), atts.getType (i), atts.getValue (i));
27 }
28 }, "org.xml.sax.AttributeList");
29 Clazz.defineMethod (c$, "addAttribute", 
30 function (name, type, value) {
31 this.names.addElement (name);
32 this.types.addElement (type);
33 this.values.addElement (value);
34 }, "~S,~S,~S");
35 Clazz.defineMethod (c$, "removeAttribute", 
36 function (name) {
37 var i = this.names.indexOf (name);
38 if (i >= 0) {
39 this.names.removeElementAt (i);
40 this.types.removeElementAt (i);
41 this.values.removeElementAt (i);
42 }}, "~S");
43 Clazz.defineMethod (c$, "clear", 
44 function () {
45 this.names.removeAllElements ();
46 this.types.removeAllElements ();
47 this.values.removeAllElements ();
48 });
49 Clazz.defineMethod (c$, "getLength", 
50 function () {
51 return this.names.size ();
52 });
53 Clazz.defineMethod (c$, "getName", 
54 function (i) {
55 if (i < 0) {
56 return null;
57 }try {
58 return this.names.elementAt (i);
59 } catch (e) {
60 if (Clazz.exceptionOf (e, ArrayIndexOutOfBoundsException)) {
61 return null;
62 } else {
63 throw e;
64 }
65 }
66 }, "~N");
67 Clazz.defineMethod (c$, "getType", 
68 function (i) {
69 if (i < 0) {
70 return null;
71 }try {
72 return this.types.elementAt (i);
73 } catch (e) {
74 if (Clazz.exceptionOf (e, ArrayIndexOutOfBoundsException)) {
75 return null;
76 } else {
77 throw e;
78 }
79 }
80 }, "~N");
81 Clazz.defineMethod (c$, "getValue", 
82 function (i) {
83 if (i < 0) {
84 return null;
85 }try {
86 return this.values.elementAt (i);
87 } catch (e) {
88 if (Clazz.exceptionOf (e, ArrayIndexOutOfBoundsException)) {
89 return null;
90 } else {
91 throw e;
92 }
93 }
94 }, "~N");
95 Clazz.defineMethod (c$, "getType", 
96 function (name) {
97 return this.getType (this.names.indexOf (name));
98 }, "~S");
99 Clazz.defineMethod (c$, "getValue", 
100 function (name) {
101 return this.getValue (this.names.indexOf (name));
102 }, "~S");
103 });