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