Skip to content

Commit f01952a

Browse files
committed
remove() not working for intList, floatList, StringList (processing#1826)
1 parent 78dab6a commit f01952a

File tree

4 files changed

+63
-61
lines changed

4 files changed

+63
-61
lines changed

core/src/processing/data/FloatList.java

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@
88

99

1010
/**
11-
* Helper class for a list of floats. Lists are designed to have some of the
11+
* Helper class for a list of floats. Lists are designed to have some of the
1212
* features of ArrayLists, but to maintain the simplicity and efficiency of
13-
* working with arrays.
14-
*
15-
* Functions like sort() and shuffle() always act on the list itself. To get
13+
* working with arrays.
14+
*
15+
* Functions like sort() and shuffle() always act on the list itself. To get
1616
* a sorted copy, use list.copy().sort().
17-
*
17+
*
1818
* @webref data:composite
1919
*/
2020
public class FloatList implements Iterable<Float> {
@@ -62,7 +62,7 @@ private void crop() {
6262

6363
/**
6464
* Get the length of the list.
65-
*
65+
*
6666
* @webref floatlist:method
6767
* @brief Get the length of the list
6868
*/
@@ -127,8 +127,8 @@ public void set(int index, float what) {
127127

128128

129129
/**
130-
* Remove an element from the specified index.
131-
*
130+
* Remove an element from the specified index.
131+
*
132132
* @webref floatlist:method
133133
* @brief Remove an element from the specified index
134134
*/
@@ -138,7 +138,7 @@ public void remove(int index) {
138138
// count--;
139139
// System.arraycopy(data, index + 1, outgoing, 0, count - index);
140140
// data = outgoing;
141-
for (int i = index; i < count; i++) {
141+
for (int i = index; i < count-1; i++) {
142142
data[i] = data[i+1];
143143
}
144144
count--;
@@ -232,8 +232,8 @@ public boolean replaceValues(float value, float newValue) {
232232

233233

234234

235-
/**
236-
* Add a new entry to the list.
235+
/**
236+
* Add a new entry to the list.
237237
*
238238
* @webref floatlist:method
239239
* @brief Add a new entry to the list
@@ -516,8 +516,8 @@ public float max() {
516516
}
517517

518518

519-
/**
520-
* Sorts the array in place.
519+
/**
520+
* Sorts the array in place.
521521
*
522522
* @webref floatlist:method
523523
* @brief Sorts an array, lowest to highest
@@ -527,8 +527,8 @@ public void sort() {
527527
}
528528

529529

530-
/**
531-
* Reverse sort, orders values from highest to lowest
530+
/**
531+
* Reverse sort, orders values from highest to lowest
532532
*
533533
* @webref floatlist:method
534534
* @brief Reverse sort, orders values from highest to lowest
@@ -572,7 +572,7 @@ public void subset(int start, int num) {
572572
count = num;
573573
}
574574

575-
/**
575+
/**
576576
* @webref floatlist:method
577577
* @brief Reverse sort, orders values by first digit
578578
*/

core/src/processing/data/IntList.java

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@
1313

1414

1515
/**
16-
* Helper class for a list of ints. Lists are designed to have some of the
16+
* Helper class for a list of ints. Lists are designed to have some of the
1717
* features of ArrayLists, but to maintain the simplicity and efficiency of
18-
* working with arrays.
19-
*
20-
* Functions like sort() and shuffle() always act on the list itself. To get
18+
* working with arrays.
19+
*
20+
* Functions like sort() and shuffle() always act on the list itself. To get
2121
* a sorted copy, use list.copy().sort().
22-
*
22+
*
2323
* @webref data:composite
2424
*/
2525
public class IntList implements Iterable<Integer> {
@@ -67,7 +67,7 @@ private void crop() {
6767

6868
/**
6969
* Get the length of the list.
70-
*
70+
*
7171
* @webref floatlist:method
7272
* @brief Get the length of the list
7373
*/
@@ -91,7 +91,7 @@ public void resize(int length) {
9191

9292
/**
9393
* Remove all entries from the list.
94-
*
94+
*
9595
* @webref floatlist:method
9696
* @brief Remove all entries from the list
9797
*/
@@ -131,8 +131,8 @@ public void set(int index, int what) {
131131
}
132132

133133

134-
/**
135-
* Remove an element from the specified index
134+
/**
135+
* Remove an element from the specified index
136136
*
137137
* @webref floatlist:method
138138
* @brief Remove an element from the specified index
@@ -143,7 +143,7 @@ public void remove(int index) {
143143
// count--;
144144
// System.arraycopy(data, index + 1, outgoing, 0, count - index);
145145
// data = outgoing;
146-
for (int i = index; i < count; i++) {
146+
for (int i = index; i < count-1; i++) {
147147
data[i] = data[i+1];
148148
}
149149
count--;
@@ -175,11 +175,11 @@ public boolean removeValues(int value) {
175175
}
176176

177177

178-
/**
178+
/**
179179
* Add a new entry to the list.
180180
*
181181
* @webref floatlist:method
182-
* @brief Add a new entry to the list
182+
* @brief Add a new entry to the list
183183
*/
184184
public void append(int value) {
185185
if (count == data.length) {
@@ -427,9 +427,9 @@ public int max() {
427427
}
428428

429429

430-
/**
431-
* Sorts the array in place.
432-
*
430+
/**
431+
* Sorts the array in place.
432+
*
433433
* @webref floatlist:method
434434
* @brief Sorts the array, lowest to highest
435435
*/
@@ -438,8 +438,8 @@ public void sort() {
438438
}
439439

440440

441-
/**
442-
* Reverse sort, orders values from highest to lowest.
441+
/**
442+
* Reverse sort, orders values from highest to lowest.
443443
*
444444
* @webref floatlist:method
445445
* @brief Reverse sort, orders values from highest to lowest
@@ -483,7 +483,7 @@ public void swap(int a, int b) {
483483
// count = num;
484484
// }
485485

486-
/**
486+
/**
487487
* @webref floatlist:method
488488
* @brief Reverse sort, orders values by first digit
489489
*/
@@ -575,7 +575,7 @@ public boolean hasNext() {
575575

576576
/**
577577
* Create a new array with a copy of all the values.
578-
*
578+
*
579579
* @return an array sized by the length of the list with each of the values.
580580
* @webref floatlist:method
581581
* @brief Create a new array with a copy of all the values

core/src/processing/data/StringList.java

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@
77
import processing.core.PApplet;
88

99
/**
10-
* Helper class for a list of Strings. Lists are designed to have some of the
10+
* Helper class for a list of Strings. Lists are designed to have some of the
1111
* features of ArrayLists, but to maintain the simplicity and efficiency of
12-
* working with arrays.
13-
*
14-
* Functions like sort() and shuffle() always act on the list itself. To get
12+
* working with arrays.
13+
*
14+
* Functions like sort() and shuffle() always act on the list itself. To get
1515
* a sorted copy, use list.copy().sort().
16-
*
16+
*
1717
* @webref data:composite
1818
*/
1919
public class StringList implements Iterable<String> {
@@ -127,9 +127,9 @@ public void set(int index, String what) {
127127
}
128128

129129

130-
/**
131-
* Remove an element from the specified index.
132-
*
130+
/**
131+
* Remove an element from the specified index.
132+
*
133133
* @webref stringlist:method
134134
* @brief Remove an element from the specified index
135135
*/
@@ -139,7 +139,7 @@ public void remove(int index) {
139139
// count--;
140140
// System.arraycopy(data, index + 1, outgoing, 0, count - index);
141141
// data = outgoing;
142-
for (int i = index; i < count; i++) {
142+
for (int i = index; i < count-1; i++) {
143143
data[i] = data[i+1];
144144
}
145145
count--;
@@ -229,9 +229,9 @@ public boolean replaceValues(String value, String newValue) {
229229
}
230230

231231

232-
/**
233-
* Add a new entry to the list.
234-
*
232+
/**
233+
* Add a new entry to the list.
234+
*
235235
* @webref stringlist:method
236236
* @brief Add a new entry to the list
237237
*/
@@ -414,9 +414,9 @@ public boolean hasValue(String value) {
414414
}
415415

416416

417-
/**
418-
* Sorts the array in place.
419-
*
417+
/**
418+
* Sorts the array in place.
419+
*
420420
* @webref stringlist:method
421421
* @brief Sorts the array in place
422422
*/
@@ -425,11 +425,11 @@ public void sort() {
425425
}
426426

427427

428-
/**
428+
/**
429429
* Reverse sort, orders values from highest to lowest.
430-
*
430+
*
431431
* @webref stringlist:method
432-
* @brief Reverse sort, orders values from highest to lowest
432+
* @brief Reverse sort, orders values from highest to lowest
433433
*/
434434
public void sortReverse() {
435435
sortImpl(true);
@@ -478,7 +478,7 @@ public void swap(int a, int b) {
478478

479479
/**
480480
* @webref stringlist:method
481-
* @brief To come...
481+
* @brief To come...
482482
*/
483483
public void reverse() {
484484
int ii = count - 1;
@@ -494,7 +494,7 @@ public void reverse() {
494494
/**
495495
* Randomize the order of the list elements. Note that this does not
496496
* obey the randomSeed() function in PApplet.
497-
*
497+
*
498498
* @webref stringlist:method
499499
* @brief Randomize the order of the list elements
500500
*/
@@ -527,9 +527,9 @@ public void shuffle(PApplet sketch) {
527527
}
528528

529529

530-
/**
531-
* Make the entire list lower case.
532-
*
530+
/**
531+
* Make the entire list lower case.
532+
*
533533
* @webref stringlist:method
534534
* @brief Make the entire list lower case
535535
*/
@@ -542,8 +542,8 @@ public void lower() {
542542
}
543543

544544

545-
/**
546-
* Make the entire list upper case.
545+
/**
546+
* Make the entire list upper case.
547547
*
548548
* @webref stringlist:method
549549
* @brief Make the entire list upper case
@@ -602,7 +602,7 @@ public boolean hasNext() {
602602

603603
/**
604604
* Create a new array with a copy of all the values.
605-
*
605+
*
606606
* @return an array sized by the length of the list with each of the values.
607607
* @webref stringlist:method
608608
* @brief Create a new array with a copy of all the values

core/todo.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ X patch to make font textures smaller in P2D/P3D
77
X https://github.com/processing/processing/pull/1775
88
X .png data written when .jpg file specified with save/saveFrame()
99
X https://github.com/processing/processing/issues/1810
10+
X remove() not working for intList, floatList, StringList
11+
X https://github.com/processing/processing/issues/1826
1012

1113
andres
1214
A PImage not drawn after resize()/get() in P2D/P3D

0 commit comments

Comments
 (0)