1 Clazz.declarePackage ("org.xml.sax.ext");
\r
2 Clazz.load (["org.xml.sax.ext.Attributes2", "org.xml.sax.helpers.AttributesImpl"], "org.xml.sax.ext.Attributes2Impl", ["java.lang.ArrayIndexOutOfBoundsException", "$.IllegalArgumentException"], function () {
\r
3 c$ = Clazz.decorateAsClass (function () {
\r
4 this.declared = null;
\r
5 this.specified = null;
\r
6 Clazz.instantialize (this, arguments);
\r
7 }, org.xml.sax.ext, "Attributes2Impl", org.xml.sax.helpers.AttributesImpl, org.xml.sax.ext.Attributes2);
\r
8 Clazz.makeConstructor (c$,
\r
10 Clazz.superConstructor (this, org.xml.sax.ext.Attributes2Impl, []);
\r
12 Clazz.defineMethod (c$, "isDeclared",
\r
14 if (index < 0 || index >= this.getLength ()) throw new ArrayIndexOutOfBoundsException ("No attribute at index: " + index);
\r
15 return this.declared[index];
\r
17 Clazz.defineMethod (c$, "isDeclared",
\r
18 function (uri, localName) {
\r
19 var index = this.getIndex (uri, localName);
\r
20 if (index < 0) throw new IllegalArgumentException ("No such attribute: local=" + localName + ", namespace=" + uri);
\r
21 return this.declared[index];
\r
23 Clazz.defineMethod (c$, "isDeclared",
\r
25 var index = this.getIndex (qName);
\r
26 if (index < 0) throw new IllegalArgumentException ("No such attribute: " + qName);
\r
27 return this.declared[index];
\r
29 Clazz.defineMethod (c$, "isSpecified",
\r
31 if (index < 0 || index >= this.getLength ()) throw new ArrayIndexOutOfBoundsException ("No attribute at index: " + index);
\r
32 return this.specified[index];
\r
34 Clazz.defineMethod (c$, "isSpecified",
\r
35 function (uri, localName) {
\r
36 var index = this.getIndex (uri, localName);
\r
37 if (index < 0) throw new IllegalArgumentException ("No such attribute: local=" + localName + ", namespace=" + uri);
\r
38 return this.specified[index];
\r
40 Clazz.defineMethod (c$, "isSpecified",
\r
42 var index = this.getIndex (qName);
\r
43 if (index < 0) throw new IllegalArgumentException ("No such attribute: " + qName);
\r
44 return this.specified[index];
\r
46 Clazz.defineMethod (c$, "setAttributes",
\r
48 var length = atts.getLength ();
\r
49 Clazz.superCall (this, org.xml.sax.ext.Attributes2Impl, "setAttributes", [atts]);
\r
50 this.declared = Clazz.newBooleanArray (length, false);
\r
51 this.specified = Clazz.newBooleanArray (length, false);
\r
52 if (Clazz.instanceOf (atts, org.xml.sax.ext.Attributes2)) {
\r
54 for (var i = 0; i < length; i++) {
\r
55 this.declared[i] = a2.isDeclared (i);
\r
56 this.specified[i] = a2.isSpecified (i);
\r
59 for (var i = 0; i < length; i++) {
\r
60 this.declared[i] = !"CDATA".equals (atts.getType (i));
\r
61 this.specified[i] = true;
\r
63 }}, "org.xml.sax.Attributes");
\r
64 Clazz.defineMethod (c$, "addAttribute",
\r
65 function (uri, localName, qName, type, value) {
\r
66 Clazz.superCall (this, org.xml.sax.ext.Attributes2Impl, "addAttribute", [uri, localName, qName, type, value]);
\r
67 var length = this.getLength ();
\r
68 if (length < this.specified.length) {
\r
70 newFlags = Clazz.newBooleanArray (length, false);
\r
71 System.arraycopy (this.declared, 0, newFlags, 0, this.declared.length);
\r
72 this.declared = newFlags;
\r
73 newFlags = Clazz.newBooleanArray (length, false);
\r
74 System.arraycopy (this.specified, 0, newFlags, 0, this.specified.length);
\r
75 this.specified = newFlags;
\r
76 }this.specified[length - 1] = true;
\r
77 this.declared[length - 1] = !"CDATA".equals (type);
\r
78 }, "~S,~S,~S,~S,~S");
\r
79 Clazz.defineMethod (c$, "removeAttribute",
\r
81 var origMax = this.getLength () - 1;
\r
82 Clazz.superCall (this, org.xml.sax.ext.Attributes2Impl, "removeAttribute", [index]);
\r
83 if (index != origMax) {
\r
84 System.arraycopy (this.declared, index + 1, this.declared, index, origMax - index);
\r
85 System.arraycopy (this.specified, index + 1, this.specified, index, origMax - index);
\r
87 Clazz.defineMethod (c$, "setDeclared",
\r
88 function (index, value) {
\r
89 if (index < 0 || index >= this.getLength ()) throw new ArrayIndexOutOfBoundsException ("No attribute at index: " + index);
\r
90 this.declared[index] = value;
\r
92 Clazz.defineMethod (c$, "setSpecified",
\r
93 function (index, value) {
\r
94 if (index < 0 || index >= this.getLength ()) throw new ArrayIndexOutOfBoundsException ("No attribute at index: " + index);
\r
95 this.specified[index] = value;
\r