|
PCJ API Version 1.2 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object bak.pcj.AbstractDoubleCollection bak.pcj.list.AbstractDoubleList bak.pcj.list.DoubleArrayDeque
This class represents an array implementaion of deques of double values.
LinkedList
,
Serialized FormField Summary | |
static int |
DEFAULT_CAPACITY
The default capacity of this deque. |
static int |
DEFAULT_GROWTH_CHUNK
The default chunk size with which to increase the capacity of this deque. |
static double |
DEFAULT_GROWTH_FACTOR
The default factor with which to increase the capacity of this deque. |
Constructor Summary | |
DoubleArrayDeque()
Creates a new array deque with capacity 10 and a relative growth factor of 1.0. |
|
DoubleArrayDeque(double[] a)
Creates a new array deque with the same elements as a specified array. |
|
DoubleArrayDeque(DoubleCollection c)
Creates a new array deque with the same elements as a specified collection. |
|
DoubleArrayDeque(int capacity)
Creates a new array deque with a specified capacity and a relative growth factor of 1.0. |
|
DoubleArrayDeque(int capacity,
double growthFactor)
Creates a new array deque with a specified capacity and relative growth factor. |
|
DoubleArrayDeque(int capacity,
int growthChunk)
Creates a new array deque with a specified capacity and absolute growth factor. |
Method Summary | |
void |
add(int index,
double v)
Adds an element to this list at a specified index. |
void |
addFirst(double v)
Adds an element to the beginning of this deque. |
void |
addLast(double v)
Adds an element to the end of this deque. |
int |
capacity()
Returns the current capacity of this deque. |
void |
clear()
Clears this collection. |
Object |
clone()
Returns a clone of this array deque. |
boolean |
contains(double v)
Indicates whether this collection contains a specified element. |
int |
ensureCapacity(int capacity)
Ensures that this deque 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. |
double |
getFirst()
Returns the first element of this deque. |
double |
getLast()
Returns the last element of this deque. |
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. |
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)
Removes the element at a specified index in this list. |
double |
removeFirst()
Removes the first element of this deque. |
double |
removeLast()
Removes the last element of this deque. |
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(double[] a)
Returns the elements of this collection as an array. |
void |
trimToSize()
Minimizes the memory used by this array deque. |
Methods inherited from class bak.pcj.list.AbstractDoubleList |
add, addAll, indexOf, iterator, lastIndexOf, listIterator, listIterator |
Methods inherited from class bak.pcj.AbstractDoubleCollection |
addAll, containsAll, removeAll, retainAll, toArray, toString |
Methods inherited from class java.lang.Object |
finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface bak.pcj.list.DoubleList |
addAll, indexOf, lastIndexOf, listIterator, listIterator |
Methods inherited from interface bak.pcj.DoubleCollection |
add, addAll, containsAll, iterator, removeAll, retainAll, toArray |
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 DoubleArrayDeque()
DoubleArrayDeque(int,double)
public DoubleArrayDeque(DoubleCollection c)
c
- the collection whose elements to add to the new
deque.
NullPointerException
- if c is null.public DoubleArrayDeque(double[] a)
a
- the array whose elements to add to the new
deque.
NullPointerException
- if a is null.public DoubleArrayDeque(int capacity)
capacity
- the initial capacity of the deque.
IllegalArgumentException
- if capacity is negative.DoubleArrayDeque(int,double)
public DoubleArrayDeque(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 deque.
capacity
- the initial capacity of the deque.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 DoubleArrayDeque(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 deque.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 deque.
capacity()
public int capacity()
ensureCapacity(int)
public void add(int index, double v)
DoubleList
add
in interface DoubleList
add
in class AbstractDoubleList
public double get(int index)
DoubleList
get
in interface DoubleList
index
- the position of the element to return.
public double set(int index, double v)
DoubleList
set
in interface DoubleList
index
- the index of the element whose value to set.v
- the new value of the specified element.
public double removeElementAt(int index)
DoubleList
removeElementAt
in interface DoubleList
removeElementAt
in class AbstractDoubleList
public void trimToSize()
trimToSize
in interface DoubleCollection
trimToSize
in class AbstractDoubleCollection
public Object clone()
public double getFirst()
DoubleDeque
getFirst
in interface DoubleDeque
public double getLast()
DoubleDeque
getLast
in interface DoubleDeque
public void addFirst(double v)
DoubleDeque
addFirst
in interface DoubleDeque
v
- the element to add to this deque.public void addLast(double v)
DoubleDeque
addLast
in interface DoubleDeque
v
- the element to add to this deque.public double removeFirst()
DoubleDeque
removeFirst
in interface DoubleDeque
public double removeLast()
DoubleDeque
removeLast
in interface DoubleDeque
public int size()
DoubleCollection
size
in interface DoubleCollection
size
in class AbstractDoubleCollection
public boolean isEmpty()
DoubleCollection
isEmpty
in interface DoubleCollection
isEmpty
in class AbstractDoubleCollection
public void clear()
DoubleCollection
clear
in interface DoubleCollection
clear
in class AbstractDoubleCollection
public boolean contains(double v)
DoubleCollection
contains
in interface DoubleCollection
contains
in class AbstractDoubleCollection
public int indexOf(double c)
DoubleList
indexOf
in interface DoubleList
indexOf
in class AbstractDoubleList
public int lastIndexOf(double c)
DoubleList
lastIndexOf
in interface DoubleList
lastIndexOf
in class AbstractDoubleList
public boolean remove(double v)
DoubleCollection
remove
in interface DoubleCollection
remove
in class AbstractDoubleCollection
public double[] toArray(double[] a)
DoubleCollection
toArray
in interface DoubleCollection
toArray
in class AbstractDoubleCollection
public boolean equals(Object obj)
DoubleCollection
equals
in interface DoubleCollection
equals
in class AbstractDoubleList
public int hashCode()
DoubleCollection
hashCode
in interface DoubleCollection
hashCode
in class AbstractDoubleList
|
PCJ API Version 1.2 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |