/*! * Copyright (c) Microsoft Corporation and contributors. All rights reserved. * Licensed under the MIT License. */ import type { IVectorConsumer } from "@tiny-calc/nano"; import { type Handle } from "./handletable.js"; import type { PermutationVector } from "./permutationvector.js"; /** * Used by PermutationVector to cache position -\> handle lookups. * * Perf: Possibly, this should eventually be inlined into PermutationVector itself, but * so far there's no measurable perf penalty for being a separate object (node 12 x64) */ export declare class HandleCache implements IVectorConsumer { readonly vector: PermutationVector; private handles; private start; constructor(vector: PermutationVector); /** * Returns the index of the given position in the 'handles' array as a Uint32. * (If the position is not in the array, returns an integer greater than 'handles.length'). */ private getIndex; /** * Returns the handle currently assigned to the given 'position' (if any). Check * the result with 'isValidHandle(..)' to see if a handle has been allocated for * the given position. * * @throws A 'RangeError' if the provided 'position' is out-of-bounds with regards to the * PermutationVector's length. */ getHandle(position: number): Handle; /** * Update the cache when a handle has been allocated for a given position. */ addHandle(position: number, handle: Handle): void; /** * Used by {@link HandleCache.cacheMiss} to retrieve handles for a range of positions. * @param start - The start position (inclusive). * @param end - The end position (exclusive). * @param handles - The array to populate with handles. Note that it is mutated in place. */ private getHandles; private cacheMiss; itemsChanged(start: number, removedCount: number, insertedCount: number): void; } //# sourceMappingURL=handlecache.d.ts.map