|
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.AbstractShortCollection
bak.pcj.list.AbstractShortList
bak.pcj.list.ShortArrayDeque
This class represents an array implementaion of deques of short values.
LinkedList,
Serialized Form| Field 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 | |
ShortArrayDeque()
Creates a new array deque with capacity 10 and a relative growth factor of 1.0. |
|
ShortArrayDeque(int capacity)
Creates a new array deque with a specified capacity and a relative growth factor of 1.0. |
|
ShortArrayDeque(int capacity,
double growthFactor)
Creates a new array deque with a specified capacity and relative growth factor. |
|
ShortArrayDeque(int capacity,
int growthChunk)
Creates a new array deque with a specified capacity and absolute growth factor. |
|
ShortArrayDeque(short[] a)
Creates a new array deque with the same elements as a specified array. |
|
ShortArrayDeque(ShortCollection c)
Creates a new array deque with the same elements as a specified collection. |
|
| Method Summary | |
void |
add(int index,
short v)
Adds an element to this list at a specified index. |
void |
addFirst(short v)
Adds an element to the beginning of this deque. |
void |
addLast(short 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(short 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. |
short |
get(int index)
Returns the element at a specified position in this list. |
short |
getFirst()
Returns the first element of this deque. |
short |
getLast()
Returns the last element of this deque. |
int |
hashCode()
Returns a hash code value for this collection. |
int |
indexOf(short 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(short c)
Returns the index of the last occurance of a specified element in this list. |
boolean |
remove(short v)
Removes a specified element from this collection. |
short |
removeElementAt(int index)
Removes the element at a specified index in this list. |
short |
removeFirst()
Removes the first element of this deque. |
short |
removeLast()
Removes the last element of this deque. |
short |
set(int index,
short v)
Sets a specified element to a new value. |
int |
size()
Returns the number of elements in this collection. |
short[] |
toArray(short[] 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.AbstractShortList |
add, addAll, indexOf, iterator, lastIndexOf, listIterator, listIterator |
| Methods inherited from class bak.pcj.AbstractShortCollection |
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.ShortList |
addAll, indexOf, lastIndexOf, listIterator, listIterator |
| Methods inherited from interface bak.pcj.ShortCollection |
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 ShortArrayDeque()
ShortArrayDeque(int,double)public ShortArrayDeque(ShortCollection c)
c - the collection whose elements to add to the new
deque.
NullPointerException - if c is null.public ShortArrayDeque(short[] a)
a - the array whose elements to add to the new
deque.
NullPointerException - if a is null.public ShortArrayDeque(int capacity)
capacity - the initial capacity of the deque.
IllegalArgumentException - if capacity is negative.ShortArrayDeque(int,double)
public ShortArrayDeque(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 ShortArrayDeque(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,
short v)
ShortList
add in interface ShortListadd in class AbstractShortListpublic short get(int index)
ShortList
get in interface ShortListindex - the position of the element to return.
public short set(int index,
short v)
ShortList
set in interface ShortListindex - the index of the element whose value to set.v - the new value of the specified element.
public short removeElementAt(int index)
ShortList
removeElementAt in interface ShortListremoveElementAt in class AbstractShortListpublic void trimToSize()
trimToSize in interface ShortCollectiontrimToSize in class AbstractShortCollectionpublic Object clone()
public short getFirst()
ShortDeque
getFirst in interface ShortDequepublic short getLast()
ShortDeque
getLast in interface ShortDequepublic void addFirst(short v)
ShortDeque
addFirst in interface ShortDequev - the element to add to this deque.public void addLast(short v)
ShortDeque
addLast in interface ShortDequev - the element to add to this deque.public short removeFirst()
ShortDeque
removeFirst in interface ShortDequepublic short removeLast()
ShortDeque
removeLast in interface ShortDequepublic int size()
ShortCollection
size in interface ShortCollectionsize in class AbstractShortCollectionpublic boolean isEmpty()
ShortCollection
isEmpty in interface ShortCollectionisEmpty in class AbstractShortCollectionpublic void clear()
ShortCollection
clear in interface ShortCollectionclear in class AbstractShortCollectionpublic boolean contains(short v)
ShortCollection
contains in interface ShortCollectioncontains in class AbstractShortCollectionpublic int indexOf(short c)
ShortList
indexOf in interface ShortListindexOf in class AbstractShortListpublic int lastIndexOf(short c)
ShortList
lastIndexOf in interface ShortListlastIndexOf in class AbstractShortListpublic boolean remove(short v)
ShortCollection
remove in interface ShortCollectionremove in class AbstractShortCollectionpublic short[] toArray(short[] a)
ShortCollection
toArray in interface ShortCollectiontoArray in class AbstractShortCollectionpublic boolean equals(Object obj)
ShortCollection
equals in interface ShortCollectionequals in class AbstractShortListpublic int hashCode()
ShortCollection
hashCode in interface ShortCollectionhashCode in class AbstractShortList
|
PCJ API Version 1.2 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||