Package org.ddogleg.struct
Interface DogArrayPrimitive<T extends DogArrayPrimitive<T>>
- All Known Implementing Classes:
DogArray_B
,DogArray_F32
,DogArray_F64
,DogArray_I16
,DogArray_I32
,DogArray_I64
,DogArray_I8
public interface DogArrayPrimitive<T extends DogArrayPrimitive<T>>
Interface for growable queues of primitive types
-
Method Summary
Modifier and TypeMethodDescriptioncopy()
void
extend
(int size) Changes the array to the specified size.void
flip()
Flips the elements such that a[i] = a[N-i-1] where N is the number of elements.default boolean
isEmpty()
True if the container has no elementsdefault boolean
isIndexOutOfBounds
(int index) Returns true if the specified array index is outside the allowed value rangevoid
reserve
(int amount) Ensures that the internal array's length is at least this size.reset()
Sets the size to zero.resize
(int size) Ensures that the internal array is at least this size.Turns 'this' into a copy of 'original'int
size()
Number of elements in the queuevoid
sort()
Sorts the data from smallest to largestvoid
zero()
Sets all elements to 0 or False for binary queues
-
Method Details
-
reset
T reset()Sets the size to zero.- Returns:
- Returns 'this' to allow chaining of operations.
-
isIndexOutOfBounds
default boolean isIndexOutOfBounds(int index) Returns true if the specified array index is outside the allowed value range -
setTo
Turns 'this' into a copy of 'original'- Parameters:
original
- queue that is to be copied- Returns:
- Returns 'this' to allow chaining of operations.
-
resize
Ensures that the internal array is at least this size. Value of elements previously in the array will not be changed. If the size is increased then the value of new elements in undefined.
If you wish to resize the array and avoid copying over past values for performance reasons, then you must either resize(0) or callreset()
first.- Parameters:
size
- desired new size
-
extend
void extend(int size) Changes the array to the specified size. If there is not enough storage, a new internal array is created and the elements copied over. This is the same as: a.reserve(size);a.size = size;- Parameters:
size
- desired new size
-
reserve
void reserve(int amount) Ensures that the internal array's length is at least this size. Size is left unchanged. If the array is not empty and it needs to grow then the existing array is copied into the new array.- Parameters:
amount
- minimum size of internal array
-
flip
void flip()Flips the elements such that a[i] = a[N-i-1] where N is the number of elements. -
size
int size()Number of elements in the queue- Returns:
- size of queue
-
zero
void zero()Sets all elements to 0 or False for binary queues -
copy
T copy() -
sort
void sort()Sorts the data from smallest to largest -
isEmpty
default boolean isEmpty()True if the container has no elements
-