www.sdmetrics.com

com.sdmetrics.app
Class ModelData

java.lang.Object
  extended by com.sdmetrics.app.ModelData
All Implemented Interfaces:
DataTables

public class ModelData
extends java.lang.Object
implements DataTables

Provides a tabular view of the analyzed model. Used for the "model view" and the model dump feature.

Creates one table per model element type, table rows are model elements, columns present the model element attributes.


Constructor Summary
ModelData(Model model)
           
 
Method Summary
 java.lang.String getColumnDescription(int index, int col)
          Gets the description of an attribute in a column.
 java.lang.String getColumnName(int index, int col)
          Gets the name of the attribute in a column.
 int getNumberOfColumns(int index)
          Returns the number of attributes (columns) in a table.
 int getNumberOfRows(int index)
          Returns the number of model elements (rows) in a table.
 int getNumberOfTables()
          Returns the number of available tables.
 java.util.Collection<java.lang.String> getReferencedIds(int index, int row, int col)
          Gets the set of XMI IDs of model elements referenced by a (multi-valued) cross-reference attribute.
 java.lang.String getRowName(int index, int row)
          Gets the fully qualified name of a model element in a specific 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 index)
          Returns the metamodel type name of the elements of a table.
 java.lang.Object getValueAt(int index, int row, int col)
          Gets the value of an attribute for a specific model element.
 java.lang.String getXMIID(int index, int row)
          Gets the XMI ID of a model element.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ModelData

public ModelData(Model model)
Parameters:
model - The model to display.
Method Detail

getReferencedIds

public java.util.Collection<java.lang.String> getReferencedIds(int index,
                                                               int row,
                                                               int col)
Gets the set of XMI IDs of model elements referenced by a (multi-valued) cross-reference attribute.

Parameters:
index - Index of the table
row - Row index of the model element
col - Column index of the cross reference attribute
Returns:
Collection with the XMI ID(s) of the referenced model elements, empty collection if the attribute does not reference any model elements.

getXMIID

public java.lang.String getXMIID(int index,
                                 int row)
Gets the XMI ID of a model element.

Parameters:
index - Index of the table
row - Row index of the model element
Returns:
XMI ID of the model element

getTypeName

public java.lang.String getTypeName(int index)
Description copied from interface: DataTables
Returns the metamodel type name of the elements of a table.

Specified by:
getTypeName in interface DataTables
Parameters:
index - Index of the table to access.
Returns:
Type name of the model elements of that table.

getNumberOfTables

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

Specified by:
getNumberOfTables in interface DataTables
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: DataTables
Returns the name of a table.

Specified by:
getTableName in interface DataTables
Parameters:
index - Index of the table to access.
Returns:
The name of that table.

getNumberOfRows

public int getNumberOfRows(int index)
Returns the number of model elements (rows) in a table.

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

getNumberOfColumns

public int getNumberOfColumns(int index)
Returns the number of attributes (columns) in a table.

Specified by:
getNumberOfColumns in interface DataTables
Parameters:
index - Index of the table to access.
Returns:
Number of columns of 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)
Gets the value of an attribute for a specific model element.

Specified by:
getValueAt in interface DataTables
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)
Gets the fully qualified name of a model element in a specific row.

Specified by:
getRowName in interface DataTables
Parameters:
index - Index of the table to access.
row - Index of the row to access.
Returns:
The name of the row to be used as row header.

getColumnName

public java.lang.String getColumnName(int index,
                                      int col)
Gets the name of the attribute in a column.

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

getColumnDescription

public java.lang.String getColumnDescription(int index,
                                             int col)
Gets the description of an attribute in a column.

Specified by:
getColumnDescription in interface DataTables
Parameters:
index - Index of the table to access.
col - Index of the column to access.
Returns:
A brief description text for the column.

getTablesDescription

public java.lang.String getTablesDescription()
Description copied from interface: DataTables
Returns a short description of the tables contents. For example, "metric data", "design rule violations", "descriptive statistics", etc.

Specified by:
getTablesDescription in interface DataTables
Returns:
Description of the table contents.

www.sdmetrics.com