|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjava.util.AbstractCollection<E>
java.util.AbstractList<BaseType>
org.scijava.util.AbstractPrimitiveArray<ArrayType,BaseType>
ArrayType - Type of the primitive array; e.g., double[].BaseType - Boxed type of the array element; e.g., Double.public abstract class AbstractPrimitiveArray<ArrayType,BaseType>
Abstract base class for primitive-type extensible arrays.
This class makes it easy to implement extensible arrays backed by fixed-size primitive type arrays, re-allocating and copying data as needed. To avoid frequent re-allocation, by default, the fixed-size array will be expanded by 50% when running out of space.
| Field Summary |
|---|
| Fields inherited from class java.util.AbstractList |
|---|
modCount |
| Constructor Summary | |
|---|---|
AbstractPrimitiveArray(Class<BaseType> type)
Constructs an extensible array of primitive type elements, backed by a fixed-size array. |
|
AbstractPrimitiveArray(Class<BaseType> type,
ArrayType array)
Constructs an extensible array of primitive type elements, backed by the given fixed-size array. |
|
AbstractPrimitiveArray(Class<BaseType> type,
int size)
Constructs an extensible array of primitive type elements, backed by a fixed-size array. |
|
| Method Summary | |
|---|---|
abstract void |
add(int index,
BaseType element)
|
int |
capacity()
Gets the current capacity of the backing array. |
protected void |
checkBounds(int index)
Checks that the index is less than the size of the array. |
void |
clear()
|
ArrayType |
copyArray()
Returns a copy of the primitive-array array. |
void |
delete(int index,
int count)
Shifts the array to delete space starting at a specified index. |
void |
ensureCapacity(int minCapacity)
Makes sure the backing array at least a specified capacity. |
int |
getMaximumGrowth()
Gets the maximal step size by which to grow the fixed-size array when running out of space. |
void |
insert(int index,
int count)
Shifts the array to insert space at a specified index. |
BaseType |
remove(int index)
|
abstract BaseType |
set(int index,
BaseType element)
|
void |
setMaximumGrowth(int growth)
Sets the maximal step size by which to grow the fixed-size array when running out of space. |
void |
setSize(int size)
|
int |
size()
|
| Methods inherited from class java.util.AbstractList |
|---|
add, addAll, equals, get, hashCode, indexOf, iterator, lastIndexOf, listIterator, listIterator, removeRange, subList |
| Methods inherited from class java.util.AbstractCollection |
|---|
addAll, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray, toString |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface org.scijava.util.PrimitiveArray |
|---|
defaultValue, getArray, setArray |
| Methods inherited from interface java.util.List |
|---|
add, addAll, addAll, contains, containsAll, equals, get, hashCode, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, removeAll, retainAll, subList, toArray, toArray |
| Constructor Detail |
|---|
public AbstractPrimitiveArray(Class<BaseType> type)
type - the class of the primitive type
public AbstractPrimitiveArray(Class<BaseType> type,
int size)
type - the class of the primitive typesize - the initial size
public AbstractPrimitiveArray(Class<BaseType> type,
ArrayType array)
array - the array to wraptype - the class of the primitive type| Method Detail |
|---|
public int getMaximumGrowth()
PrimitiveArray
getMaximumGrowth in interface PrimitiveArray<ArrayType,BaseType>public void setMaximumGrowth(int growth)
PrimitiveArray
setMaximumGrowth in interface PrimitiveArray<ArrayType,BaseType>public ArrayType copyArray()
PrimitiveArray
The returned array is guaranteed to have List.size() elements.
copyArray in interface PrimitiveArray<ArrayType,BaseType>public int capacity()
capacity in interface PrimitiveArray<ArrayType,BaseType>public void ensureCapacity(int minCapacity)
PrimitiveArray
After calling this method, the internal array will have at least
minCapacity elements.
ensureCapacity in interface PrimitiveArray<ArrayType,BaseType>minCapacity - the minimum capacity
public void insert(int index,
int count)
insert in interface PrimitiveArray<ArrayType,BaseType>index - the index where the space should be insertedcount - the number of values to insert
public void delete(int index,
int count)
delete in interface PrimitiveArray<ArrayType,BaseType>index - the index where the space should be deletedcount - the number of values to delete
public abstract BaseType set(int index,
BaseType element)
set in interface List<BaseType>set in class AbstractList<BaseType>
public abstract void add(int index,
BaseType element)
add in interface List<BaseType>add in class AbstractList<BaseType>public BaseType remove(int index)
remove in interface List<BaseType>remove in class AbstractList<BaseType>public int size()
size in interface Collection<BaseType>size in interface List<BaseType>size in interface Sizablesize in class AbstractCollection<BaseType>public void clear()
clear in interface Collection<BaseType>clear in interface List<BaseType>clear in class AbstractList<BaseType>public void setSize(int size)
setSize in interface Sizableprotected void checkBounds(int index)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||