import { HashComputationLevel, LeafNode, Node } from "@chainsafe/persistent-merkle-tree"; import { ValueOf } from "../type/abstract.ts"; import { BasicType } from "../type/basic.ts"; import { ArrayBasicType } from "../view/arrayBasic.ts"; import { TreeViewDU } from "./abstract.ts"; export type ArrayBasicTreeViewDUCache = { nodes: LeafNode[]; length: number; nodesPopulated: boolean; }; export declare class ArrayBasicTreeViewDU> extends TreeViewDU> { readonly type: ArrayBasicType; protected _rootNode: Node; protected nodes: LeafNode[]; protected readonly nodesChanged: Set; protected _length: number; protected dirtyLength: boolean; private nodesPopulated; constructor(type: ArrayBasicType, _rootNode: Node, cache?: ArrayBasicTreeViewDUCache); /** * Number of elements in the array. Equal to un-commited length of the array */ get length(): number; get node(): Node; get cache(): ArrayBasicTreeViewDUCache; /** * Get element at `index`. Returns the Basic element type value directly */ get(index: number): ValueOf; /** * Set Basic element type `value` at `index` */ set(index: number, value: ValueOf): void; /** * Get all values of this array as Basic element type values, from index zero to `this.length - 1` * @param values optional output parameter, if is provided it must be an array of the same length as this array */ getAll(values?: ValueOf[]): ValueOf[]; /** * When we need to compute HashComputations (hcByLevel != null): * - if old _rootNode is hashed, then only need to put pending changes to hcByLevel * - if old _rootNode is not hashed, need to traverse and put to hcByLevel */ commit(hcOffset?: number, hcByLevel?: HashComputationLevel[] | null): void; protected clearCache(): void; }