Class ClusterTable
Reads the data (held in the page as hidden elements of an HTML form) into a table.
The 'table' is
actually three tables: an array of clusterRows, an array of datRows, and an array
of nodeRows.
The constructor calls the getData() method to fill the arrays. It also
calls assignIdNos() method.
ClusterTree is generated from the ClusterTable and once this has been done
the job of the ClusterTable is complete and it is not referred to again.
Methods
void
assignIdNos
(
)
Loops through the rows assigning an ID to the clusters
the first is lastLeaf number +1 the next is lastLeaf+2 and so on
clusterRow object
getCurrentRow
(
)
Returns the row indexed by the current pointer value
- Returns:
clusterRow object
string
getData
(
)
Fills the table with data.
Gathers data from the hidden form elements and insert in the table
1) Creates an associative array of all the input elements in the page
2) Dat file data: loop through the array picking out the fields for each Dat row
(manifest file)
3) Node file data: as above but for the main cluster data
4) Leaf file data: as above but for the leaf data
Encompasses object constructor functions for clusterRow, datRow and leafRow
objects.
- Returns:
string
- the filename of the originating Dat file.
number
getHtByIdNo
(
idNoIn
)
Loops through the rows for the given IdNo and returns
the mergeHt for that row with that given IdNo
- Parameters:
-
idNoIn
<integer>
- Returns:
number
- the itemB for that row
number
getItemAByIdNo
(
idNoIn
)
Loops through the rows for the given IdNo and returns the itemA for that row
- Parameters:
-
idNoIn
<integer>
- Returns:
number
- the itemA for that row
number
getItemBByIdNo
(
idNoIn
)
Loops through the rows for the given IdNo and returns the itemB for that row
- Parameters:
-
idNoIn
<integer>
- Returns:
number
- the itemB for that row
clusterRow object
getLast
(
)
Returns the last row in the table
- Returns:
clusterRow object
clusterRow object
getNextRow
(
)
Increments the pointer then returns the newly pointed to row.
Should only be called after checking with .nextRowExists
- Returns:
clusterRow object
number
getNoOfLeaves
(
idNoIn
)
Returns the number of rows in the cArray table
- Parameters:
-
idNoIn
<integer>
- Returns:
number
- the itemB for that row
integer
getPtr
(
)
Returns the current pointer value
clusterRow object
getRowByIndex
(
indexIn
)
Returns a row from the cArray by index
- Parameters:
-
indexIn
<number>
- Returns:
clusterRow object
integer
getRowIndexByIdNo
(
idNoIn
)
Loops through the rows for the given IdNo and returns the array index for that row
- Parameters:
-
idNoIn
<integer>
- Returns:
integer
- the array index for that row
boolean
isLeafByIdNo
(
idNoIn
)
Detects whether a cluster IdNo represents a leaf.
It will be a leaf if the idNo <= the number of leaves
- Parameters:
-
idNoIn
<integer>
- Returns:
boolean
boolean
nextRowExists
(
)
Detects whether or not there is another row beyond that pointed to by the pointer