Table of Contents

Class OdfFormulaDependencyGraph

Namespace
OdfKit.Formula
Assembly
OdfKit.dll

Implements a formula cell dependency graph that manages calculation dependencies and dirty-state propagation. 實作公式儲存格相依圖,管理儲存格之間的計算相依性與 Dirty 狀態傳播。

public sealed class OdfFormulaDependencyGraph
Inheritance
OdfFormulaDependencyGraph
Inherited Members

Constructors

OdfFormulaDependencyGraph()

public OdfFormulaDependencyGraph()

Properties

CircularCells

Gets cells detected as having circular references. 取得被偵測到具有循環參照的儲存格。

public IReadOnlyCollection<OdfCellAddress> CircularCells { get; }

Property Value

IReadOnlyCollection<OdfCellAddress>

DirtyCells

Gets all currently dirty cells. 取得所有目前 Dirty 的儲存格。

public IReadOnlyCollection<OdfCellAddress> DirtyCells { get; }

Property Value

IReadOnlyCollection<OdfCellAddress>

Methods

Clear()

Clears all structures in the dependency graph. 清除整個相依圖的所有結構。

public void Clear()

ClearDirty(OdfCellAddress)

Clears the dirty marker for the specified cell. 清除指定儲存格的 Dirty 標記。

public void ClearDirty(OdfCellAddress cell)

Parameters

cell OdfCellAddress

The cell address. / 儲存格位址。

GetTopologicallySortedDirtyCells()

Topologically sorts all currently dirty cells and returns their calculation order. 對所有目前處於 Dirty 狀態的儲存格進行拓撲排序,並傳回其計算順序。

public List<OdfCellAddress> GetTopologicallySortedDirtyCells()

Returns

List<OdfCellAddress>

The sorted cell calculation order. / 已排序的儲存格計算順序清單。

Remarks

When circular dependencies are detected, the related cells are added to CircularCells. 若偵測到循環相依,會將相關儲存格加入 CircularCells

IsDirty(OdfCellAddress)

Determines whether the specified cell is dirty. 判斷指定儲存格是否為 Dirty 狀態。

public bool IsDirty(OdfCellAddress cell)

Parameters

cell OdfCellAddress

The cell address. / 儲存格位址。

Returns

bool

True when the cell is dirty; otherwise, false. / 若儲存格為 Dirty 狀態則為 true,否則為 false。

MarkDirty(OdfCellAddress)

Recursively marks the specified cell and all affected downstream cells as dirty. 將指定儲存格及其所有受影響的下游儲存格遞迴標記為 Dirty。

public void MarkDirty(OdfCellAddress cell)

Parameters

cell OdfCellAddress

The modified or affected cell address. / 被修改或受影響的儲存格位址。

UpdateFormulaDependencies(OdfCellAddress, string, IEvaluationContext)

Adds or updates formula dependencies for a cell. 新增或更新儲存格的公式相依關係。

public void UpdateFormulaDependencies(OdfCellAddress cell, string formula, IEvaluationContext context)

Parameters

cell OdfCellAddress

The cell address. / 儲存格位址。

formula string

The formula string. / 公式字串。

context IEvaluationContext

The evaluation context. / 評估內容。