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