Class VectorTree<T extends ACell>

java.lang.Object
Type Parameters:
T - Type of Vector elements
All Implemented Interfaces:
IAssociative<CVMLong,T>, IValidated, IWriteable, Iterable<T>, Collection<T>, List<T>, SequencedCollection<T>

public class VectorTree<T extends ACell> extends AVector<T>
Persistent Vector implemented as a merkle tree of chunks shift indicates the level of the tree: 4 = 1st level, 8 = second etc. Invariants:
  • All children except the last must be fully packed
  • Each non-terminal leaf chunk must be a tailless VectorLeaf of size 16
This implies that the entire tree must be a multiple of 16 in size. This is a desirable property as we want dense trees in our canonical representation. Any extra elements must be stored in a ListVector. This structure facilitates fast ~O(log(n)) operations for lookup and vector element update, and usually O(1) element additions/lookup at end. "Software gets slower faster than hardware gets faster" - Niklaus Wirth