www.sdmetrics.com

sdmetrics.app
Class ElementPoolAdapter

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

public class ElementPoolAdapter
extends java.lang.Object
implements DataTable

Provide a tabular view of the analyzed UML design. There is one table per model element type, table rows are model elements, and columns are the modelelement attributes. Optionally filters model element types that are not represented in the model.

This class is used to implement the "dump model" feature that writes the the UML model to an external file.


Constructor Summary
ElementPoolAdapter(ElementPool pool, boolean skipEmptyTables)
           
 
Method Summary
 java.lang.String getColumnDescription(int index, int col)
          Get the description of the an attribute.
 java.lang.String getColumnName(int index, int col)
          Get the name of the attribute in a column.
 int getNumberOfColumns(int index)
          Return the number of attributes (columns) in a table.
 int getNumberOfRows(int index)
          Return the number of model elements (rows) in a table.
 int getNumberOfTables()
          Returns the number of available tables.
 java.util.Collection getReferencedIds(int index, int row, int col)
          Get the set of model element IDs referenced by a (multivalued) crossreference attribute.
 java.lang.String getRowName(int index, int row)
          Get the fully qualified name of a model element in a specific row.
 java.lang.String getTableName(int index)
          Returns the name of a table.
 int getTypeID(int index)
          Get the metamodel element type for a table.
 java.lang.Object getValueAt(int index, int row, int col)
          Get the value of an attribute for a specific model element.
 java.lang.String getXMIID(int index, int row)
          Get 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

ElementPoolAdapter

public ElementPoolAdapter(ElementPool pool,
                          boolean skipEmptyTables)
Parameters:
pool - Element pool to display.
skipEmptyTables - If set to true, no tables are created for model element types that are not represented in the model are now shown. If set to false, a table is created for every model element type.
Method Detail

getReferencedIds

public java.util.Collection getReferencedIds(int index,
                                             int row,
                                             int col)
Get the set of model element IDs referenced by a (multivalued) crossreference 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, or null if the attribut does not reference any model elements.

getXMIID

public java.lang.String getXMIID(int index,
                                 int row)
Get 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

getTypeID

public int getTypeID(int index)
Get the metamodel element type for a table.

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

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 model 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)
Return the number of attributes (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 value of an attribute for a specific model 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 of a model element in a 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 name of the attribute in a 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)
Get the description of the an attribute.

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