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