www.sdmetrics.com

sdmetrics.app
Class RelMatrixAdapter

java.lang.Object
  |
  +--sdmetrics.app.RelMatrixAdapter
All Implemented Interfaces:
DataTable

public class RelMatrixAdapter
extends java.lang.Object
implements DataTable

This class is an adapter to start the calculation of a set of relation matrices and present them via the DataTable interface. The adapter hides empty relation matrices.

Use this class as follows:

Upon successful calculation, there will be one table for each relation matrix. Rows are the source design elements from which the relationship originates, columns are the target design elements of the relationship.


Constructor Summary
RelMatrixAdapter(sdmetrics.metrics.RelationMatrix rm)
           
 
Method Summary
 boolean calculateMatrices(int progStart, int totalProg)
          Start the calculation of the relation matrices.
 java.lang.String getColumnDescription(int index, int col)
          Returns an empty string (descriptions of target design elements in the columns not supported).
 java.lang.String getColumnName(int index, int col)
          Get the fully qualified name for a target element in specific column.
 java.lang.String getMatrixDescription(int index)
          Get a description string for a matrix.
 int getNumberOfColumns(int index)
          Get the number of target design elements (columns) in a table.
 int getNumberOfRows(int index)
          Get the number of source design elements (rows) in a table.
 int getNumberOfTables()
          Returns the number of available tables.
 java.lang.String getRowName(int index, int row)
          Get the fully qualified name for a source element in specific row.
 java.lang.String getTableName(int index)
          Returns the names of a relation matrix.
 int getTypeID(int index)
          This method is not meaningful for relation matrices.
 java.lang.Object getValueAt(int index, int row, int col)
          Get the number of relationships from a specific source element to a target element.
 boolean hasMatrices()
          Check if there are relation matrices defined in the metric definition file at all.
 boolean needsCalculation()
          Check if matrices still need to be calculated.
 void setMessageHandler(SDMessageHandler mh)
          Register message handler for progress report.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RelMatrixAdapter

public RelMatrixAdapter(sdmetrics.metrics.RelationMatrix rm)
Parameters:
rm - A RelationMatrix object to perform the actual calculation and storage of the relation matrices.
Method Detail

setMessageHandler

public void setMessageHandler(SDMessageHandler mh)
Register message handler for progress report.

Parameters:
mh - The message handler.

needsCalculation

public boolean needsCalculation()
Check if matrices still need to be calculated.

Returns:
true if matrices still need to be calculated, else false

calculateMatrices

public boolean calculateMatrices(int progStart,
                                 int totalProg)
Start the calculation of the relation matrices.

Parameters:
progStart - The percentage of work completed on the progress bar at the beginning of this job.
totalProg - The total percentage alloted to this job.
Returns:
true if the matrices were calculated successfully, false if an error occurred.

getMatrixDescription

public java.lang.String getMatrixDescription(int index)
Get a description string for a matrix.

Parameters:
index - Index of the matrix.
Returns:
Short description of the matrix.

hasMatrices

public boolean hasMatrices()
Check if there are relation matrices defined in the metric definition file at all.

Returns:
true if the metric definition file defines any relation matrices, else false.

getNumberOfTables

public int getNumberOfTables()
Description copied from interface: DataTable
Returns the number of available tables.

Specified by:
getNumberOfTables in interface DataTable
Returns:
The number of tables, n. Valid table indices run from 0 to n-1.

getTableName

public java.lang.String getTableName(int index)
Returns the names of a relation matrix.

Specified by:
getTableName in interface DataTable
Parameters:
index - Index of the table to access.
Returns:
String with the name of the table.

getNumberOfRows

public int getNumberOfRows(int index)
Get the number of source design elements (rows) in a table.

Specified by:
getNumberOfRows in interface DataTable
Parameters:
index - Index of the table to access.
Returns:
The number of rows in the table, r. Valid row indices for the table run from 0 to r-1.

getNumberOfColumns

public int getNumberOfColumns(int index)
Get the number of target design elements (columns) in a table.

Specified by:
getNumberOfColumns in interface DataTable
Parameters:
index - Index of the table to access.
Returns:
Number of columns in the table, c. Valid column indices for the table run from 0 to c-1.

getValueAt

public java.lang.Object getValueAt(int index,
                                   int row,
                                   int col)
Get the number of relationships from a specific source element to a target element.

Specified by:
getValueAt in interface DataTable
Parameters:
index - Index of the table to access.
row - Index of the row to access.
col - Index of the column to access.
Returns:
Table cell value at the specified coordinates.

getRowName

public java.lang.String getRowName(int index,
                                   int row)
Get the fully qualified name for a source element in specific row.

Specified by:
getRowName in interface DataTable
Parameters:
index - Index of the table to access.
row - Index of the row.
Returns:
The name of the row.

getColumnName

public java.lang.String getColumnName(int index,
                                      int col)
Get the fully qualified name for a target element in specific column.

Specified by:
getColumnName in interface DataTable
Parameters:
index - Index of the table to access.
col - Index of the column.
Returns:
The name of the column to be used as column header.

getColumnDescription

public java.lang.String getColumnDescription(int index,
                                             int col)
Returns an empty string (descriptions of target design elements in the columns not supported).

Specified by:
getColumnDescription in interface DataTable
Parameters:
index - Index of the table to access.
col - Index of the column.
Returns:
Empty string.

getTypeID

public int getTypeID(int index)
This method is not meaningful for relation matrices.

Specified by:
getTypeID in interface DataTable
Parameters:
index - Index of the table to access.
Returns:
-1

www.sdmetrics.com