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