Package net.mtrop.doom.struct.vector
Class AbstractArrayStorage<T>
java.lang.Object
net.mtrop.doom.struct.vector.AbstractArrayStorage<T>
- Type Parameters:
T
- the value type that this contains.
- Direct Known Subclasses:
AbstractVector
This class contains the base for all data structures
that make use of a contiguous memory structure.
- Author:
- Matthew Tropiano
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
Default capacity for a new array.protected Object[]
Underlying object array. -
Constructor Summary
ModifierConstructorDescriptionprotected
Initializes the array with the default storage capacity.protected
AbstractArrayStorage
(int capacity) Initializes the array with a particular storage capacity. -
Method Summary
-
Field Details
-
DEFAULT_CAPACITY
public static final int DEFAULT_CAPACITYDefault capacity for a new array.- See Also:
-
storageArray
Underlying object array.
-
-
Constructor Details
-
AbstractArrayStorage
protected AbstractArrayStorage()Initializes the array with the default storage capacity. -
AbstractArrayStorage
protected AbstractArrayStorage(int capacity) Initializes the array with a particular storage capacity.- Parameters:
capacity
- the desired capacity.
-
-
Method Details
-
get
Gets data at a particular index in the array.- Parameters:
index
- the desired index.- Returns:
- the data at a particular index in the array.
- Throws:
ArrayIndexOutOfBoundsException
- if the index falls outside of the array bounds.
-
set
Sets the data at a particular index in the array.- Parameters:
index
- the desired index.object
- the object to set.- Throws:
ArrayIndexOutOfBoundsException
- if the index falls outside of the array bounds.
-