FuzzyMultiMap
Defined in: packages/data/src/fuzzy/fuzzy-multi-map.ts:27
A multimap whose keys match after a caller-supplied normalisation.
FuzzyMap’s normalisation with MultiMap’s one-key-many-values shape: keys
that normalise together share a bucket, and the bucket keeps every value in
insertion order, duplicates included.
As in FuzzyMap, the first key to claim a normalised bucket is the one
keys() reports, so the original spelling survives for display.
Time complexity: O(1) plus normalize for add, has, countFor and
delete; O(k) for hasEntry/deleteEntry in the bucket’s size.
Type Parameters
Section titled “Type Parameters”K
The key type as callers see it.
V
The value type.
Implements
Section titled “Implements”IMultimap<K,V>
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new FuzzyMultiMap<
K,V>(iterable,options):FuzzyMultiMap<K,V>
Defined in: packages/data/src/fuzzy/fuzzy-multi-map.ts:33
Parameters
Section titled “Parameters”iterable
Section titled “iterable”Iterable<readonly [K, V], any, any> | undefined
options
Section titled “options”Returns
Section titled “Returns”FuzzyMultiMap<K, V>
Methods
Section titled “Methods”[iterator]()
Section titled “[iterator]()”[iterator]():
Iterator<readonly [K,V]>
Defined in: packages/data/src/fuzzy/fuzzy-multi-map.ts:46
Returns
Section titled “Returns”Iterator<readonly [K, V]>
Implementation of
Section titled “Implementation of”add(
key,value):void
Defined in: packages/data/src/fuzzy/fuzzy-multi-map.ts:74
O(1) plus normalize. Appends even when the value is already present.
Parameters
Section titled “Parameters”K
V
Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”addAll()
Section titled “addAll()”addAll(
key,values):void
Defined in: packages/data/src/fuzzy/fuzzy-multi-map.ts:80
O(m) in the number of values.
Parameters
Section titled “Parameters”K
values
Section titled “values”Iterable<V>
Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”clear()
Section titled “clear()”clear():
void
Defined in: packages/data/src/fuzzy/fuzzy-multi-map.ts:55
Removes all elements from the collection.
Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”count()
Section titled “count()”count():
number
Defined in: packages/data/src/fuzzy/fuzzy-multi-map.ts:51
The total number of (key, value) entries, not the number of keys.
Returns
Section titled “Returns”number
Implementation of
Section titled “Implementation of”countFor()
Section titled “countFor()”countFor(
key):number
Defined in: packages/data/src/fuzzy/fuzzy-multi-map.ts:150
O(1) plus normalize.
Parameters
Section titled “Parameters”K
Returns
Section titled “Returns”number
Implementation of
Section titled “Implementation of”delete()
Section titled “delete()”delete(
key):number
Defined in: packages/data/src/fuzzy/fuzzy-multi-map.ts:110
Removes the whole bucket key normalises to. O(1) plus normalize.
Parameters
Section titled “Parameters”K
Returns
Section titled “Returns”number
How many entries were removed.
Implementation of
Section titled “Implementation of”deleteEntry()
Section titled “deleteEntry()”deleteEntry(
key,value):boolean
Defined in: packages/data/src/fuzzy/fuzzy-multi-map.ts:125
Removes the first occurrence of value in the bucket. O(k).
Parameters
Section titled “Parameters”K
V
Returns
Section titled “Returns”boolean
Implementation of
Section titled “Implementation of”entries()
Section titled “entries()”entries():
IterableIterator<readonly [K,V]>
Defined in: packages/data/src/fuzzy/fuzzy-multi-map.ts:167
Every pair, grouped by bucket, each key in its original form.
Returns
Section titled “Returns”IterableIterator<readonly [K, V]>
Implementation of
Section titled “Implementation of”get(
key):IterableIterator<V>
Defined in: packages/data/src/fuzzy/fuzzy-multi-map.ts:61
The values under whatever key normalises to, in insertion order.
Parameters
Section titled “Parameters”K
Returns
Section titled “Returns”IterableIterator<V>
Implementation of
Section titled “Implementation of”has(
key):boolean
Defined in: packages/data/src/fuzzy/fuzzy-multi-map.ts:94
O(1) plus normalize.
Parameters
Section titled “Parameters”K
Returns
Section titled “Returns”boolean
Implementation of
Section titled “Implementation of”hasEntry()
Section titled “hasEntry()”hasEntry(
key,value):boolean
Defined in: packages/data/src/fuzzy/fuzzy-multi-map.ts:99
O(k) in the bucket’s size.
Parameters
Section titled “Parameters”K
V
Returns
Section titled “Returns”boolean
Implementation of
Section titled “Implementation of”keyCount()
Section titled “keyCount()”keyCount():
number
Defined in: packages/data/src/fuzzy/fuzzy-multi-map.ts:155
The number of distinct normalised keys. O(1).
Returns
Section titled “Returns”number
Implementation of
Section titled “Implementation of”keys()
Section titled “keys()”keys():
IterableIterator<K>
Defined in: packages/data/src/fuzzy/fuzzy-multi-map.ts:160
Each bucket’s stored key, in its original form.
Returns
Section titled “Returns”IterableIterator<K>
Implementation of
Section titled “Implementation of”storedKey()
Section titled “storedKey()”storedKey(
key):K|undefined
Defined in: packages/data/src/fuzzy/fuzzy-multi-map.ts:176
The key actually stored for whatever key normalises to.
Parameters
Section titled “Parameters”K
Returns
Section titled “Returns”K | undefined