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