36
37
public insertValues(insertIndex: number, insertValues: Uint32Array): boolean {
39
>
const oldValues = this.values;
40
>
const oldPrefixSum = this.prefixSum;
41
>
const insertValuesLen = insertValues.length;
42
>
43
>
if (insertValuesLen === 0) {
44
return false;
45
}
47
>
this.values = new Uint32Array(oldValues.length + insertValuesLen);
48
>
this.values.set(oldValues.subarray(0, insertIndex), 0);
49
>
this.values.set(oldValues.subarray(insertIndex), insertIndex + insertValuesLen);
50
>
this.values.set(insertValues, insertIndex);
51
>
52
>
if (insertIndex - 1 < this.prefixSumValidIndex[0]) {
53
this.prefixSumValidIndex[0] = insertIndex - 1;
54
}
56
>
this.prefixSum = new Uint32Array(this.values.length);
57
>
if (this.prefixSumValidIndex[0] >= 0) {
58
this.prefixSum.set(oldPrefixSum.subarray(0, this.prefixSumValidIndex[0] + 1));
59
}
61
>
}
62
63
public setValue(index: number, value: number): boolean {