encompass-gc-optimized-collections
Version:
Provides GC optimized collections in TypeScript and Lua for use with Encompass-TS
26 lines • 780 B
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const init_1 = require("../init");
class GCOptimizedSortedList extends init_1.GCOptimizedList {
add(value) {
for (const [index, v] of this.entries()) {
if (value < v) {
this.insert(index, value);
return;
}
}
this.items.set(this._size, value);
this._size += 1;
}
insert(index, value) {
let k = this._size;
while (k > index) {
this.items.set(k, this.items.get(k - 1));
k -= 1;
}
this.items.set(index, value);
this._size += 1;
}
}
exports.GCOptimizedSortedList = GCOptimizedSortedList;
//# sourceMappingURL=gc_optimized_sorted_list.js.map