public class FloatList
extends Object
implements Iterable<Float>
IntList
,
StringList
Constructor and Description |
---|
FloatList() |
FloatList(float[] list) |
FloatList(int length) |
FloatList(Iterable<Object> iter)
Construct an FloatList from an iterable pile of objects.
|
FloatList(Object... items)
Construct an FloatList from a random pile of objects.
|
Modifier and Type | Method and Description |
---|---|
void |
add(int index,
float amount) |
void |
append(float value)
Add a new entry to the list.
|
void |
append(float[] values) |
void |
append(FloatList list) |
void |
appendUnique(float value)
Add this value, but only if it's not already in the list.
|
float[] |
array()
Create a new array with a copy of all the values.
|
float[] |
array(float[] array)
Copy values into the specified array.
|
void |
clear()
Remove all entries from the list.
|
FloatList |
copy() |
void |
div(int index,
float amount) |
float |
get(int index)
Get an entry at a particular index.
|
FloatList |
getPercent()
Returns a normalized version of this array.
|
FloatList |
getSubset(int start) |
FloatList |
getSubset(int start,
int num) |
boolean |
hasValue(float value) |
int |
index(float what)
Return the first index of a particular value.
|
void |
insert(int index,
float value) |
void |
insert(int index,
float[] values) |
void |
insert(int index,
FloatList list) |
Iterator<Float> |
iterator()
Implemented this way so that we can use a FloatList in a for loop.
|
String |
join(String separator) |
float |
max() |
int |
maxIndex() |
float |
min() |
int |
minIndex() |
void |
mult(int index,
float amount) |
float |
pop() |
void |
print() |
void |
push(float value)
Just an alias for append(), but matches pop()
|
float |
remove(int index)
Remove an element from the specified index.
|
int |
removeValue(int value) |
int |
removeValues(int value) |
boolean |
replaceValue(float value,
float newValue)
Replace the first instance of a particular value
|
boolean |
replaceValues(float value,
float newValue)
Replace all instances of a particular value
|
void |
resize(int length) |
void |
reverse() |
void |
save(File file)
Save tab-delimited entries to a file (TSV format, UTF-8 encoding)
|
void |
set(int index,
float what)
Set the entry at a particular index.
|
void |
shuffle()
Randomize the order of the list elements.
|
void |
shuffle(PApplet sketch)
Randomize the list order using the random() function from the specified
sketch, allowing shuffle() to use its current randomSeed() setting.
|
int |
size()
Get the length of the list.
|
void |
sort()
Sorts the array in place.
|
void |
sortReverse()
Reverse sort, orders values from highest to lowest
|
void |
sub(int index,
float amount) |
float |
sum() |
double |
sumDouble() |
String |
toJSON()
Return this dictionary as a String in JSON format.
|
String |
toString() |
float[] |
values()
Returns the actual array being used to store the data.
|
void |
write(PrintWriter writer)
Write entries to a PrintWriter, one per line
|
public FloatList()
public FloatList(int length)
public FloatList(float[] list)
public FloatList(Iterable<Object> iter)
public FloatList(Object... items)
public int size()
public void resize(int length)
public void clear()
public float get(int index)
public void set(int index, float what)
public void push(float value)
public float pop()
public float remove(int index)
public int removeValue(int value)
public int removeValues(int value)
public boolean replaceValue(float value, float newValue)
public boolean replaceValues(float value, float newValue)
public void append(float value)
public void append(float[] values)
public void append(FloatList list)
public void appendUnique(float value)
public void insert(int index, float value)
public void insert(int index, float[] values)
public void insert(int index, FloatList list)
public int index(float what)
public boolean hasValue(float value)
public void add(int index, float amount)
public void sub(int index, float amount)
public void mult(int index, float amount)
public void div(int index, float amount)
public float min()
public int minIndex()
public float max()
public int maxIndex()
public float sum()
public double sumDouble()
public void sort()
public void sortReverse()
public void reverse()
public void shuffle()
public void shuffle(PApplet sketch)
public FloatList copy()
public float[] values()
public Iterator<Float> iterator()
iterator
in interface Iterable<Float>
public float[] array()
public float[] array(float[] array)
array
- public FloatList getPercent()
public FloatList getSubset(int start)
public FloatList getSubset(int start, int num)
public String join(String separator)
public void print()
public void save(File file)
public void write(PrintWriter writer)
public String toJSON()
public String toString()
toString
in class Object