remove() not working for intList, floatList, StringList (#1826)

This commit is contained in:
Ben Fry
2013-05-30 16:20:38 -04:00
parent 8ad4459262
commit 4ac2e7c4dc
4 changed files with 63 additions and 61 deletions

View File

@@ -8,13 +8,13 @@ import processing.core.PApplet;
/**
* Helper class for a list of floats. Lists are designed to have some of the
* Helper class for a list of floats. Lists are designed to have some of the
* features of ArrayLists, but to maintain the simplicity and efficiency of
* working with arrays.
*
* Functions like sort() and shuffle() always act on the list itself. To get
* working with arrays.
*
* Functions like sort() and shuffle() always act on the list itself. To get
* a sorted copy, use list.copy().sort().
*
*
* @webref data:composite
*/
public class FloatList implements Iterable<Float> {
@@ -62,7 +62,7 @@ public class FloatList implements Iterable<Float> {
/**
* Get the length of the list.
*
*
* @webref floatlist:method
* @brief Get the length of the list
*/
@@ -127,8 +127,8 @@ public class FloatList implements Iterable<Float> {
/**
* Remove an element from the specified index.
*
* Remove an element from the specified index.
*
* @webref floatlist:method
* @brief Remove an element from the specified index
*/
@@ -138,7 +138,7 @@ public class FloatList implements Iterable<Float> {
// count--;
// System.arraycopy(data, index + 1, outgoing, 0, count - index);
// data = outgoing;
for (int i = index; i < count; i++) {
for (int i = index; i < count-1; i++) {
data[i] = data[i+1];
}
count--;
@@ -232,8 +232,8 @@ public class FloatList implements Iterable<Float> {
/**
* Add a new entry to the list.
/**
* Add a new entry to the list.
*
* @webref floatlist:method
* @brief Add a new entry to the list
@@ -516,8 +516,8 @@ public class FloatList implements Iterable<Float> {
}
/**
* Sorts the array in place.
/**
* Sorts the array in place.
*
* @webref floatlist:method
* @brief Sorts an array, lowest to highest
@@ -527,8 +527,8 @@ public class FloatList implements Iterable<Float> {
}
/**
* Reverse sort, orders values from highest to lowest
/**
* Reverse sort, orders values from highest to lowest
*
* @webref floatlist:method
* @brief Reverse sort, orders values from highest to lowest
@@ -572,7 +572,7 @@ public class FloatList implements Iterable<Float> {
count = num;
}
/**
/**
* @webref floatlist:method
* @brief Reverse sort, orders values by first digit
*/

View File

@@ -13,13 +13,13 @@ import processing.core.PApplet;
/**
* Helper class for a list of ints. Lists are designed to have some of the
* Helper class for a list of ints. Lists are designed to have some of the
* features of ArrayLists, but to maintain the simplicity and efficiency of
* working with arrays.
*
* Functions like sort() and shuffle() always act on the list itself. To get
* working with arrays.
*
* Functions like sort() and shuffle() always act on the list itself. To get
* a sorted copy, use list.copy().sort().
*
*
* @webref data:composite
*/
public class IntList implements Iterable<Integer> {
@@ -67,7 +67,7 @@ public class IntList implements Iterable<Integer> {
/**
* Get the length of the list.
*
*
* @webref floatlist:method
* @brief Get the length of the list
*/
@@ -91,7 +91,7 @@ public class IntList implements Iterable<Integer> {
/**
* Remove all entries from the list.
*
*
* @webref floatlist:method
* @brief Remove all entries from the list
*/
@@ -131,8 +131,8 @@ public class IntList implements Iterable<Integer> {
}
/**
* Remove an element from the specified index
/**
* Remove an element from the specified index
*
* @webref floatlist:method
* @brief Remove an element from the specified index
@@ -143,7 +143,7 @@ public class IntList implements Iterable<Integer> {
// count--;
// System.arraycopy(data, index + 1, outgoing, 0, count - index);
// data = outgoing;
for (int i = index; i < count; i++) {
for (int i = index; i < count-1; i++) {
data[i] = data[i+1];
}
count--;
@@ -175,11 +175,11 @@ public class IntList implements Iterable<Integer> {
}
/**
/**
* Add a new entry to the list.
*
* @webref floatlist:method
* @brief Add a new entry to the list
* @brief Add a new entry to the list
*/
public void append(int value) {
if (count == data.length) {
@@ -427,9 +427,9 @@ public class IntList implements Iterable<Integer> {
}
/**
* Sorts the array in place.
*
/**
* Sorts the array in place.
*
* @webref floatlist:method
* @brief Sorts the array, lowest to highest
*/
@@ -438,8 +438,8 @@ public class IntList implements Iterable<Integer> {
}
/**
* Reverse sort, orders values from highest to lowest.
/**
* Reverse sort, orders values from highest to lowest.
*
* @webref floatlist:method
* @brief Reverse sort, orders values from highest to lowest
@@ -483,7 +483,7 @@ public class IntList implements Iterable<Integer> {
// count = num;
// }
/**
/**
* @webref floatlist:method
* @brief Reverse sort, orders values by first digit
*/
@@ -575,7 +575,7 @@ public class IntList implements Iterable<Integer> {
/**
* Create a new array with a copy of all the values.
*
*
* @return an array sized by the length of the list with each of the values.
* @webref floatlist:method
* @brief Create a new array with a copy of all the values

View File

@@ -7,13 +7,13 @@ import java.util.Random;
import processing.core.PApplet;
/**
* Helper class for a list of Strings. Lists are designed to have some of the
* Helper class for a list of Strings. Lists are designed to have some of the
* features of ArrayLists, but to maintain the simplicity and efficiency of
* working with arrays.
*
* Functions like sort() and shuffle() always act on the list itself. To get
* working with arrays.
*
* Functions like sort() and shuffle() always act on the list itself. To get
* a sorted copy, use list.copy().sort().
*
*
* @webref data:composite
*/
public class StringList implements Iterable<String> {
@@ -127,9 +127,9 @@ public class StringList implements Iterable<String> {
}
/**
* Remove an element from the specified index.
*
/**
* Remove an element from the specified index.
*
* @webref stringlist:method
* @brief Remove an element from the specified index
*/
@@ -139,7 +139,7 @@ public class StringList implements Iterable<String> {
// count--;
// System.arraycopy(data, index + 1, outgoing, 0, count - index);
// data = outgoing;
for (int i = index; i < count; i++) {
for (int i = index; i < count-1; i++) {
data[i] = data[i+1];
}
count--;
@@ -229,9 +229,9 @@ public class StringList implements Iterable<String> {
}
/**
* Add a new entry to the list.
*
/**
* Add a new entry to the list.
*
* @webref stringlist:method
* @brief Add a new entry to the list
*/
@@ -414,9 +414,9 @@ public class StringList implements Iterable<String> {
}
/**
* Sorts the array in place.
*
/**
* Sorts the array in place.
*
* @webref stringlist:method
* @brief Sorts the array in place
*/
@@ -425,11 +425,11 @@ public class StringList implements Iterable<String> {
}
/**
/**
* Reverse sort, orders values from highest to lowest.
*
*
* @webref stringlist:method
* @brief Reverse sort, orders values from highest to lowest
* @brief Reverse sort, orders values from highest to lowest
*/
public void sortReverse() {
sortImpl(true);
@@ -478,7 +478,7 @@ public class StringList implements Iterable<String> {
/**
* @webref stringlist:method
* @brief To come...
* @brief To come...
*/
public void reverse() {
int ii = count - 1;
@@ -494,7 +494,7 @@ public class StringList implements Iterable<String> {
/**
* Randomize the order of the list elements. Note that this does not
* obey the randomSeed() function in PApplet.
*
*
* @webref stringlist:method
* @brief Randomize the order of the list elements
*/
@@ -527,9 +527,9 @@ public class StringList implements Iterable<String> {
}
/**
* Make the entire list lower case.
*
/**
* Make the entire list lower case.
*
* @webref stringlist:method
* @brief Make the entire list lower case
*/
@@ -542,8 +542,8 @@ public class StringList implements Iterable<String> {
}
/**
* Make the entire list upper case.
/**
* Make the entire list upper case.
*
* @webref stringlist:method
* @brief Make the entire list upper case
@@ -602,7 +602,7 @@ public class StringList implements Iterable<String> {
/**
* Create a new array with a copy of all the values.
*
*
* @return an array sized by the length of the list with each of the values.
* @webref stringlist:method
* @brief Create a new array with a copy of all the values