com.veromodo.tempo.filters.rules
Class NotRule

java.lang.Object
  extended by com.veromodo.tempo.filters.rules.NotRule
All Implemented Interfaces:
SemanticRule

public class NotRule
extends java.lang.Object
implements SemanticRule

Defines a NOT of a semantic rule

Semantics rule(n,X,P(n)) : Node -> Boolean defined as class(n) == X => P(n)

See Also:
BasicRule

Constructor Summary
NotRule(ErrorLog log, java.lang.Class c, SemanticRule pred)
           
NotRule(ErrorLog log, MessageSource s, java.lang.Class c, java.lang.String msg, SemanticRule pred)
           
 
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.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NotRule

public NotRule(ErrorLog log,
               java.lang.Class c,
               SemanticRule pred)
Parameters:
log - a log to report errors to.
c - the class which the predicate is defined on.
pred - to be evaluated.

NotRule

public NotRule(ErrorLog log,
               MessageSource s,
               java.lang.Class c,
               java.lang.String msg,
               SemanticRule pred)
Parameters:
log - a log to report errors to.
s - the source of the error message.
c - the class which the conjunction's predicates are defined on.
msg - a message produced if the predicate is not satisified.
Method Detail

getNodeClass

public java.lang.Class getNodeClass()
Description copied from interface: SemanticRule
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.

Specified by:
getNodeClass in interface SemanticRule
Returns:
the class which this is defined on.

IgnoreSubtree

public boolean IgnoreSubtree()
Description copied from interface: SemanticRule
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.

Specified by:
IgnoreSubtree in interface SemanticRule
Returns:
true if the subtree should be ignored

eval

public boolean eval(ASTNode n)
evaluates the ASTNode n. Returns true if the ASTNode matches the critera of all predicates, false otherwise. Reports errors if nessisary.

Specified by:
eval in interface SemanticRule
Parameters:
n - an ASTNode to be checked.
Returns:
true if the ASTNode matches all predicates.