Class: Matrix

Matrix

This component is responsible for storing all calculated cells which contain formula expressions (CellValue) and
register for all cell references (CellReference).

CellValue is an object which represents a formula expression. It contains a calculated value of that formula,
an error if applied and cell references. Cell references are CellReference object instances which represent a cell
in a spreadsheet. One CellReference can be assigned to multiple CellValues as a precedent cell. Each cell
modification triggers a search through CellValues that are dependent of the CellReference. After
the match, the cells are marked as 'out of date'. In the next render cycle, all CellValues marked with
that state are recalculated.

Members

cellReferencesArray

List of all created and registered cell references.

dataArray

List of all cell values with theirs precedents.

Record translator for translating visual records into psychical and vice versa.

Methods

add(cellValue)

Add cell value to the collection.

Parameters:
Name Type Description
cellValue CellValue | Object

Cell value object.

getCellAt(row, column){CellValue|null}

Get cell value at given row and column index.

Parameters:
Name Type Description
row Number

Physical row index.

column Number

Physical column index.

Returns: {CellValue|null} Returns CellValue instance or null if cell not found.

getDependencies(cellCoord)

Get cell dependencies using visual coordinates.

Parameters:
Name Type Description
cellCoord Object

Visual cell coordinates object.

getOutOfDateCells(){Array}

Get all out of date cells.

Returns: {Array}

registerCellRef(cellReference)

Register cell reference to the collection.

Parameters:
Name Type Description
cellReference CellReference | Object

Cell reference object.

remove(cellValue)

Remove cell value from the collection.

Parameters:
Name Type Description
cellValue CellValue | Object | Array

Cell value object.

removeCellRefsAtRange(start, end){Array}

Remove cell references from the collection.

Parameters:
Name Type Description
start Object

Start visual coordinate.

end Object

End visual coordinate.

Returns: {Array} Returns removed cell references.

reset()

Reset matrix data.