org.drools.semantics.groovy
Class GroovyCondition

java.lang.Object
  extended byorg.drools.semantics.groovy.GroovyInterp
      extended byorg.drools.semantics.groovy.GroovyCondition
All Implemented Interfaces:
Condition, SemanticComponent, java.io.Serializable

public class GroovyCondition
extends GroovyInterp
implements Condition

Groovy expression semantics Condition.

See Also:
Serialized Form
 

Constructor Summary
GroovyCondition(java.lang.String text, Rule rule)
          Construct.
 
Method Summary
 java.util.Iterator declarationIterator()
          GroovyInterp needs a declaration iterator.
 boolean equals(java.lang.Object object)
           
protected  java.lang.Object evaluate(groovy.lang.Binding locals)
          Evaluate.
 java.lang.Object evaluate(Tuple tuple)
          Evaluate.
 Declaration[] getRequiredTupleMembers()
          Retrieve the array of Declaration s required by this condition to perform its duties.
 int hashCode()
           
 boolean isAllowed(Tuple tuple)
          Determine if the supplied Tuple is allowed by this condition.
 
Methods inherited from class org.drools.semantics.groovy.GroovyInterp
getCode, getRule, getText, setUpDictionary
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GroovyCondition

public GroovyCondition(java.lang.String text,
                       Rule rule)
                throws java.lang.Exception
Construct.

Method Detail

evaluate

public java.lang.Object evaluate(Tuple tuple)
Evaluate.

Parameters:
tuple - Tuple containing variable bindings.
Returns:
The result of evaluation.

evaluate

protected java.lang.Object evaluate(groovy.lang.Binding locals)
Evaluate.

Parameters:
locals - The evaluation dictionary.
Returns:
The result of evaluation.

getRequiredTupleMembers

public Declaration[] getRequiredTupleMembers()
Retrieve the array of Declaration s required by this condition to perform its duties.

Specified by:
getRequiredTupleMembers in interface Condition
Returns:
The array of Declarations expected on incoming Tuples.

isAllowed

public boolean isAllowed(Tuple tuple)
                  throws ConditionException
Determine if the supplied Tuple is allowed by this condition.

Specified by:
isAllowed in interface Condition
Throws:
ConditionException - if an error occurs during filtering.
Parameters:
tuple - The Tuple to test.
Returns:
true if the Tuple passes this condition, else false.

hashCode

public int hashCode()

equals

public boolean equals(java.lang.Object object)

declarationIterator

public java.util.Iterator declarationIterator()
GroovyInterp needs a declaration iterator. BlockConsequence uses the Iterator from Set. So we emulate Iterator here so GroovyInterp can be used for both.

Returns: