envzn
0.8 · beta · not released

Library / Collections / Dictionaries / CollisionNode

CLASSIMPLEMENTS Cloneable, Comparable<CollisionNode<K, V, HASH>>, Equatable<CollisionNode<K, V, HASH>>

CollisionNode

CollisionNode.ev — one (key, value, cachedHash) cell, as a VALUE CLASS so the hash bucket stores it INLINE (no per-entry heap node). This is the Phase-1 dict- rebuild substrate replacing the heap-allocated ChainedHashEntry: a HashBucket holds CollisionNodes by value (two inline slots + a contiguous spill), and an Array[CollisionNode[K,V]] lowers to inline storage — _ValueArray when K,V are primitive (the trivially-copyable C-class path), _ObjectArray-by-value when K is a class (e.g. a String key → owning handle field, the managed value-class form the compiler deep-copies).

Constructors 2

INIT()

An empty node: key and value at their types' defaults, and not valid. What an array slot holds before a node is written to it (I.J.vi, E1159); .valid is what says it holds nothing.

INIT(K k, V v, HASH h)

Methods 8

METHOD hashValue() RETURNS HASH
reads

The cached hash of this node's key (used by resize re-bucketing and the pre-compare reject in lookup).

METHOD matches(HASH h, REFERENCE K other) RETURNS boolean
reads

TRUE if this node matches both the query hash and the query key. The cached HASH is checked first (cheap reject); only on a hash hit is identity confirmed via Equatable (class keys) or == (primitive keys) — the design doc's "compare hash first, confirm key" step. Backs every lookup/insert/remove scan.

MODIFY METHOD setValue(V v) RETURNS void
modifies

Replace the stored value in place — backs insert-over-existing-key (the key and cached hash are unchanged).

METHOD valueClone() RETURNS V
reads

A clone of the stored value — backs by-value lookup.

METHOD keyClone() RETURNS K
reads

A clone of the stored key — backs keys().

METHOD clone() RETURNS CollisionNode[K, V, HASH]
reads

Deep copy — key and value cloned, cached hash carried across.

METHOD equals(REFERENCE CollisionNode[K, V, HASH] other) RETURNS boolean
reads
METHOD isLessThan(REFERENCE CollisionNode[K, V, HASH] other) RETURNS boolean
reads