public class DoubleArray extends Object
Modifier and Type | Field and Description |
---|---|
protected double[] |
data |
protected int |
index |
Constructor and Description |
---|
DoubleArray() |
DoubleArray(double[] data) |
DoubleArray(int size) |
Modifier and Type | Method and Description |
---|---|
void |
add(double a)
add a value at the end of the list
|
void |
addAll(double[] a)
adds the set of values at the end of the list
|
void |
addAll(List<? extends Number> numberList)
Adds a list of
Number s |
protected void |
ensureCapacity(int minCapacity)
enlarges the array to the given capacity
|
double |
get(int i)
Returns the value at index i.
|
double[] |
getData()
Returns a reference(!)
|
double |
getFast(int i)
Accesses the data array without bounds check.
|
void |
set(int i,
double a)
add a value at the index and replaces the element at index i
|
int |
size() |
void |
trimToSize()
trims the data array to the size of the used data
|
public DoubleArray()
public DoubleArray(int size)
public DoubleArray(double[] data)
public double get(int i)
i
- indexArrayIndexOutOfBoundsException
- if i is not in [0, size()-1]for get without checks
public double getFast(int i)
i
- ArrayIndexOutOfBoundsException
- if i is less than 0public void set(int i, double a)
i
- a
- public void add(double a)
a
- public void addAll(double[] a)
a
- public void addAll(List<? extends Number> numberList)
Number
snumberList
- protected void ensureCapacity(int minCapacity)
minCapacity
- public void trimToSize()
public int size()
public double[] getData()
Copyright © 2012. All Rights Reserved.