Table of Contents

Class NoxCellMap<T>

Namespace
Nox.Grid
Assembly
Nox.Grid.dll

Per-cell data store (only cells with data are kept). Columns are identified by a fixed per-column key, not by position, so data follows columns when they are reordered, and moves with rows when rows are inserted, deleted, or sorted.

public class NoxCellMap<T>

Type Parameters

T
Inheritance
NoxCellMap<T>
Derived
Inherited Members

Remarks

Cells are kept per row in a row list, so inserting or deleting rows only moves row slots (not every stored cell), and appending past the last stored row costs nothing. Adding rows one by one stays linear in the row count.

Properties

Count

Number of cells that have an entry.

public int Count { get; }

Property Value

int

Items

All entries (row, column key, value), in row order.

public IEnumerable<KeyValuePair<long, T>> Items { get; }

Property Value

IEnumerable<KeyValuePair<long, T>>

Methods

Clear()

Removes every entry.

public void Clear()

ColumnOf(long)

Column part of an internal cell key.

public static int ColumnOf(long key)

Parameters

key long

Returns

int

Get(int, int)

Entry for the cell, or the default value if none.

public T Get(int row, int columnKey)

Parameters

row int
columnKey int

Returns

T

InsertRows(int, int)

Inserts count empty rows at index (following rows shift down).

public void InsertRows(int index, int count)

Parameters

index int
count int

OnChanged()

Occurs when the stored data changes (the value store marks formulas for recalculation).

protected virtual void OnChanged()

PermuteRows(int[])

Reorders rows. newOrder[new position] = old position (sort result).

public void PermuteRows(int[] newOrder)

Parameters

newOrder int[]

Remove(int, int)

Removes the entry for a cell. Returns False if there was none.

public bool Remove(int row, int columnKey)

Parameters

row int
columnKey int

Returns

bool

RemoveColumn(int)

Clears all data in a column.

public void RemoveColumn(int columnKey)

Parameters

columnKey int

RemoveRows(int, int)

Deletes count rows starting at index (following rows shift up).

public void RemoveRows(int index, int count)

Parameters

index int
count int

RowOf(long)

Row part of an internal cell key.

public static int RowOf(long key)

Parameters

key long

Returns

int

Set(int, int, T)

Sets the entry for a cell.

public void Set(int row, int columnKey, T value)

Parameters

row int
columnKey int
value T

TruncateRows(int)

Clears data in rows at or beyond rowCount.

public void TruncateRows(int rowCount)

Parameters

rowCount int

TryGet(int, int, out T)

Gets the entry for a cell. Returns False if the cell has none.

public bool TryGet(int row, int columnKey, out T value)

Parameters

row int
columnKey int
value T

Returns

bool