|
PCJ API Version 1.2 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectbak.pcj.AbstractDoubleCollection
bak.pcj.list.AbstractDoubleList
bak.pcj.list.DoubleArrayList
This class represents an array implemenation of lists of double values.
ArrayList,
Serialized Form| Field Summary | |
static int |
DEFAULT_CAPACITY
The default capacity of this list. |
static int |
DEFAULT_GROWTH_CHUNK
The default chunk size with which to increase the capacity of this list. |
static double |
DEFAULT_GROWTH_FACTOR
The default factor with which to increase the capacity of this list. |
| Constructor Summary | |
DoubleArrayList()
Creates a new array list with capacity 10 and a relative growth factor of 1.0. |
|
DoubleArrayList(double[] a)
Creates a new array list with the same elements as a specified array. |
|
DoubleArrayList(DoubleCollection c)
Creates a new array list with the same elements as a specified collection. |
|
DoubleArrayList(int capacity)
Creates a new array list with a specified capacity and a relative growth factor of 1.0. |
|
DoubleArrayList(int capacity,
double growthFactor)
Creates a new array list with a specified capacity and relative growth factor. |
|
DoubleArrayList(int capacity,
int growthChunk)
Creates a new array list with a specified capacity and absolute growth factor. |
|
| Method Summary | |
void |
add(int index,
double v)
Throws UnsupportedOperationException. |
int |
capacity()
Returns the current capacity of this list. |
void |
clear()
Clears this collection. |
Object |
clone()
Returns a clone of this array list. |
boolean |
contains(double v)
Indicates whether this collection contains a specified element. |
int |
ensureCapacity(int capacity)
Ensures that this list has at least a specified capacity. |
boolean |
equals(Object obj)
Indicates whether this collection is equal to some object. |
double |
get(int index)
Returns the element at a specified position in this list. |
int |
hashCode()
Returns a hash code value for this collection. |
int |
indexOf(double c)
Returns the index of the first occurance of a specified element in this list. |
int |
indexOf(int index,
double c)
Returns the index of the first occurance of a specified element in this list after or at a specified index. |
boolean |
isEmpty()
Indicates whether this collection is empty. |
int |
lastIndexOf(double c)
Returns the index of the last occurance of a specified element in this list. |
boolean |
remove(double v)
Removes a specified element from this collection. |
double |
removeElementAt(int index)
Throws UnsupportedOperationException. |
double |
set(int index,
double v)
Sets a specified element to a new value. |
int |
size()
Returns the number of elements in this collection. |
double[] |
toArray()
Returns the elements of this collection as an array. |
double[] |
toArray(double[] a)
Returns the elements of this collection as an array. |
void |
trimToSize()
Minimizes the memory used by this array list. |
| Methods inherited from class bak.pcj.list.AbstractDoubleList |
add, addAll, iterator, lastIndexOf, listIterator, listIterator |
| Methods inherited from class bak.pcj.AbstractDoubleCollection |
addAll, containsAll, removeAll, retainAll, toString |
| Methods inherited from class java.lang.Object |
finalize, getClass, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface bak.pcj.DoubleCollection |
addAll, containsAll, removeAll, retainAll |
| Field Detail |
public static final double DEFAULT_GROWTH_FACTOR
public static final int DEFAULT_GROWTH_CHUNK
public static final int DEFAULT_CAPACITY
| Constructor Detail |
public DoubleArrayList()
DoubleArrayList(int,double)public DoubleArrayList(DoubleCollection c)
c - the collection whose elements to add to the new
list.
NullPointerException - if c is null.public DoubleArrayList(double[] a)
a - the array whose elements to add to the new
list.
NullPointerException - if a is null.public DoubleArrayList(int capacity)
capacity - the initial capacity of the list.
IllegalArgumentException - if capacity is negative.DoubleArrayList(int,double)
public DoubleArrayList(int capacity,
double growthFactor)
The array capacity increases to capacity()*(1+growthFactor). This strategy is good for avoiding many capacity increases, but the amount of wasted memory is approximately the size of the list.
capacity - the initial capacity of the list.growthFactor - the relative amount with which to increase the
the capacity when a capacity increase is needed.
IllegalArgumentException - if capacity is negative;
if growthFactor is negative.
public DoubleArrayList(int capacity,
int growthChunk)
The array capacity increases to capacity()+growthChunk. This strategy is good for avoiding wasting memory. However, an overhead is potentially introduced by frequent capacity increases.
capacity - the initial capacity of the list.growthChunk - the absolute amount with which to increase the
the capacity when a capacity increase is needed.
IllegalArgumentException - if capacity is negative;
if growthChunk is negative.| Method Detail |
public int ensureCapacity(int capacity)
capacity - the minimum capacity of this list.
capacity()public int capacity()
ensureCapacity(int)
public void add(int index,
double v)
AbstractDoubleList
add in interface DoubleListadd in class AbstractDoubleListpublic double get(int index)
DoubleList
get in interface DoubleListindex - the position of the element to return.
public double set(int index,
double v)
DoubleList
set in interface DoubleListindex - the index of the element whose value to set.v - the new value of the specified element.
public double removeElementAt(int index)
AbstractDoubleList
removeElementAt in interface DoubleListremoveElementAt in class AbstractDoubleListpublic void trimToSize()
trimToSize in interface DoubleCollectiontrimToSize in class AbstractDoubleCollectionpublic Object clone()
public int size()
DoubleCollection
size in interface DoubleCollectionsize in class AbstractDoubleCollectionpublic boolean isEmpty()
DoubleCollection
isEmpty in interface DoubleCollectionisEmpty in class AbstractDoubleCollectionpublic void clear()
DoubleCollection
clear in interface DoubleCollectionclear in class AbstractDoubleCollectionpublic boolean contains(double v)
DoubleCollection
contains in interface DoubleCollectioncontains in class AbstractDoubleCollectionpublic int indexOf(double c)
DoubleList
indexOf in interface DoubleListindexOf in class AbstractDoubleList
public int indexOf(int index,
double c)
DoubleList
indexOf in interface DoubleListindexOf in class AbstractDoubleListpublic int lastIndexOf(double c)
DoubleList
lastIndexOf in interface DoubleListlastIndexOf in class AbstractDoubleListpublic boolean remove(double v)
DoubleCollection
remove in interface DoubleCollectionremove in class AbstractDoubleCollectionpublic double[] toArray()
DoubleCollection
toArray in interface DoubleCollectiontoArray in class AbstractDoubleCollectionpublic double[] toArray(double[] a)
DoubleCollection
toArray in interface DoubleCollectiontoArray in class AbstractDoubleCollectionpublic boolean equals(Object obj)
DoubleCollection
equals in interface DoubleCollectionequals in class AbstractDoubleListpublic int hashCode()
DoubleCollection
hashCode in interface DoubleCollectionhashCode in class AbstractDoubleList
|
PCJ API Version 1.2 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||