From d1ac58a07690664eed8a08525b04087ad3f5a5f0 Mon Sep 17 00:00:00 2001 From: REAS Date: Tue, 28 May 2013 11:51:41 -0700 Subject: [PATCH] Reference additions for Lists and Dicts --- core/src/processing/data/FloatList.java | 13 ++++++++++--- core/src/processing/data/IntList.java | 11 +++++++---- core/src/processing/data/StringList.java | 7 +++++++ 3 files changed, 24 insertions(+), 7 deletions(-) diff --git a/core/src/processing/data/FloatList.java b/core/src/processing/data/FloatList.java index 24ab1d9ba..31479e4cc 100644 --- a/core/src/processing/data/FloatList.java +++ b/core/src/processing/data/FloatList.java @@ -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 { @@ -665,7 +672,7 @@ public class FloatList implements Iterable { * @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 { * 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; diff --git a/core/src/processing/data/IntList.java b/core/src/processing/data/IntList.java index 3837bfd3d..58780421a 100644 --- a/core/src/processing/data/IntList.java +++ b/core/src/processing/data/IntList.java @@ -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 { /** * @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) { diff --git a/core/src/processing/data/StringList.java b/core/src/processing/data/StringList.java index 1abfd1ce9..abc1cae8d 100644 --- a/core/src/processing/data/StringList.java +++ b/core/src/processing/data/StringList.java @@ -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 {