com.veromodo.tempo.filters.rules
Interface SemanticRule

All Known Implementing Classes:
AndRule, BasicRule, CounterRule, DoNotCallRule, DoNotDereferenceArrayRule, DoNotDereferenceFieldRule, DoNotUseIdRule, IdCounter, InsideAutomatonRule, IsConstantRule, NotRule, OrRule

public interface SemanticRule

a semantic rule for ASTNode that associates a boolean predicate to a specific type of node in the abstract syntax tree. The idea is to check whether the boolean predicate is true for the sub-tree rooted at n whenever the node n is of the expected type. Semantics rule(n,X,P(n)) : Node -> Boolean defined as class(n) == X => P(n)


Method Summary
 boolean eval(ASTNode n)
          evaluates the ASTNode n.
 java.lang.Class getNodeClass()
          provides the class of the root node which the semantic Rule is defined for.
 boolean IgnoreSubtree()
          boolean value if the subtree should be ignored.
 

Method Detail

getNodeClass

java.lang.Class getNodeClass()
provides the class of the root node which the semantic Rule is defined for. This is used to filter when a check is executed, so that it is not performed on every node.

Returns:
the class this check is defined on

IgnoreSubtree

boolean IgnoreSubtree()
boolean value if the subtree should be ignored. This is used to to deside if the subtree should have the current set of rules applied to it.

Returns:
true if subtree is irrelivant

eval

boolean eval(ASTNode n)
evaluates the ASTNode n. Returns true if the node matches the critera, false otherwise. Reports errors as necessary

Parameters:
n - an object to be checked.
Returns:
true if the object matches.