public abstract class RuleProcedure extends AbstractProcedure
Constructor and Description |
---|
RuleProcedure() |
Modifier and Type | Method and Description |
---|---|
abstract void |
checkRule(ModelElement element,
Rule rule)
Checks the rule for a model element.
|
protected int |
getMinExpressionValue(ModelElement element,
ProcedureAttributes attributes,
java.lang.String attrName,
Variables vars)
Evaluates the "minnodes" or "mincnt" expression of a rule.
|
protected RuleEngine |
getRuleEngine()
Gets the rule engine for this rule procedure.
|
protected java.lang.Object |
getRuleValue(ModelElement element,
ProcedureAttributes attributes,
Variables vars)
Evaluates the "value" expression of a rule.
|
protected java.util.Map<java.lang.Object,java.lang.Object> |
getValuesCache()
Gets the cache to store data for reuse for subsequent checks of other
model elements.
|
protected void |
reportViolation(ModelElement element,
Rule rule,
java.lang.Object value)
Reports a rule violation.
|
evalBooleanExpression, evalElementSetExpression, evalExpression, evalSetExpression, getFilterAttributeProcessor, getMetaModel, getMetricsEngine, getModel, getRelationOrSet, isCompatible
public abstract void checkRule(ModelElement element, Rule rule) throws SDMetricsException
element
- The element to check.rule
- The rule to check.SDMetricsException
- Problem while checking the ruleprotected RuleEngine getRuleEngine()
protected void reportViolation(ModelElement element, Rule rule, java.lang.Object value)
element
- The violating element.rule
- The violated rule.value
- The value of the rule violation.protected java.util.Map<java.lang.Object,java.lang.Object> getValuesCache()
protected java.lang.Object getRuleValue(ModelElement element, ProcedureAttributes attributes, Variables vars) throws SDMetricsException
element
- Model element for which the rule is evaluatedattributes
- Attributes of the calculation procedure definition of
the rule.vars
- Variables for the evaluation of the expressionnull
if none was specified.SDMetricsException
- An error occurred evaluating the "value"
expression.protected int getMinExpressionValue(ModelElement element, ProcedureAttributes attributes, java.lang.String attrName, Variables vars) throws SDMetricsException
element
- Model element for which the rule is evaluatedattributes
- Attributes of the calculation procedure definition of
the rule.attrName
- Name of the attribute ("minnodes" or "mincnt").vars
- Variables for the evaluation of the expressionSDMetricsException
- An error occurred evaluating the expression.