public class DynamicDoubleArray extends ModifiedVersionBase implements java.lang.Cloneable
ArrayList)| Modifier and Type | Field and Description | 
|---|---|
| static int | DEFAULT_INITIAL_CAPACITY | 
| Constructor and Description | 
|---|
| DynamicDoubleArray()Dynamic array of integers with default capacity of 10 | 
| DynamicDoubleArray(double... vals) | 
| DynamicDoubleArray(int initialCapacity)Dynamic array of integers with provided initial capacity | 
| Modifier and Type | Method and Description | 
|---|---|
| void | add(double e) | 
| void | addAll(double[] e) | 
| void | chop(int start,
    int size)Performs an in-place slice, modifying this array directly | 
| void | clear() | 
| DynamicDoubleArray | clone()Creates a shallow copy | 
| void | ensureCapacity(int cap) | 
| double | get(int idx) | 
| double[] | getArray()Provides direct access to the underlying array. | 
| double | remove(int idx) | 
| void | remove(int idx,
      int count)Remove a specified number of elements starting at the
 provided index. | 
| void | resize(int size)Resizes the array. | 
| void | set(int idx,
   double e)Sets the value at index  idxto the providede. | 
| int | size() | 
| DynamicDoubleArray | slice(int start,
     int size)Returns a copy of a portion of the array | 
| void | trimToSize() | 
getVersion, notifyModifiedpublic static final int DEFAULT_INITIAL_CAPACITY
public DynamicDoubleArray()
public DynamicDoubleArray(int initialCapacity)
initialCapacity - initial capacity.  If <= 0, uses 
 the default capacitypublic DynamicDoubleArray(double... vals)
public void ensureCapacity(int cap)
public int size()
public void add(double e)
public void addAll(double[] e)
public void clear()
public double remove(int idx)
public void remove(int idx,
                   int count)
idx - starting index to removecount - number of elements to removepublic void trimToSize()
public void resize(int size)
size - new sizepublic DynamicDoubleArray slice(int start, int size)
start - starting index to copysize - number of elementspublic void chop(int start,
                 int size)
start - starting index to keepsize - number of elementspublic double get(int idx)
public void set(int idx,
                double e)
idx to the provided e.
 If idx==size(), then the element is appended to the array.idx - index at which to modify the valuee - new valuepublic double[] getArray()
ModifiedVersionBase.notifyModified()
 is called.  The underying array is automatically trimmed to the correct size
 before being returned.public DynamicDoubleArray clone()
clone in class java.lang.Object