www.sdmetrics.com

sdmetrics.app
Class RuleCheckAdapter

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

public class RuleCheckAdapter
extends java.lang.Object
implements DataTable

Class to start the rule checking and provide a tabular view of the design rule violations. Use this class as follows:

If the design rule checking was successful, there will be one table for each model element type with elements that violate rules. 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 violated rules:


Constructor Summary
RuleCheckAdapter(sdmetrics.metrics.RuleChecker rc)
           
 
Method Summary
 java.lang.String checkFilterIdentifiers()
          Check if there is an application area specified in the current rule filter that is not defined explicitely by at least one rule.
 boolean checkRules(int progStart, int totalProg)
          Start the rule checking.
 RuleCheckAdapter createNewRuleCheckAdapter()
          Create a new rule check adapter based on the same metrics engine.
 java.lang.String getColumnDescription(int index, int col)
          Get a description of a specific property of a violated rule.
 java.lang.String getColumnName(int index, int col)
          Get the name of a property for a specific design rule violation.
 int getNumberOfColumns(int index)
          The number of columns (5: name, value, category, severity, and description of the violated rule).
 int getNumberOfRows(int index)
          Get 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)
          Get 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.
 int getTypeID(int index)
          Return the metamodel type ID of the elements of a table.
 java.lang.Object getValueAt(int index, int row, int col)
          Get the value of a specific property of a violated rule.
 boolean needsChecking()
          Test if design rule checking is needed.
 void setMessageHandler(SDMessageHandler mh)
          Register message handler for progress report.
 boolean setRuleFilter(java.lang.String s)
          Set the rule filter string 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

RuleCheckAdapter

public RuleCheckAdapter(sdmetrics.metrics.RuleChecker rc)
Parameters:
rc - The object to perform the actual rule checking.
Method Detail

setMessageHandler

public void setMessageHandler(SDMessageHandler mh)
Register message handler for progress report.

Parameters:
mh - The message handler.

createNewRuleCheckAdapter

public RuleCheckAdapter createNewRuleCheckAdapter()
Create a new rule check adapter based on the same metrics engine.

Returns:
A new rule check adapter instance for the same metrics engine as this instance.

checkRules

public boolean checkRules(int progStart,
                          int totalProg)
Start the rule checking.

Parameters:
progStart - The percentage of work completed on the progress bar at the beginning of this job.
totalProg - The total percentage alloted to this job.
Returns:
true if the rule checking went without errors, false if an error occurred.

needsChecking

public boolean needsChecking()
Test if design rule checking is needed.

Returns:
true if design rules still need to be checked, else false.

setRuleFilter

public boolean setRuleFilter(java.lang.String s)
Set the rule filter string that specifies the rules to apply.

Parameters:
s - String with the filter expression.
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()
Check if there is an application area specified in the current rule filter that is not defined explicitely by at least one rule. This may be due to a typo by the user. The filter can be used regardless, but you may want to warn the user about it, because the result will not be what was expected.

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

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.

getTypeID

public int getTypeID(int index)
Description copied from interface: DataTable
Return the metamodel type ID of the elements of a table.

Specified by:
getTypeID in interface DataTable
Parameters:
index - Index of the table to access.
Returns:
Type ID of the model elements of that table.

getNumberOfRows

public int getNumberOfRows(int index)
Get the number of design rule violations 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)
The number of columns (5: name, value, category, severity, and description of the violated rule).

Specified by:
getNumberOfColumns in interface DataTable
Parameters:
index - Index of the table to access.
Returns:
5

getValueAt

public java.lang.Object getValueAt(int index,
                                   int row,
                                   int col)
Get the value of a specific property of a violated rule.

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 the violating 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 a property for a specific design rule violation.

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 a description of a specific property of a violated rule.

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