GrowableFloat64Array Class
A GrowableFloat64Array
is Float64Array accompanied by a count of how many of the array's entries are considered in use.
- In C++ terms, this is like an std::vector
- As entries are added to the array, the buffer is reallocated as needed to accommodate.
- The reallocations leave unused space to accept further additional entries without reallocation.
- The
length
property returns the number of entries in use. - the
capacity
property returns the (usually larger) length of the (over-allocated) Float64Array.
Methods
Name | Description | |
---|---|---|
constructor(initialCapacity: number8, growthFactor?: number): GrowableFloat64Array | Construct a GrowableFloat64Array. | |
atUncheckedIndex(index: number): number | Access by index, without bounds check | |
back(): number | Access the final member, without bounds check | |
capacity(): number | Returns the number of entries in the supporting Float64Array buffer. | |
clear(): void | Clear the array to 0 length. | |
clone(maintainExcessCapacity: booleanfalse): GrowableFloat64Array | Return a new array with | |
compressAdjacentDuplicates(tolerance: number0.0): void | * compress out multiple copies of values. | |
copyData(source: Float64Array | number[], sourceCount?: number, destOffset?: number): { count: number, offset: number } Protected | Copy data from source array. | |
ensureCapacity(newCapacity: number, applyGrowthFactor: booleantrue): void | * If the capacity (Float64Array length) is less than or equal to the requested newCapacity, do nothing. | |
front(): number | Access the 0-index member, without bounds check | |
move(i: number, j: number): void | Move the value at index i to index j. | |
pop(): void | * Reduce the length by one. | |
push(toPush: number): void | append a single value to the array. | |
pushArray(data: Float64Array | number[]): void | Push each value from an array. | |
pushBlockCopy(copyFromIndex: number, numToCopy: number): void | Push numToCopy consecutive values starting at copyFromIndex . |
|
reassign(index: number, value: number): void | set a value by index | |
resize(newLength: number, padValue: number0): void | * If newLength is less than current length, just reset current length to newLength, effectively trimming active entries but preserving original capacity. | |
restrictToInterval(a: number, b: number): void | * compress out values not within the [a,b] interval. | |
setAtUncheckedIndex(index: number, value: number): void | Set the value at specified index. | |
sort(compareMethod: (a: any, b: any) => number...): void | * Sort the array entries. | |
swap(i: number, j: number): void | swap the values at indices i and j | |
compare(a: any, b: any): number Static | sort-compatible comparison. | |
create(contents: Float64Array | number[]): GrowableFloat64Array Static | Create a GrowableFloat64Array with given contents. |
Properties
Name | Type | Description | |
---|---|---|---|
length Accessor ReadOnly | number | Returns the number of entries in use. |
Defined in
Last Updated: 28 October, 2024
Found something wrong, missing, or unclear on this page?Raise an issue in our repo.