1 Clazz.declarePackage ("org.xml.sax.helpers");
2 Clazz.load (["org.xml.sax.Attributes"], "org.xml.sax.helpers.AttributesImpl", ["java.lang.ArrayIndexOutOfBoundsException"], function () {
3 c$ = Clazz.decorateAsClass (function () {
6 Clazz.instantialize (this, arguments);
7 }, org.xml.sax.helpers, "AttributesImpl", null, org.xml.sax.Attributes);
8 Clazz.makeConstructor (c$,
13 Clazz.makeConstructor (c$,
15 this.setAttributes (atts);
16 }, "org.xml.sax.Attributes");
17 Clazz.defineMethod (c$, "getLength",
21 Clazz.defineMethod (c$, "getURI",
23 if (index >= 0 && index < this.length) {
24 return this.data[index * 5];
28 Clazz.defineMethod (c$, "getLocalName",
30 if (index >= 0 && index < this.length) {
31 return this.data[index * 5 + 1];
35 Clazz.defineMethod (c$, "getQName",
37 if (index >= 0 && index < this.length) {
38 return this.data[index * 5 + 2];
42 Clazz.defineMethod (c$, "getType",
44 if (index >= 0 && index < this.length) {
45 return this.data[index * 5 + 3];
49 Clazz.defineMethod (c$, "getValue",
51 if (index >= 0 && index < this.length) {
52 return this.data[index * 5 + 4];
56 Clazz.defineMethod (c$, "getIndex",
57 function (uri, localName) {
58 var max = this.length * 5;
59 for (var i = 0; i < max; i += 5) {
60 if (this.data[i].equals (uri) && this.data[i + 1].equals (localName)) {
61 return Clazz.doubleToInt (i / 5);
65 Clazz.defineMethod (c$, "getIndex",
67 var max = this.length * 5;
68 for (var i = 0; i < max; i += 5) {
69 if (this.data[i + 2].equals (qName)) {
70 return Clazz.doubleToInt (i / 5);
74 Clazz.defineMethod (c$, "getType",
75 function (uri, localName) {
76 var max = this.length * 5;
77 for (var i = 0; i < max; i += 5) {
78 if (this.data[i].equals (uri) && this.data[i + 1].equals (localName)) {
79 return this.data[i + 3];
83 Clazz.defineMethod (c$, "getType",
85 var max = this.length * 5;
86 for (var i = 0; i < max; i += 5) {
87 if (this.data[i + 2].equals (qName)) {
88 return this.data[i + 3];
92 Clazz.defineMethod (c$, "getValue",
93 function (uri, localName) {
94 var max = this.length * 5;
95 for (var i = 0; i < max; i += 5) {
96 if (this.data[i].equals (uri) && this.data[i + 1].equals (localName)) {
97 return this.data[i + 4];
101 Clazz.defineMethod (c$, "getValue",
103 var max = this.length * 5;
104 for (var i = 0; i < max; i += 5) {
105 if (this.data[i + 2].equals (qName)) {
106 return this.data[i + 4];
110 Clazz.defineMethod (c$, "clear",
112 if (this.data != null) {
113 for (var i = 0; i < (this.length * 5); i++) this.data[i] = null;
117 Clazz.defineMethod (c$, "setAttributes",
120 this.length = atts.getLength ();
121 if (this.length > 0) {
122 this.data = new Array (this.length * 5);
123 for (var i = 0; i < this.length; i++) {
124 this.data[i * 5] = atts.getURI (i);
125 this.data[i * 5 + 1] = atts.getLocalName (i);
126 this.data[i * 5 + 2] = atts.getQName (i);
127 this.data[i * 5 + 3] = atts.getType (i);
128 this.data[i * 5 + 4] = atts.getValue (i);
130 }}, "org.xml.sax.Attributes");
131 Clazz.defineMethod (c$, "addAttribute",
132 function (uri, localName, qName, type, value) {
133 this.ensureCapacity (this.length + 1);
134 this.data[this.length * 5] = uri;
135 this.data[this.length * 5 + 1] = localName;
136 this.data[this.length * 5 + 2] = qName;
137 this.data[this.length * 5 + 3] = type;
138 this.data[this.length * 5 + 4] = value;
140 }, "~S,~S,~S,~S,~S");
141 Clazz.defineMethod (c$, "setAttribute",
142 function (index, uri, localName, qName, type, value) {
143 if (index >= 0 && index < this.length) {
144 this.data[index * 5] = uri;
145 this.data[index * 5 + 1] = localName;
146 this.data[index * 5 + 2] = qName;
147 this.data[index * 5 + 3] = type;
148 this.data[index * 5 + 4] = value;
150 this.badIndex (index);
151 }}, "~N,~S,~S,~S,~S,~S");
152 Clazz.defineMethod (c$, "removeAttribute",
154 if (index >= 0 && index < this.length) {
155 if (index < this.length - 1) {
156 System.arraycopy (this.data, (index + 1) * 5, this.data, index * 5, (this.length - index - 1) * 5);
157 }index = (this.length - 1) * 5;
158 this.data[index++] = null;
159 this.data[index++] = null;
160 this.data[index++] = null;
161 this.data[index++] = null;
162 this.data[index] = null;
165 this.badIndex (index);
167 Clazz.defineMethod (c$, "setURI",
168 function (index, uri) {
169 if (index >= 0 && index < this.length) {
170 this.data[index * 5] = uri;
172 this.badIndex (index);
174 Clazz.defineMethod (c$, "setLocalName",
175 function (index, localName) {
176 if (index >= 0 && index < this.length) {
177 this.data[index * 5 + 1] = localName;
179 this.badIndex (index);
181 Clazz.defineMethod (c$, "setQName",
182 function (index, qName) {
183 if (index >= 0 && index < this.length) {
184 this.data[index * 5 + 2] = qName;
186 this.badIndex (index);
188 Clazz.defineMethod (c$, "setType",
189 function (index, type) {
190 if (index >= 0 && index < this.length) {
191 this.data[index * 5 + 3] = type;
193 this.badIndex (index);
195 Clazz.defineMethod (c$, "setValue",
196 function (index, value) {
197 if (index >= 0 && index < this.length) {
198 this.data[index * 5 + 4] = value;
200 this.badIndex (index);
202 Clazz.defineMethod (c$, "ensureCapacity",
207 if (this.data == null || this.data.length == 0) {
209 } else if (this.data.length >= n * 5) {
212 max = this.data.length;
213 }while (max < n * 5) {
216 var newData = new Array (max);
217 if (this.length > 0) {
218 System.arraycopy (this.data, 0, newData, 0, this.length * 5);
219 }this.data = newData;
221 Clazz.defineMethod (c$, "badIndex",
223 var msg = "Attempt to modify attribute at illegal index: " + index;
224 throw new ArrayIndexOutOfBoundsException (msg);