public class RuleEngine
extends java.lang.Object
| Constructor and Description |
|---|
RuleEngine(MetricsEngine me)
Creates a new rule engine.
|
| Modifier and Type | Method and Description |
|---|---|
java.util.List<RuleViolation> |
checkRule(ModelElement element,
Rule rule)
Checks a design rule for a model element.
|
void |
clearValuesCache()
Clears the value cache for rule procedures.
|
java.util.Collection<java.lang.String> |
collectExemptedRules(ModelElement element)
Gets the names of the rules that a model element is allowed to violate.
|
MetricsEngine |
getMetricsEngine()
Returns the metrics engine that this rule engine uses.
|
public RuleEngine(MetricsEngine me)
me - Metrics engine to use for rule checking.public MetricsEngine getMetricsEngine()
public java.util.Collection<java.lang.String> collectExemptedRules(ModelElement element) throws SDMetricsException
element - Element to retrieve rule exemptions for.SDMetricsException - The tagged values or comments could not be
accessed.public java.util.List<RuleViolation> checkRule(ModelElement element, Rule rule) throws SDMetricsException
element - The model element to check.rule - The rule to check.SDMetricsException - An error occurred checking the design rule.public void clearValuesCache()
The cache can be cleared any time. When you perform a comprehensive rule check (checking all rules for all model elements), a good strategy is to check all elements of one type, and clear the cache before proceeding with the next type.