Skip to content

Class: Relation ‹F, T

Data structure storing many-to-many relationships between two value types -- essentially a bidirectional map.

Type parameters

F

T

Hierarchy

  • Relation

Index

Properties

Methods

Properties

Private fromMap

fromMap: Map‹F, Set‹T›› = new Map()

Defined in lib/utility/Relation.ts:3


Private toMap

toMap: Map‹T, Set‹F›› = new Map()

Defined in lib/utility/Relation.ts:5

Methods

from

from(val: F): IterableIterator‹T›

Defined in lib/utility/Relation.ts:47

Returns all associations from the given value to any other value.

Parameters:

Name Type Default
val F null

Returns: IterableIterator‹T›


link(from: F, to: T): void

Defined in lib/utility/Relation.ts:8

Creates an association from the first argument to the second.

Parameters:

Name Type
from F
to T

Returns: void


to

to(val: T): IterableIterator‹F›

Defined in lib/utility/Relation.ts:55

Returns all associations to the given value from any other value.

Parameters:

Name Type Default
val T null

Returns: IterableIterator‹F›


unlink(from: F, to: T): void

Defined in lib/utility/Relation.ts:21

Removes the association between two values if one exists. If either argument is null, removes all associations from or to the other argument.

Parameters:

Name Type Default
from F null
to T null

Returns: void