www.sdmetrics.com

sdmetrics.app
Class TableView

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

public class TableView
extends java.lang.Object
implements DataTable

Class to provide a tabular view of the design measurement data. This class provides access to the metric data stored in the ElementPool through the DataTable interface. There is one table for each metamodel element type, rows of the tables are the design elements, columns are the metrics.

The class filters sets and internal metrics from the view, and reduces table output to those element types for which there actually is metric data.


Constructor Summary
TableView(sdmetrics.metrics.MetricsEngine me)
          Create a new TableView from the data provided by the Metrics engine.
 
Method Summary
 java.lang.String getColumnDescription(int index, int col)
          Return a description for the metric at the specified column.
 java.lang.String getColumnName(int index, int col)
          Return the name of the metric at the specified column.
 java.lang.Object getMetricValue(int index, int row, int col)
          Return the metric value for a particular design element and metric in a table, throwing an exception if the calculation failed.
 int getNumberOfColumns(int index)
          Return the number of metrics for a table.
 int getNumberOfRows(int index)
          Return the number of design elements for a table.
 int getNumberOfTables()
          Returns the number of available tables.
 java.lang.String getRowName(int index, int row)
          Return the name of the design element at the specified row.
 java.lang.String getTableName(int index)
          Returns the name of a table.
 int getTypeID(int table)
          Return the metamodel type id for a table.
 java.lang.Object getValueAt(int index, int row, int col)
          Return the metric value for a particular design element and metric in a table.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TableView

public TableView(sdmetrics.metrics.MetricsEngine me)
Create a new TableView from the data provided by the Metrics engine.

Parameters:
me - MetricsEngine to provide the metric data.
Method Detail

getTypeID

public int getTypeID(int table)
Return the metamodel type id for a table.

Specified by:
getTypeID in interface DataTable
Parameters:
table - Index of the table.
Returns:
Metamodel element type ID for the specified table.

getMetricValue

public java.lang.Object getMetricValue(int index,
                                       int row,
                                       int col)
                                throws sdmetrics.metrics.SDMetricsException
Return the metric value for a particular design element and metric in a table, throwing an exception if the calculation failed. Use this method instead of getValueAt() if you need to detect the presence of errors.

Parameters:
index - Index of the table to access.
row - Index of the design element to access.
col - Index of the metric to access.
Returns:
Metric value at the specified coordinates.
Throws:
sdmetrics.metrics.SDMetricsException - if an error occured during calculation of the metric.

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)
Description copied from interface: DataTable
Returns the name of a table.

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)
Return the number of design elements for 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)
Return the number of metrics for 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)
Return the metric value for a particular design element and metric in a table. Use this method instead of getMetricValue() if you do not need to detect the presence of errors.

Specified by:
getValueAt in interface DataTable
Parameters:
index - Index of the table to access.
row - Index of the design element to access.
col - Index of the metric to access.
Returns:
Metric value at the specified coordinates, or empty string if metric calculation failed.

getRowName

public java.lang.String getRowName(int index,
                                   int row)
Return the name of the design element at the specified 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)
Return the name of the metric at the specified 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)
Return a description for the metric at the specified column.

Specified by:
getColumnDescription in interface DataTable
Parameters:
index - Index of the table to access.
col - Index of the column.
Returns:
String with an informal description of the column.

www.sdmetrics.com