@internal
| 281 | |
| 282 | /** @internal */ |
| 283 | class CollisionNode<K, V> extends Node<K, V> { |
| 284 | readonly _tag = "CollisionNode" |
| 285 | |
| 286 | edit: number |
| 287 | readonly hash: number |
| 288 | entries: Array<[K, V]> |
| 289 | |
| 290 | constructor( |
| 291 | edit: number, |
| 292 | hash: number, |
| 293 | entries: Array<[K, V]> |
| 294 | ) { |
| 295 | super() |
| 296 | this.edit = edit |
| 297 | this.hash = hash |
| 298 | this.entries = entries |
| 299 | } |
| 300 | |
| 301 | get size(): number { |
| 302 | return this.entries.length |
| 303 | } |
| 304 | |
| 305 | get(_shift: number, hash: number, key: K): Option.Option<V> { |
| 306 | if (this.hash !== hash) { |
| 307 | return Option.none() |
| 308 | } |
| 309 | |
| 310 | for (const [k, v] of this.entries) { |
| 311 | if (Equal_.equals(k, key)) { |
| 312 | return Option.some(v) |
| 313 | } |
| 314 | } |
| 315 | return Option.none() |
| 316 | } |
| 317 | |
| 318 | has(_shift: number, hash: number, key: K): boolean { |
| 319 | if (this.hash !== hash) { |
| 320 | return false |
| 321 | } |
| 322 | |
| 323 | for (const [k] of this.entries) { |
| 324 | if (Equal_.equals(k, key)) { |
| 325 | return true |
| 326 | } |
| 327 | } |
| 328 | return false |
| 329 | } |
| 330 | |
| 331 | set( |
| 332 | edit: number, |
| 333 | shift: number, |
| 334 | hash: number, |
| 335 | key: K, |
| 336 | value: V, |
| 337 | added: { value: boolean } |
| 338 | ): Node<K, V> { |
| 339 | if (this.hash !== hash) { |
| 340 | added.value = true |
nothing calls this directly
no outgoing calls
no test coverage detected