This commit is contained in:
Scott Murray
2013-05-28 12:29:34 -07:00
5 changed files with 75 additions and 51 deletions

View File

@@ -8,6 +8,13 @@ import processing.core.PApplet;
/**
* 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
* a sorted copy, use list.copy().sort().
*
* @webref data:composite
*/
public class FloatList implements Iterable<Float> {
@@ -665,7 +672,7 @@ public class FloatList implements Iterable<Float> {
* @webref floatlist:method
* @brief Create a new array with a copy of all the values
*/
public int[] array() {
public float[] array() {
return array(null);
}
@@ -674,9 +681,9 @@ public class FloatList implements Iterable<Float> {
* Copy as many values as possible into the specified array.
* @param array
*/
public int[] array(int[] array) {
public float[] array(float[] array) {
if (array == null || array.length != count) {
array = new int[count];
array = new float[count];
}
System.arraycopy(data, 0, array, 0, count);
return array;

View File

@@ -13,9 +13,12 @@ import processing.core.PApplet;
/**
* Helper class for a list of ints. By design (for efficiency), functions like
* sort() and shuffle() always act on the list itself. To get a sorted copy,
* use list.copy().sort().
* 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
* a sorted copy, use list.copy().sort().
*
* @webref data:composite
*/
@@ -338,7 +341,7 @@ public class IntList implements Iterable<Integer> {
/**
* @webref floatlist:method
* @brief Check if a number is a part of the data structure
* @brief Check if a number is a part of the list
*/
public boolean hasValue(int value) {
// if (indexCache == null) {

View File

@@ -7,6 +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
* 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
* a sorted copy, use list.copy().sort().
*
* @webref data:composite
*/
public class StringList implements Iterable<String> {