Package org.ddogleg.struct
Class BigDogArray_F64
java.lang.Object
org.ddogleg.struct.BigDogArrayBase<double[]>
org.ddogleg.struct.BigDogArray_F64
Implementation of
BigDogArrayBase for double[].-
Nested Class Summary
Nested classes/interfaces inherited from class org.ddogleg.struct.BigDogArrayBase
BigDogArrayBase.AssignNewArrayElements<Array>, BigDogArrayBase.FunctionEachRange<Array>, BigDogArrayBase.NewArray<Array> -
Field Summary
Fields inherited from class org.ddogleg.struct.BigDogArrayBase
blocks, blockSize, DEFAULT_BLOCK_SIZE, generatorArray, growth, initializeArray, size -
Constructor Summary
ConstructorsConstructorDescriptionBigDogArray_F64(int initialAllocation) BigDogArray_F64(int initialAllocation, int blockSize, BigDogGrowth growth) -
Method Summary
Modifier and TypeMethodDescriptionvoidadd(double value) Appends a single value to the end of the array.voidappend(double value) Appends a single value to the end of the arrayvoidapplyIdx(int idx0, int idx1, DogArray_F64.FunctionApplyIdx op) Simulates a for-each loop.protected intarrayLength(double[] array) voidfill(int idx0, int idx1, double value) Fills the elements in the specified range with the specified value.voidforEach(int idx0, int idx1, DogArray_F64.FunctionEach op) Simulates a for-each loop.voidforIdx(int idx0, int idx1, DogArray_F64.FunctionEachIdx op) Simulates a for-each loop.doubleget(int index) Returns the value in the array at the specified indexvoidgetArray(int index, double[] array, int offset, int length) Copies a sub-array into the passed in arraydoublegetTail(int index) Returns the value in the array at the specified index, counting from the end of the array.booleanisEquivalent(BigDogArray_F64 o, double tol) Returns true if both arrays have the same number of elements and the elements are within the specified tolerance of each other.voidremoveSwap(int index) Removes an element in O(1) time by swapping the specified index with the last index and resizing to size -1.voidresize(int desiredSize, double initialValue) Resizes the array and fills all new elements with the specified valuevoidset(int index, double value) Assigns an element a new valuevoidsetTail(int index, double value) Assigns an element a new value, counting from the end of the array.Methods inherited from class org.ddogleg.struct.BigDogArrayBase
allocate, append, blockArrayLength, getDesiredBlocks, getTotalAllocation, isEmpty, isIndexOutOfBounds, isNotEmpty, isValidStructure, processByBlock, removeTail, reserve, reset, resize, setArray, setInitialBlockSize
-
Constructor Details
-
BigDogArray_F64
public BigDogArray_F64() -
BigDogArray_F64
public BigDogArray_F64(int initialAllocation) -
BigDogArray_F64
-
-
Method Details
-
removeSwap
public void removeSwap(int index) Description copied from class:BigDogArrayBaseRemoves an element in O(1) time by swapping the specified index with the last index and resizing to size -1.- Specified by:
removeSwapin classBigDogArrayBase<double[]>
-
arrayLength
protected int arrayLength(double[] array) - Specified by:
arrayLengthin classBigDogArrayBase<double[]>
-
append
public void append(double value) Appends a single value to the end of the array- Parameters:
value- (Input) The new value which is to be added
-
add
public void add(double value) Appends a single value to the end of the array. identical toappend(double).- Parameters:
value- (Input) The new value which is to be added
-
resize
public void resize(int desiredSize, double initialValue) Resizes the array and fills all new elements with the specified value- Parameters:
desiredSize- New array sizeinitialValue- The value of new elements
-
fill
public void fill(int idx0, int idx1, double value) Fills the elements in the specified range with the specified value.- Parameters:
idx0- (Input) First index, inclusive.idx1- (Input) last index, exclusive.value- (Input) Fill value
-
set
public void set(int index, double value) Assigns an element a new value- Parameters:
index- (Input) Which element to modifyvalue- (Input) The element's new value
-
setTail
public void setTail(int index, double value) Assigns an element a new value, counting from the end of the array.- Parameters:
index- (Input) Index relative to the end counting in reverse order. setTail(0, 5) = set(size-1, 5)value- (Input) The element's new value
-
getArray
public void getArray(int index, double[] array, int offset, int length) Copies a sub-array into the passed in array- Parameters:
index- (Input) Start index in this arrayarray- (Output) destination arrayoffset- Offset from start of destination arraylength- Number of elements to copy
-
get
public double get(int index) Returns the value in the array at the specified index- Parameters:
index- (Input) Index in the array- Returns:
- value at index
-
getTail
public double getTail(int index) Returns the value in the array at the specified index, counting from the end of the array.- Parameters:
index- (Input) Index relative to the end counting in reverse order. 0 = get(size-1)
-
forEach
Simulates a for-each loop. Passes in element values to 'op' from the specified range.- Parameters:
idx0- (Input) First index, inclusive.idx1- (Input) Last index, exclusive.op- The operator which processes the values
-
forIdx
Simulates a for-each loop. Passes in array indexes and element values to 'op' from the specified range.- Parameters:
idx0- (Input) First index, inclusive.idx1- (Input) Last index, exclusive.op- The operator which processes the values
-
applyIdx
Simulates a for-each loop. Passes in array indexes and element values to 'op' from the specified range. After calling op, the array is modified by the return value- Parameters:
idx0- (Input) First index, inclusive.idx1- (Input) Last index, exclusive.op- The operator which processes the values
-
isEquivalent
Returns true if both arrays have the same number of elements and the elements are within the specified tolerance of each other.
-