import type { GraphCallbacks } from './spreadsheet_vertex_base'; import { SpreadsheetVertexBase } from './spreadsheet_vertex_base'; import type { Cell, ICellAddress, UnionValue } from '../../../treb-base-types/src/index'; import type { ExpressionUnit } from '../../../treb-parser/src/index'; export declare enum SpreadsheetError { None = 0, CalculationError = 1 } /** * specialization of vertex with attached data and calculation metadata */ export declare class SpreadsheetVertex extends SpreadsheetVertexBase { static type: string; reference?: Cell; error: SpreadsheetError; address?: ICellAddress; result: UnionValue; expression: ExpressionUnit; expression_error: boolean; short_circuit: boolean; type: string; /** * it seems like this could be cached, if it gets checked a lot * also what's with the crazy return signature? [fixed] */ get array_head(): boolean; /** * to support restoring cached values (from file), we need a way to get * the value from the reference (cell). normally this is done during * calculation, and in reverse (we set the value). * * some additional implications of this: * * - does not set volatile/nonvolatile, which is usually managed as a * side-effect of the calculation. * * - does not remove the entry from the dirty list * * - does not clear the internal dirty flag. it used to do that, but we * took it out because we are now managing multple vertex types, and * we don't want to attach that behavior to a type-specific method. * * so the caller needs to explicitly address the dirty and volatile lists * for this vertex. */ TakeReferenceValue(): void; /** * once we populate a spill array, we need to follow edges * to dirty nodes and recalculate. watch out for loops, though * * @returns expanded list, or false if we detect a loop */ ExpandEdgeList(source: SpreadsheetVertex, list: SpreadsheetVertex[]): SpreadsheetVertex[] | false; /** * calculates the function, but only if all dependencies are clean. * if one or more dependencies are dirty, just exit. this should work out * so that when the last dependency is satisfied, the propagation will * succeed. FIXME: optimize order. * * FIXME: why is this in vertex, instead of graph? [a: dirty check?] * A: for overloading. leaf extends this class, and has a separate * calculation routine. */ Calculate(graph: GraphCallbacks): void; }