www.sdmetrics.com

com.sdmetrics.app
Class RuleData

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

public class RuleData
extends java.lang.Object
implements DataTables

Checks the design rules for a model and provides a tabular view of the design rule violations.

The class creates one table for each element type for which there are elements with rule violations. Each row of the table reports the violation of one design rule by one model element. Each table has five columns describing various properties of the rule violation:


Constructor Summary
RuleData(RuleEngine engine)
           
 
Method Summary
 java.lang.String checkFilterIdentifiers()
          Checks the application areas of the rule filter for plausibility.
 boolean checkRules(MessageHandler msgHandler, int startPercent, int finishPercent)
          Checks all design rules, reports any errors.
 java.lang.String getColumnDescription(int index, int col)
          Returns a short description of a column.
 java.lang.String getColumnName(int index, int col)
          Returns the name of the object a column represents (column header).
 int getNumberOfColumns(int index)
          Returns the number of columns of a table.
 int getNumberOfRows(int index)
          Gets the number of design rule violations for a table.
 int getNumberOfTables()
          Returns the number of available tables.
 java.lang.String getRowName(int index, int row)
          Gets the fully qualified name of the violating 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 detailed information about a rule violation in the specified column.
 boolean setRuleFilter(MessageHandler msgHandler, java.lang.String filter)
          Sets the rule filter that specifies the rules to apply.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RuleData

public RuleData(RuleEngine engine)
Parameters:
engine - The rule engine to do the actual work.
Method Detail

setRuleFilter

public boolean setRuleFilter(MessageHandler msgHandler,
                             java.lang.String filter)
Sets the rule filter that specifies the rules to apply. Parsers the rule filter string, reporting any errors if the filter string is syntactically incorrect.

Parameters:
msgHandler - Handler for error messages
filter - The rule filter string.
Returns:
true if the filter was correctly installed, false if an error occurred. The error will be reported to the message handler.

checkFilterIdentifiers

public java.lang.String checkFilterIdentifiers()
Checks the application areas of the rule filter for plausibility. Application areas specified in the current rule filter are suspect if they are not defined explicitly by at least one design rule (maybe the user misspelled the application area). The filter can be used regardless, but you may want to warn the users about it, because the result may not be what they expect.

Returns:
Empty string if all application areas are defined explicitly, or the name of an application area in the rule filter that is not defined explicitly by any of the rules.

checkRules

public boolean checkRules(MessageHandler msgHandler,
                          int startPercent,
                          int finishPercent)
Checks all design rules, reports any errors.

Parameters:
msgHandler - Handler for progress and error messages
startPercent - Initial value of the progress indicator
finishPercent - Value of the progress indicator at the completion of this calculation run
Returns:
true if all rule were checked without any errors, false if an error occurred.

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.

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.

getNumberOfRows

public int getNumberOfRows(int index)
Gets the number of design rule violations for 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)
Description copied from interface: DataTables
Returns the number of columns of a table. Note: This does NOT include the column with the row headers (names).

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 detailed information about a rule violation in the specified column.

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 the violating 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)
Description copied from interface: DataTables
Returns the name of the object a column represents (column header).

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)
Description copied from interface: DataTables
Returns a short description of a column. The description is a short string (one-liner), providing a brief, informal description of the column, and can be used, e.g., as a tool tip for the column headers when displaying the table on screen.

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