com.veromodo.tempo.filters.rules
Class OrPredicate<T>

java.lang.Object
  extended by com.veromodo.tempo.filters.rules.OrPredicate<T>
Type Parameters:
T - the type of objects which the internal predicates are to work on
All Implemented Interfaces:
SemanticPredicate<T>

public class OrPredicate<T>
extends java.lang.Object
implements SemanticPredicate<T>

Defines an OR of semantic predicates on a single ASTNode

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

It is crusial that all SemanticPredicates are defined for the Class c c is the runtime mechanism used to decide of the SemanticPredicate is evaluated. If a SemanticPredicate is not defined for Class c a class cast error will be thrown in the eval method.

See Also:
BasicRule

Constructor Summary
OrPredicate()
           
 
Method Summary
 void add(SemanticPredicate<T> pred)
           
 void addAll(java.util.Collection<SemanticPredicate<T>> preds)
           
 boolean eval(T n)
          evaluates the object n.
 void reportError()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OrPredicate

public OrPredicate()
Method Detail

add

public void add(SemanticPredicate<T> pred)

addAll

public void addAll(java.util.Collection<SemanticPredicate<T>> preds)

eval

public boolean eval(T n)
Description copied from interface: SemanticPredicate
evaluates the object n. Returns true if the object matches the critera, false otherwise. Reports errors if nessisary.

Specified by:
eval in interface SemanticPredicate<T>
Parameters:
n - an object to be checked.
Returns:
true if the object matches.

reportError

public void reportError()