interface HashTableHashColumn.Builder<R,C,V>
undocumented
Extends: TableBase.Builder<R,C,V,Tp>
Type parameters
Name | Description |
---|---|
R | undocumented |
C | undocumented |
V | undocumented |
Properties
amountRows
Returns the amount of rows in the builder.
amountRows
isEmpty
Returns true if there are no entries in the builder.
isEmpty
size
Returns the amount of entries in the builder.
size
Methods
addEntries
Adds the given entries
to the builder.
addEntries
entries
to the builder.Definition
addEntries(entries:
StreamSource
<readonly [R, C, V]>): boolean;
Parameters
Name | Type | Description |
---|---|---|
entries | StreamSource <readonly [R, C, V]> |
const t = HashTableHashColumn.of([1, 2, 3], [1, 4, 5]).toBuilder()
t.addEntries([[1, 2, 3], [1, 2, 3]]) // => false
t.addEntries([[1, 2, 3], [2, 3, 4]]) // => true
Overrides
addEntry
Adds the given entry
to the builder.
addEntry
entry
to the builder.build
Returns an immutable collection instance containing the entries in this builder.
build
buildMapValues
Returns an immutable collection instance containing the entries in this builder.
buildMapValues
Definition
buildMapValues<V2>(mapFun: (value: V, row: R, column: C) => V2): (Tp &
Row
<R, C, V2>)['normal'];
Type parameters
Name | Description |
---|---|
V2 |
Parameters
Name | Type | Description |
---|---|---|
mapFun | (value: V, row: R, column: C) => V2 | a function receiving the value , row and column , and returning a new value |
const m = HashTableHashColumn.of([1, 2, 3], [1, 4, 5]).toBuilder()
const m2: HashTableHashColumn<number, number, boolean> = m.buildMapValues(v => v > 3)
Overrides
forEach
Performs given function f
for each entry of the collection, using given state
as initial traversal state.
forEach
f
for each entry of the collection, using given state
as initial traversal state.Definition
forEach(f: (entry: [R, C, V], index: number, halt: () => void) => void, options?: {
state?:
TraverseState
;
}): void;
Parameters
Name | Type | Description |
---|---|---|
f | (entry: [R, C, V], index: number, halt: () => void) => void | the function to perform for each entry, receiving: - entry : the next tuple of a row key, column key, and value- index : the index of the element- halt : a function that, if called, ensures that no new elements are passed |
options | { state?: TraverseState ; } | object containing the following - state: (optional) the traverse state |
HashTableHashColumn.of([1, 2, 3], [1, 4, 5], [2, 3, 5])
.toBuilder()
.forEach((entry, i, halt) => {
console.log([entry]);
if (i >= 1) halt();
})
// => logs [1, 2, 3] [1, 4, 5]
O(N)
Overrides
get
Returns the value at given row
and column
keys, or the otherwise
value if no value is present.
get
row
and column
keys, or the otherwise
value if no value is present.Definitions
get<UR = R, UC = C>(row:
RelatedTo
<R, UR>, column:
RelatedTo
<C, UC>): V
|
undefined;
get<UR, UC, O>(row:
RelatedTo
<R, UR>, column:
RelatedTo
<C, UC>, otherwise:
OptLazy
<O>): V
|
O;
Type parameters
Name | Default | Description |
---|---|---|
UR | R | |
UC | C |
Parameters
Name | Type | Description |
---|---|---|
row | RelatedTo <R, UR> | the row key |
column | RelatedTo <C, UC> | the column key |
const t = HashTableHashColumn.of([1, 2, 3], [1, 4, 5]).toBuilder()
t.get(10, 1) // => undefined
t.get(10, 1, 0) // => 0
t.get(1, 2) // => 3
t.get(1, 2, 0) // => 3
Overrides
getRow
Returns a map containing the column keys and values in the given row
.
getRow
row
.Definition
getRow<UR = R>(row:
RelatedTo
<R, UR>):
WithRow
<Tp, R, C, V>['row'];
Type parameters
Name | Default | Description |
---|---|---|
UR | R |
Parameters
Name | Type | Description |
---|---|---|
row | RelatedTo <R, UR> | the row key |
const t = HashTableHashColumn.of([1, 2, 3], [1, 4, 5]).toBuilder()
t.getRow(10).toArray() // => []
t.getRow(1).toArray() // => [[2, 3], [4, 5]]
Overrides
hasRowKey
Returns true if given row
key is in the builder.
hasRowKey
row
key is in the builder.Definition
hasRowKey<UR = R>(row:
RelatedTo
<R, UR>): boolean;
Type parameters
Name | Default | Description |
---|---|---|
UR | R |
Parameters
Name | Type | Description |
---|---|---|
row | RelatedTo <R, UR> | the row key to look for |
const t = HashTableHashColumn.of([1, 2, 3], [1, 4, 5]).toBuilder()
t.hasRowKey(10) // => false
t.hasRowKey(1) // => true
Overrides
hasValueAt
Returns true if the builder has a value for given row
and column
keys.
hasValueAt
row
and column
keys.Definition
hasValueAt<UR = R, UC = C>(row:
RelatedTo
<R, UR>, column:
RelatedTo
<C, UC>): boolean;
Type parameters
Name | Default | Description |
---|---|---|
UR | R | |
UC | C |
Parameters
Name | Type | Description |
---|---|---|
row | RelatedTo <R, UR> | the row key |
column | RelatedTo <C, UC> | the column key |
const t = HashTableHashColumn.of([1, 2, 3], [1, 4, 5]).toBuilder()
t.hasValueAt(10, 1) // => false
t.hasValueAt(1, 4) // => true
Overrides
modifyAt
Modifies the value at given row
and column
keys according to given options
.
modifyAt
row
and column
keys according to given options
.Definition
modifyAt(row: R, column: C, options: {
ifNew?:
OptLazyOr
<V, Token>;
ifExists?: (currentValue: V, remove: Token) => V
|
Token
|
V;
}): boolean;
Parameters
Name | Type | Description |
---|---|---|
row | R | the row key |
column | C | the column key |
options | { ifNew?: OptLazyOr <V, Token>; ifExists?: (currentValue: V, remove: Token) => V | Token | V; } |
const t = HashTableHashColumn.of([1, 2, 3], [1, 4, 5]).toBuilder()
t.modifyAt(2, 5, { ifNew: 8 })
// => true
t.modifyAt(2, 6, { ifNew: (none) => 1 < 2 ? none : 8 })
// => false
t.modifyAt(1, 2, { ifExists: (v) => v * 2 })
// => true
t.modifyAt(1, 2, { ifExists: (v, remove) => remove })
// => true
Overrides
remove
Remove the value at given row
and column
keys in the builder.
remove
row
and column
keys in the builder.Definitions
remove<UR = R, UC = C>(row:
RelatedTo
<R, UR>, column:
RelatedTo
<C, UC>): V
|
undefined;
remove<UR, UC, O>(row:
RelatedTo
<R, UR>, column:
RelatedTo
<C, UC>, otherwise:
OptLazy
<O>): V
|
O;
Type parameters
Name | Default | Description |
---|---|---|
UR | R | |
UC | C |
Parameters
Name | Type | Description |
---|---|---|
row | RelatedTo <R, UR> | the row key |
column | RelatedTo <C, UC> | the column key |
const t = HashTableHashColumn.of([1, 2, 3], [1, 4, 5]).toBuilder()
t.remove(5, 6) // => undefined
t.remove(5, 6, 'a') // => 'a'
t.remove(1, 2) // => 3
t.remove(1, 4, 'a') // => 5
Overrides
removeEntries
Removes all given entries
from the builder.
removeEntries
entries
from the builder.Definition
removeEntries<UR = R, UC = C>(entries:
StreamSource
<[
RelatedTo
<R, UR>,
RelatedTo
<C, UC>]>): boolean;
Type parameters
Name | Default | Description |
---|---|---|
UR | R | |
UC | C |
Parameters
Name | Type | Description |
---|---|---|
entries | StreamSource <[ RelatedTo <R, UR>, RelatedTo <C, UC>]> |
const t = HashTableHashColumn.of([1, 2, 3], [1, 4, 5], [2, 3, 5]).toBuilder()
t.removeEntries([[7, 8, 9], [9, 8, 7]]) // => false
t.removeEntries([[7, 8, 9], [1, 2, 3]]) // => true
Overrides
removeRow
Removes all values in the given row
from the builder.
removeRow
row
from the builder.removeRows
Removes all given rows
from the builder.
removeRows
rows
from the builder.Definition
removeRows<UR = R>(rows:
StreamSource
<
RelatedTo
<R, UR>>): boolean;
Type parameters
Name | Default | Description |
---|---|---|
UR | R |
Parameters
Name | Type | Description |
---|---|---|
rows | StreamSource < RelatedTo <R, UR>> |
const t = HashTableHashColumn.of([1, 2, 3], [1, 4, 5], [2, 3, 5]).toBuilder()
t.removeRows([10, 11]) // => false
t.removeRows([1, 10]) // => true
Overrides
set
Sets the given value
for the given row
and column
keys in the builder.
set
value
for the given row
and column
keys in the builder.updateAt
Updates the value at given row
and column
keys according to the given update
function.
updateAt
row
and column
keys according to the given update
function.Definitions
updateAt(row: R, column: C, update:
Update
<V>): V
|
undefined;
updateAt<O>(row: R, column: C, update:
Update
<V>, otherwise:
OptLazy
<O>): V
|
O;
Parameters
Name | Type | Description |
---|---|---|
row | R | the row key |
column | C | the column key |
update | Update <V> | a function taking the current value and returning a new value |
const t = HashTableHashColumn.of([1, 2, 3], [1, 4, 5])
t.updateAt(3, 4, v => v * 2) // => undefined
t.updateAt(3, 4, v => v * 2, 'a') // => 'a'
t.updateAt(1, 2, v => v * 2) // => true
t.updateAt(1, 2, v => v * 2, 'a') // => true