1 Clazz.declarePackage ("javax.swing.text");
\r
2 Clazz.load (["java.text.CharacterIterator"], "javax.swing.text.Segment", ["java.lang.IllegalArgumentException", "$.StringIndexOutOfBoundsException"], function () {
\r
3 c$ = Clazz.decorateAsClass (function () {
\r
7 this.partialReturn = false;
\r
9 Clazz.instantialize (this, arguments);
\r
10 }, javax.swing.text, "Segment", null, [Cloneable, java.text.CharacterIterator, CharSequence]);
\r
11 Clazz.makeConstructor (c$,
\r
13 this.construct (null, 0, 0);
\r
15 Clazz.makeConstructor (c$,
\r
16 function (array, offset, count) {
\r
18 this.offset = offset;
\r
20 this.partialReturn = false;
\r
22 Clazz.defineMethod (c$, "setPartialReturn",
\r
24 this.partialReturn = p;
\r
26 Clazz.defineMethod (c$, "isPartialReturn",
\r
28 return this.partialReturn;
\r
30 Clazz.overrideMethod (c$, "toString",
\r
32 if (this.array != null) {
\r
33 return String.instantialize (this.array, this.offset, this.count);
\r
34 }return String.instantialize ();
\r
36 Clazz.overrideMethod (c$, "first",
\r
38 this.pos = this.offset;
\r
39 if (this.count != 0) {
\r
40 return this.array[this.pos];
\r
43 Clazz.overrideMethod (c$, "last",
\r
45 this.pos = this.offset + this.count;
\r
46 if (this.count != 0) {
\r
48 return this.array[this.pos];
\r
51 Clazz.overrideMethod (c$, "current",
\r
53 if (this.count != 0 && this.pos < this.offset + this.count) {
\r
54 return this.array[this.pos];
\r
57 Clazz.overrideMethod (c$, "next",
\r
60 var end = this.offset + this.count;
\r
61 if (this.pos >= end) {
\r
64 }return this.current ();
\r
66 Clazz.overrideMethod (c$, "previous",
\r
68 if (this.pos == this.offset) {
\r
71 return this.current ();
\r
73 Clazz.overrideMethod (c$, "setIndex",
\r
74 function (position) {
\r
75 var end = this.offset + this.count;
\r
76 if ((position < this.offset) || (position > end)) {
\r
77 throw new IllegalArgumentException ("bad position: " + position);
\r
78 }this.pos = position;
\r
79 if ((this.pos != end) && (this.count != 0)) {
\r
80 return this.array[this.pos];
\r
83 Clazz.overrideMethod (c$, "getBeginIndex",
\r
87 Clazz.overrideMethod (c$, "getEndIndex",
\r
89 return this.offset + this.count;
\r
91 Clazz.overrideMethod (c$, "getIndex",
\r
95 Clazz.overrideMethod (c$, "charAt",
\r
97 if (index < 0 || index >= this.count) {
\r
98 throw new StringIndexOutOfBoundsException (index);
\r
99 }return this.array[this.offset + index];
\r
101 Clazz.overrideMethod (c$, "length",
\r
105 Clazz.overrideMethod (c$, "subSequence",
\r
106 function (start, end) {
\r
108 throw new StringIndexOutOfBoundsException (start);
\r
109 }if (end > this.count) {
\r
110 throw new StringIndexOutOfBoundsException (end);
\r
111 }if (start > end) {
\r
112 throw new StringIndexOutOfBoundsException (end - start);
\r
113 }var segment = new javax.swing.text.Segment ();
\r
114 segment.array = this.array;
\r
115 segment.offset = this.offset + start;
\r
116 segment.count = end - start;
\r
119 Clazz.overrideMethod (c$, "clone",
\r
123 o = Clazz.superCall (this, javax.swing.text.Segment, "clone", []);
\r
125 if (Clazz.exceptionOf (cnse, CloneNotSupportedException)) {
\r