public class DoubleList
extends java.lang.Object
implements java.lang.Iterable<java.lang.Double>
IntList
,
StringList
Constructor and Description |
---|
DoubleList() |
DoubleList(double[] list) |
DoubleList(int length) |
DoubleList(java.lang.Iterable<java.lang.Object> iter)
Construct an FloatList from an iterable pile of objects.
|
DoubleList(java.lang.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) |
java.util.Iterator<java.lang.Double> |
iterator()
Implemented this way so that we can use a FloatList in a for loop.
|
java.lang.String |
join(java.lang.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(java.io.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() |
java.lang.String |
toJSON()
Return this dictionary as a String in JSON format.
|
java.lang.String |
toString() |
double[] |
values()
Returns the actual array being used to store the data.
|
void |
write(java.io.PrintWriter writer)
Write entries to a PrintWriter, one per line
|
public DoubleList()
public DoubleList(int length)
public DoubleList(double[] list)
public DoubleList(java.lang.Iterable<java.lang.Object> iter)
public DoubleList(java.lang.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 java.util.Iterator<java.lang.Double> iterator()
iterator
in interface java.lang.Iterable<java.lang.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 java.lang.String join(java.lang.String separator)
public void print()
public void save(java.io.File file)
public void write(java.io.PrintWriter writer)
public java.lang.String toJSON()
public java.lang.String toString()
toString
in class java.lang.Object