|
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.AbstractIntCollection bak.pcj.list.AbstractIntList bak.pcj.list.IntArrayDeque
This class represents an array implementaion of deques of int 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 | |
IntArrayDeque()
Creates a new array deque with capacity 10 and a relative growth factor of 1.0. |
|
IntArrayDeque(int capacity)
Creates a new array deque with a specified capacity and a relative growth factor of 1.0. |
|
IntArrayDeque(int[] a)
Creates a new array deque with the same elements as a specified array. |
|
IntArrayDeque(IntCollection c)
Creates a new array deque with the same elements as a specified collection. |
|
IntArrayDeque(int capacity,
double growthFactor)
Creates a new array deque with a specified capacity and relative growth factor. |
|
IntArrayDeque(int capacity,
int growthChunk)
Creates a new array deque with a specified capacity and absolute growth factor. |
Method Summary | |
void |
add(int index,
int v)
Adds an element to this list at a specified index. |
void |
addFirst(int v)
Adds an element to the beginning of this deque. |
void |
addLast(int 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(int 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. |
int |
get(int index)
Returns the element at a specified position in this list. |
int |
getFirst()
Returns the first element of this deque. |
int |
getLast()
Returns the last element of this deque. |
int |
hashCode()
Returns a hash code value for this collection. |
int |
indexOf(int 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(int c)
Returns the index of the last occurance of a specified element in this list. |
boolean |
remove(int v)
Removes a specified element from this collection. |
int |
removeElementAt(int index)
Removes the element at a specified index in this list. |
int |
removeFirst()
Removes the first element of this deque. |
int |
removeLast()
Removes the last element of this deque. |
int |
set(int index,
int v)
Sets a specified element to a new value. |
int |
size()
Returns the number of elements in this collection. |
int[] |
toArray(int[] 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.AbstractIntList |
add, addAll, indexOf, iterator, lastIndexOf, listIterator, listIterator |
Methods inherited from class bak.pcj.AbstractIntCollection |
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.IntList |
addAll, indexOf, lastIndexOf, listIterator, listIterator |
Methods inherited from interface bak.pcj.IntCollection |
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 IntArrayDeque()
IntArrayDeque(int,double)
public IntArrayDeque(IntCollection c)
c
- the collection whose elements to add to the new
deque.
NullPointerException
- if c is null.public IntArrayDeque(int[] a)
a
- the array whose elements to add to the new
deque.
NullPointerException
- if a is null.public IntArrayDeque(int capacity)
capacity
- the initial capacity of the deque.
IllegalArgumentException
- if capacity is negative.IntArrayDeque(int,double)
public IntArrayDeque(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 IntArrayDeque(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, int v)
IntList
add
in interface IntList
add
in class AbstractIntList
public int get(int index)
IntList
get
in interface IntList
index
- the position of the element to return.
public int set(int index, int v)
IntList
set
in interface IntList
index
- the index of the element whose value to set.v
- the new value of the specified element.
public int removeElementAt(int index)
IntList
removeElementAt
in interface IntList
removeElementAt
in class AbstractIntList
public void trimToSize()
trimToSize
in interface IntCollection
trimToSize
in class AbstractIntCollection
public Object clone()
public int getFirst()
IntDeque
getFirst
in interface IntDeque
public int getLast()
IntDeque
getLast
in interface IntDeque
public void addFirst(int v)
IntDeque
addFirst
in interface IntDeque
v
- the element to add to this deque.public void addLast(int v)
IntDeque
addLast
in interface IntDeque
v
- the element to add to this deque.public int removeFirst()
IntDeque
removeFirst
in interface IntDeque
public int removeLast()
IntDeque
removeLast
in interface IntDeque
public int size()
IntCollection
size
in interface IntCollection
size
in class AbstractIntCollection
public boolean isEmpty()
IntCollection
isEmpty
in interface IntCollection
isEmpty
in class AbstractIntCollection
public void clear()
IntCollection
clear
in interface IntCollection
clear
in class AbstractIntCollection
public boolean contains(int v)
IntCollection
contains
in interface IntCollection
contains
in class AbstractIntCollection
public int indexOf(int c)
IntList
indexOf
in interface IntList
indexOf
in class AbstractIntList
public int lastIndexOf(int c)
IntList
lastIndexOf
in interface IntList
lastIndexOf
in class AbstractIntList
public boolean remove(int v)
IntCollection
remove
in interface IntCollection
remove
in class AbstractIntCollection
public int[] toArray(int[] a)
IntCollection
toArray
in interface IntCollection
toArray
in class AbstractIntCollection
public boolean equals(Object obj)
IntCollection
equals
in interface IntCollection
equals
in class AbstractIntList
public int hashCode()
IntCollection
hashCode
in interface IntCollection
hashCode
in class AbstractIntList
|
PCJ API Version 1.2 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |