import { URI } from './uri.js'; export declare function getOrSet(map: Map, key: K, value: V): V; export declare function mapToString(map: Map): string; export declare function setToString(set: Set): string; interface ResourceMapKeyFn { (resource: URI): string; } export declare class ResourceMap implements Map { private static readonly defaultToKey; readonly [Symbol.toStringTag] = "ResourceMap"; private readonly map; private readonly toKey; /** * * @param toKey Custom uri identity function, e.g use an existing `IExtUri#getComparison`-util */ constructor(toKey?: ResourceMapKeyFn); /** * * @param other Another resource which this maps is created from * @param toKey Custom uri identity function, e.g use an existing `IExtUri#getComparison`-util */ constructor(other?: ResourceMap, toKey?: ResourceMapKeyFn); /** * * @param other Another resource which this maps is created from * @param toKey Custom uri identity function, e.g use an existing `IExtUri#getComparison`-util */ constructor(entries?: readonly (readonly [URI, T])[], toKey?: ResourceMapKeyFn); set(resource: URI, value: T): this; get(resource: URI): T | undefined; has(resource: URI): boolean; get size(): number; clear(): void; delete(resource: URI): boolean; forEach(clb: (value: T, key: URI, map: Map) => void, thisArg?: any): void; values(): IterableIterator; keys(): IterableIterator; entries(): IterableIterator<[URI, T]>; [Symbol.iterator](): IterableIterator<[URI, T]>; } export declare class ResourceSet implements Set { readonly [Symbol.toStringTag]: string; private readonly _map; constructor(toKey?: ResourceMapKeyFn); constructor(entries: readonly URI[], toKey?: ResourceMapKeyFn); get size(): number; add(value: URI): this; clear(): void; delete(value: URI): boolean; forEach(callbackfn: (value: URI, value2: URI, set: Set) => void, thisArg?: any): void; has(value: URI): boolean; entries(): IterableIterator<[URI, URI]>; keys(): IterableIterator; values(): IterableIterator; [Symbol.iterator](): IterableIterator; } export declare const enum Touch { None = 0, AsOld = 1, AsNew = 2 } export declare class LinkedMap implements Map { readonly [Symbol.toStringTag] = "LinkedMap"; private _map; private _head; private _tail; private _size; private _state; constructor(); clear(): void; isEmpty(): boolean; get size(): number; get first(): V | undefined; get last(): V | undefined; has(key: K): boolean; get(key: K, touch?: Touch): V | undefined; set(key: K, value: V, touch?: Touch): this; delete(key: K): boolean; remove(key: K): V | undefined; shift(): V | undefined; forEach(callbackfn: (value: V, key: K, map: LinkedMap) => void, thisArg?: any): void; keys(): IterableIterator; values(): IterableIterator; entries(): IterableIterator<[K, V]>; [Symbol.iterator](): IterableIterator<[K, V]>; protected trimOld(newSize: number): void; protected trimNew(newSize: number): void; private addItemFirst; private addItemLast; private removeItem; private touch; toJSON(): [K, V][]; fromJSON(data: [K, V][]): void; } declare abstract class Cache extends LinkedMap { protected _limit: number; protected _ratio: number; constructor(limit: number, ratio?: number); get limit(): number; set limit(limit: number); get ratio(): number; set ratio(ratio: number); get(key: K, touch?: Touch): V | undefined; peek(key: K): V | undefined; set(key: K, value: V): this; protected checkTrim(): void; protected abstract trim(newSize: number): void; } export declare class LRUCache extends Cache { constructor(limit: number, ratio?: number); protected trim(newSize: number): void; set(key: K, value: V): this; } export declare class MRUCache extends Cache { constructor(limit: number, ratio?: number); protected trim(newSize: number): void; set(key: K, value: V): this; } export declare class CounterSet { private map; add(value: T): CounterSet; delete(value: T): boolean; has(value: T): boolean; } /** * A map that allows access both by keys and values. * **NOTE**: values need to be unique. */ export declare class BidirectionalMap { private readonly _m1; private readonly _m2; constructor(entries?: readonly (readonly [K, V])[]); clear(): void; set(key: K, value: V): void; get(key: K): V | undefined; getKey(value: V): K | undefined; delete(key: K): boolean; forEach(callbackfn: (value: V, key: K, map: BidirectionalMap) => void, thisArg?: any): void; keys(): IterableIterator; values(): IterableIterator; } export declare class SetMap { private map; add(key: K, value: V): void; delete(key: K, value: V): void; forEach(key: K, fn: (value: V) => void): void; get(key: K): ReadonlySet; } export declare function mapsStrictEqualIgnoreOrder(a: Map, b: Map): boolean; /** * A map that is addressable with an arbitrary number of keys. This is useful in high performance * scenarios where creating a composite key whenever the data is accessed is too expensive. For * example for a very hot function, constructing a string like `first-second-third` for every call * will cause a significant hit to performance. */ export declare class NKeyMap { private _data; /** * Sets a value on the map. Note that unlike a standard `Map`, the first argument is the value. * This is because the spread operator is used for the keys and must be last.. * @param value The value to set. * @param keys The keys for the value. */ set(value: TValue, ...keys: [...TKeys]): void; get(...keys: [...TKeys]): TValue | undefined; clear(): void; values(): IterableIterator; /** * Get a textual representation of the map for debugging purposes. */ toString(): string; } export {};