public class MetricData extends java.lang.Object implements DataTables
The class hides internal metrics, and reduces table output to those element types for which there actually is metric data.
You have the option to pre-calculate all metric values, so that they can be quickly accessed afterwards.
Constructor and Description |
---|
MetricData(MetricsEngine engine)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
java.lang.String |
getColumnDescription(int index,
int col)
Returns a description for the metric at the specified column.
|
java.lang.String |
getColumnName(int index,
int col)
Returns the name of the metric at the specified column.
|
java.lang.Object |
getMetricValue(int index,
int row,
int col)
Returns the metric value for a particular design element and metric in a
table, throwing an exception if the calculation failed.
|
int |
getNumberOfColumns(int index)
Returns the number of metrics for a table.
|
int |
getNumberOfRows(int index)
Returns the number of design elements for a table.
|
int |
getNumberOfTables()
Returns the number of available tables.
|
java.lang.String |
getRowName(int index,
int row)
Returns the name of the design element at the specified row.
|
java.lang.String |
getTableName(int index)
Returns the name of a table.
|
java.lang.String |
getTablesDescription()
Returns a short description of the tables contents.
|
java.lang.String |
getTypeName(int table)
Returns the metamodel type name of the elements of a table.
|
java.lang.Object |
getValueAt(int index,
int row,
int col)
Returns the metric value for a particular design element and metric in a
table.
|
boolean |
precalculateMetrics(MessageHandler msgHandler,
int startPercent,
int finishPercent)
Calculates all externally visible metrics, reports any errors.
|
public MetricData(MetricsEngine engine)
engine
- Metrics engine to provide the metric data.public boolean precalculateMetrics(MessageHandler msgHandler, int startPercent, int finishPercent)
msgHandler
- Handler for progress and error messagesstartPercent
- Initial value of the progress indicatorfinishPercent
- Value of the progress indicator at the completion of
this calculation runtrue
if all metrics were calculated without errors,
else false
.public java.lang.String getTypeName(int table)
DataTables
getTypeName
in interface DataTables
table
- Index of the table to access.public java.lang.Object getMetricValue(int index, int row, int col) throws SDMetricsException
getValueAt()
if you did not pre-calculate
the metrics and still need to detect the presence of errors.index
- Index of the table to access.row
- Index of the design element to access.col
- Index of the metric to access.SDMetricsException
- if an error occurred during calculation of the
metric.public int getNumberOfTables()
DataTables
getNumberOfTables
in interface DataTables
public java.lang.String getTableName(int index)
DataTables
getTableName
in interface DataTables
index
- Index of the table to access.public int getNumberOfRows(int index)
getNumberOfRows
in interface DataTables
index
- Index of the table to access.public int getNumberOfColumns(int index)
getNumberOfColumns
in interface DataTables
index
- Index of the table to access.public java.lang.Object getValueAt(int index, int row, int col)
getMetricValue()
if metric values have been pre-calculated without
errors.getValueAt
in interface DataTables
index
- Index of the table to access.row
- Index of the design element to access.col
- Index of the metric to access.public java.lang.String getRowName(int index, int row)
getRowName
in interface DataTables
index
- Index of the table to access.row
- Index of the row to access.public java.lang.String getColumnName(int index, int col)
getColumnName
in interface DataTables
index
- Index of the table to access.col
- Index of the column to access.public java.lang.String getColumnDescription(int index, int col)
getColumnDescription
in interface DataTables
index
- Index of the table to access.col
- Index of the column to access.public java.lang.String getTablesDescription()
DataTables
getTablesDescription
in interface DataTables