org.drools.semantics.python
Class PythonCondition

java.lang.Object
  extended by org.drools.semantics.python.PythonInterp
      extended by org.drools.semantics.python.PythonCondition
All Implemented Interfaces:
java.io.Serializable, Condition, SemanticComponent

public class PythonCondition
extends PythonInterp
implements Condition

Python expression semantics Condition.

See Also:
Serialized Form
 

Constructor Summary
PythonCondition(java.lang.String text, Rule rule)
          Construct.
 
Method Summary
 java.util.Iterator declarationIterator()
          PythonInterp needs a declaration iterator.
 boolean equals(java.lang.Object object)
           
 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.python.PythonInterp
getCode, getGlobals, getGlobals, getNode, getRule, getText, setUpDictionary, stripOuterIndention
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PythonCondition

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

Throws:
java.lang.Exception
Method Detail

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.

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.

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(java.lang.Object object)
Overrides:
equals in class java.lang.Object

declarationIterator

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

Returns: