Aller au contenu
Français

BidirectionalMultiMap

Ce contenu n’est pas encore disponible dans votre langue.

Defined in: src/util/BidirectionalMultiMap.ts:80

L

R

new BidirectionalMultiMap<L, R>(pairs?): BidirectionalMultiMap<L, R>

Defined in: src/util/BidirectionalMultiMap.ts:97

Builds an empty relation, or one seeded from pairs. Seeding goes through add, so a repeated pair in the input is idempotent rather than counted twice.

Iterable<readonly [L, R], any, any> | null

BidirectionalMultiMap<L, R>

get [toStringTag](): string

Defined in: src/util/BidirectionalMultiMap.ts:313

Makes Object.prototype.toString.call(…) report [object BidirectionalMultiMap].

string


get size(): number

Defined in: src/util/BidirectionalMultiMap.ts:107

Number of pairs — not participants. Both directions always agree on it.

number

[iterator](): IterableIterator<[L, R]>

Defined in: src/util/BidirectionalMultiMap.ts:308

Every pair as [left, right] — makes the relation spreadable and for…of-able.

IterableIterator<[L, R]>


add(left, right): this

Defined in: src/util/BidirectionalMultiMap.ts:112

Relates left and right. Adding a pair that already exists is a no-op.

L

R

this


clear(): void

Defined in: src/util/BidirectionalMultiMap.ts:217

Drops every pair.

void


delete(left, right): boolean

Defined in: src/util/BidirectionalMultiMap.ts:136

Removes one pair from both directions. true if there was one.

A participant left with no partners is removed outright — see the note on participants in the class docs.

L

R

boolean


deleteLeft(left): boolean

Defined in: src/util/BidirectionalMultiMap.ts:172

Drops left and every pair it held — the Terminated case, where one participant stops and has to leave no trace on the other side. true if it held anything.

L

boolean


deleteRight(right): boolean

Defined in: src/util/BidirectionalMultiMap.ts:187

Drops right and every pair it held — the mirror of deleteLeft.

R

boolean


entries(): IterableIterator<[L, R]>

Defined in: src/util/BidirectionalMultiMap.ts:234

Every pair as [left, right], grouped by left participant in insertion order.

IterableIterator<[L, R]>


forEach(callback, thisArg?): void

Defined in: src/util/BidirectionalMultiMap.ts:248

Runs callback for every pair.

The third argument is this map, not an internal one. Handing out the storage would let a callback mutate one direction directly and leave the other stale — the same reasoning as the 1:1 sibling’s forEach.

(right, left, map) => void

unknown

void


get(left): ReadonlySet<R>

Defined in: src/util/BidirectionalMultiMap.ts:158

Everything left is related to — the live set, in insertion order. Empty when left has no partners, never undefined, so a caller can iterate the result without a guard.

L

ReadonlySet<R>


getKeys(right): ReadonlySet<L>

Defined in: src/util/BidirectionalMultiMap.ts:163

Everything related to right — the mirror of get, and the whole point of the type.

R

ReadonlySet<L>


has(left, right): boolean

Defined in: src/util/BidirectionalMultiMap.ts:202

Whether the pair is present.

L

R

boolean


hasLeft(left): boolean

Defined in: src/util/BidirectionalMultiMap.ts:207

Whether left has at least one partner.

L

boolean


hasRight(right): boolean

Defined in: src/util/BidirectionalMultiMap.ts:212

Whether right has at least one partner.

R

boolean


inverse(): BidirectionalMultiMap<R, L>

Defined in: src/util/BidirectionalMultiMap.ts:261

The same relation read the other way round — a view over the same storage, not a copy. A write on either side is visible from the other, size stays true on both, and inverse().inverse() is another view with the original orientation.

BidirectionalMultiMap<R, L>


lefts(): MapIterator<L>

Defined in: src/util/BidirectionalMultiMap.ts:224

The left participants, in insertion order. Every one has at least one partner.

MapIterator<L>


rights(): MapIterator<R>

Defined in: src/util/BidirectionalMultiMap.ts:229

The right participants, in insertion order. Every one has at least one partner.

MapIterator<R>


toJSON(): BidirectionalMultiMapJson<L, R>

Defined in: src/util/BidirectionalMultiMap.ts:275

Wire shape — the forward adjacency list only, tagged so a decoder can tell what it is. Honoured by JSON.stringify, which is what carries the relation over the cluster wire; persistence stores use the richer JsonTree tag instead and never reach this method.

BidirectionalMultiMapJson<L, R>


static fromJSON<L, R>(json): BidirectionalMultiMap<L, R>

Defined in: src/util/BidirectionalMultiMap.ts:290

Rebuilds a relation from toJSON output, restoring the reverse direction from the forward rows.

The payload is an array of rows rather than an object, which is why this decoder needs none of the __proto__ guards a peer-facing object decoder does: participants go into a Map, where '__proto__' is an ordinary key and reaches no prototype setter.

L

R

BidirectionalMultiMapJson<L, R>

BidirectionalMultiMap<L, R>