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:
Serializable, Condition, SemanticComponent

public class PythonCondition
extends PythonInterp
implements Condition

Python expression semantics Condition.

Author:
bob mcwhirter
See Also:
Serialized Form

Constructor Summary
PythonCondition(String text, Rule rule)
          Construct.
 
Method Summary
 Iterator declarationIterator()
          PythonInterp needs a declaration iterator.
 boolean equals(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(String text,
                       Rule rule)
                throws Exception
Construct.

Throws:
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
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 Object

equals

public boolean equals(Object object)
Overrides:
equals in class Object

declarationIterator

public 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:


Copyright © 2001-2005 The Codehaus. All Rights Reserved.