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: number = 8): 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: boolean = false): GrowableFloat64Array Return a new array with  
compressAdjacentDuplicates(tolerance: number = 0): void * compress out multiple copies of values.  
ensureCapacity(newCapacity: number): 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.  
pushBlockCopy(copyFromIndex: number, numToCopy: number): void Push a numToCopy consecutive values starting at copyFromIndex to the end of the array.  
reassign(index: number, value: number): void set a value by index  
resize(newLength: number, padValue: number = 0): void * If newLength is less than current (active) length, just set (active) length.  
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 = GrowableFloat64Array.compare): 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: 13 June, 2024