Interface DogArrayPrimitive<T extends DogArrayPrimitive<T>>
- All Superinterfaces:
MatrixFormattable
- All Known Implementing Classes:
DogArray_B, DogArray_F32, DogArray_F64, DogArray_I16, DogArray_I32, DogArray_I64, DogArray_I8
Interface for growable queues of primitive types
-
Method Summary
Modifier and TypeMethodDescriptioncopy()voidextend(int size) Changes the array to the specified size.voidflip()Flips the elements such that a[i] = a[N-i-1] where N is the number of elements.<D> DReturns the internal data arraydefault booleanisEmpty()True if the container has no elementsdefault booleanisIndexOutOfBounds(int index) Returns true if the specified array index is outside the allowed value rangedefault booleanTrue if the container has elements in itvoidremoveRangeM(int idx0, int idx1) Removes set of elements within the specified range.reserve(int amount) Ensures that the internal array's length is at least this size.default TreserveIncrease(int amount) Ensures that the reserve is at lease the currentsize()plus the specified amount.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'intsize()Number of elements in the queuevoidsort()Sorts the data from smallest to largestvoidzero()Sets all elements to 0 or False for binary queuesMethods inherited from interface MatrixFormattable
format, format
-
Method Details
-
reset
-
isIndexOutOfBounds
default boolean isIndexOutOfBounds(int index) Returns true if the specified array index is outside the allowed value range -
setTo
-
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- Returns:
- Returns 'this' to allow chaining of operations.
-
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
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- Returns:
- Returns 'this' to allow chaining of operations.
-
removeRangeM
void removeRangeM(int idx0, int idx1) Removes set of elements within the specified range. Order of elements will be preserved. O(N) operation. The "M" at the end indicates that this has been optimized to reduce memory overhead and no additional internal arrays are used. References are moved by swapping.- Parameters:
idx0- lower extent, inclusiveidx1- upper extent, exclusive
-
reserveIncrease
-
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 -
getDataArray
<D> D getDataArray()Returns the internal data array -
isEmpty
default boolean isEmpty()True if the container has no elements -
isNotEmpty
default boolean isNotEmpty()True if the container has elements in it
-