1 Clazz.declarePackage ("javax.swing");
2 c$ = Clazz.decorateAsClass (function () {
4 Clazz.instantialize (this, arguments);
5 }, javax.swing, "SizeSequence");
6 Clazz.makeConstructor (c$,
8 this.a = javax.swing.SizeSequence.emptyArray;
10 Clazz.makeConstructor (c$,
11 function (numEntries) {
12 this.construct (numEntries, 0);
14 Clazz.makeConstructor (c$,
15 function (numEntries, value) {
17 this.insertEntries (0, numEntries, value);
19 Clazz.makeConstructor (c$,
22 this.setSizes (sizes);
24 Clazz.defineMethod (c$, "setSizes",
25 function (length, size) {
26 if (this.a.length != length) {
27 this.a = Clazz.newIntArray (length, 0);
28 }this.setSizes (0, length, size);
30 Clazz.defineMethod (c$, "setSizes",
31 function (from, to, size) {
34 }var m = Clazz.doubleToInt ((from + to) / 2);
35 this.a[m] = size + this.setSizes (from, m, size);
36 return this.a[m] + this.setSizes (m + 1, to, size);
38 Clazz.defineMethod (c$, "setSizes",
40 if (this.a.length != sizes.length) {
41 this.a = Clazz.newIntArray (sizes.length, 0);
42 }this.setSizes (0, this.a.length, sizes);
44 Clazz.defineMethod (c$, "setSizes",
45 function (from, to, sizes) {
48 }var m = Clazz.doubleToInt ((from + to) / 2);
49 this.a[m] = sizes[m] + this.setSizes (from, m, sizes);
50 return this.a[m] + this.setSizes (m + 1, to, sizes);
52 Clazz.defineMethod (c$, "getSizes",
54 var n = this.a.length;
55 var sizes = Clazz.newIntArray (n, 0);
56 this.getSizes (0, n, sizes);
59 Clazz.defineMethod (c$, "getSizes",
60 function (from, to, sizes) {
63 }var m = Clazz.doubleToInt ((from + to) / 2);
64 sizes[m] = this.a[m] - this.getSizes (from, m, sizes);
65 return this.a[m] + this.getSizes (m + 1, to, sizes);
67 Clazz.defineMethod (c$, "getPosition",
69 return this.getPosition (0, this.a.length, index);
71 Clazz.defineMethod (c$, "getPosition",
72 function (from, to, index) {
75 }var m = Clazz.doubleToInt ((from + to) / 2);
77 return this.getPosition (from, m, index);
79 return this.a[m] + this.getPosition (m + 1, to, index);
81 Clazz.defineMethod (c$, "getIndex",
83 return this.getIndex (0, this.a.length, position);
85 Clazz.defineMethod (c$, "getIndex",
86 function (from, to, position) {
89 }var m = Clazz.doubleToInt ((from + to) / 2);
90 var pivot = this.a[m];
91 if (position < pivot) {
92 return this.getIndex (from, m, position);
94 return this.getIndex (m + 1, to, position - pivot);
96 Clazz.defineMethod (c$, "getSize",
98 return this.getPosition (index + 1) - this.getPosition (index);
100 Clazz.defineMethod (c$, "setSize",
101 function (index, size) {
102 this.changeSize (0, this.a.length, index, size - this.getSize (index));
104 Clazz.defineMethod (c$, "changeSize",
105 function (from, to, index, delta) {
108 }var m = Clazz.doubleToInt ((from + to) / 2);
111 this.changeSize (from, m, index, delta);
113 this.changeSize (m + 1, to, index, delta);
115 Clazz.defineMethod (c$, "insertEntries",
116 function (start, length, value) {
117 var sizes = this.getSizes ();
118 var end = start + length;
119 var n = this.a.length + length;
120 this.a = Clazz.newIntArray (n, 0);
121 for (var i = 0; i < start; i++) {
122 this.a[i] = sizes[i];
124 for (var i = start; i < end; i++) {
127 for (var i = end; i < n; i++) {
128 this.a[i] = sizes[i - length];
130 this.setSizes (this.a);
132 Clazz.defineMethod (c$, "removeEntries",
133 function (start, length) {
134 var sizes = this.getSizes ();
135 var end = start + length;
136 var n = this.a.length - length;
137 this.a = Clazz.newIntArray (n, 0);
138 for (var i = 0; i < start; i++) {
139 this.a[i] = sizes[i];
141 for (var i = start; i < n; i++) {
142 this.a[i] = sizes[i + length];
144 this.setSizes (this.a);
146 Clazz.defineStatics (c$,
147 "emptyArray", Clazz.newIntArray (0, 0));