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, SemanticComponent, Condition, RuleComponent

public class PythonCondition
extends PythonInterp
implements Condition, SemanticComponent

Python expression semantics Condition.

See Also:
Serialized Form

Field Summary
protected  java.lang.String name
           
protected  java.lang.String semanticType
           
 
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)
           
 java.lang.String getName()
          Returns the name of the component
 Declaration[] getRequiredTupleMembers()
          Retrieve the array of Declaration s required by this condition to perform its duties.
 java.lang.String getSemanticType()
           
 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
 

Field Detail

semanticType

protected final java.lang.String semanticType
See Also:
Constant Field Values

name

protected final java.lang.String name
Constructor Detail

PythonCondition

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

Throws:
java.lang.Exception
Method Detail

getSemanticType

public java.lang.String getSemanticType()
Specified by:
getSemanticType in interface SemanticComponent

getName

public java.lang.String getName()
Description copied from interface: SemanticComponent
Returns the name of the component

Specified by:
getName in interface SemanticComponent

isAllowed

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

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

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: