Class Index | File Index

Classes


Class TableNode


Defined in: TableNode.js.

Class Summary
Constructor Attributes Constructor Name and Description
 
TableNode(rowHeader, columnHeader)
A TableNode is a cell in a table which is linked into a row and a column.
Method Summary
Method Attributes Method Name and Description
 
Usually the headers specified in the constructor will be TableNodes in their own right.
 
Iterate over each of the cells linking this node to other columns.
 
forEachRow(func)
Iterate over each of the cells linking this node to other rows.
 
hideFromColumn(hiddenNodes)
Hides this TableNode from the column it's in.
 
hideFromRow(hiddenNodes)
Hides this TableNode from the row it's in.
 
Class Detail
TableNode(rowHeader, columnHeader)
A TableNode is a cell in a table which is linked into a row and a column.

The rows and columns are circularly linked {@see CircularList}, so it's a bit like a table on an doughnut.

Here's an example of a fully linked TableNode:

        col1 →  col2 →  col3 → {wraps to col1}
         ↓       ↓       ↓
row1  →  a   →   b   →   c   → {wraps to row1}
 ↓       ↓       ↓       ↓
row2  →  d   →   e   →   f   → {wraps to row2}
 ↓       ↓       ↓       ↓
{to     {to     {to     {to
 row1}   col1}   col2}   col3}
It's also possible for the table to be sparse, in which case there are no nodes linking rows with columns that have no data.

        col1 →  col2 →  col3 → {wraps to col1}
         ↓       ↓       ↓
row1  →  a   →           c   → {wraps to row1}
 ↓       ↓               ↓
row2  →          e   →         {wraps to row2}
 ↓               ↓       
{to     {to     {to     {to
 row1}   col1}   col2}   col3}
Headers have a property updated when an item is spliced in or hidden or restored, and their toString() is called to determine string represetnation of this node.
Parameters:
rowHeader
{Object} an object with a property actives that gets incremented or decremented as this node is spliced into a row, hidden or restored from a row. Usually a subclass of TableNode.
columnHeader
{Object} an object with a property actives that gets incremented or decremented as this node is spliced into a column, hidden or restored from a column. Usually a subclass of TableNode.
Method Detail
addToHeadersChains()
Usually the headers specified in the constructor will be TableNodes in their own right. If this is the case, you can add a node to the row and columns its headers represent by calling this function.

forEachColumn(func)
Iterate over each of the cells linking this node to other columns.

Perhaps counter intuitively, this involves iterating over the row chain.

Parameters:
func
{function} a function that will be called with each data item linking this node's row with a column.
See:
CircularList#forEach

forEachRow(func)
Iterate over each of the cells linking this node to other rows.

Perhaps counter intuitively, this involves iterating over the column chain.

Parameters:
func
{function} a function that will be called with each data item linking this node's column with a row.
See:
CircularList#forEach

hideFromColumn(hiddenNodes)
Hides this TableNode from the column it's in.
Parameters:
{CircularList[]} hiddenNodes
an array into which the column node will be added. May not be null.

hideFromRow(hiddenNodes)
Hides this TableNode from the row it's in.
Parameters:
{CircularList[]} hiddenNodes
an array into which the row node will be added. May not be null.

toString()

Documentation generated by JsDoc Toolkit 2.4.0 on Tue Jun 27 2017 18:52:30 GMT+0000 (UTC)