org.drools.reteoo
Class ConditionNode

java.lang.Object
  extended byorg.drools.reteoo.TupleSource
      extended byorg.drools.reteoo.ConditionNode
All Implemented Interfaces:
Serializable, TupleSink

class ConditionNode
extends TupleSource
implements TupleSink

Node which filters ReteTuples.

Using a semantic Condition, this node may allow or disallow Tuples to proceed further through the Rete-OO network.

Author:
bob mcwhirter
See Also:
ConditionNode, Condition, ReteTuple

Constructor Summary
(package private) ConditionNode(Rule rule, TupleSource tupleSource, Condition condition, int order)
          Construct.
 
Method Summary
 void assertTuple(ReteTuple tuple, WorkingMemoryImpl workingMemory)
          Assert a new Tuple.
 Condition getCondition()
          Retrieve the Condition associated with this node.
 Set getTupleDeclarations()
          Retrieve the Set of Declaration s in the propagated Tuples.
 TupleSink getTupleSink()
          Retrieve the TupleSink that receives propagated Tuples.
 void modifyTuples(FactHandle trigger, TupleSet newTuples, WorkingMemoryImpl workingMemory)
          Modify tuples.
protected  void propagateAssertTuple(ReteTuple tuple, WorkingMemoryImpl workingMemory)
          Propagate the assertion of a Tuple to this node's TupleSink.
protected  void propagateModifyTuples(FactHandle trigger, TupleSet newTuples, WorkingMemoryImpl workingMemory)
          Propagate the modification of Tuple s to this node's TupleSink.
protected  void propagateRetractTuples(TupleKey key, WorkingMemoryImpl workingMemory)
          Propagate the retration of a Tuple to this node's TupleSink.
 void retractTuples(TupleKey key, WorkingMemoryImpl workingMemory)
          Retract tuples.
protected  void setTupleSink(TupleSink tupleSink)
          Set the TupleSink that receives Tuples propagated from this TupleSource.
 String toString()
          Produce a debug string.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ConditionNode

ConditionNode(Rule rule,
              TupleSource tupleSource,
              Condition condition,
              int order)
Construct.

Parameters:
rule - The rule
tupleSource - The source of incoming Tuples.
condition -
Method Detail

getCondition

public Condition getCondition()
Retrieve the Condition associated with this node.

Returns:
The Condition.

getTupleDeclarations

public Set getTupleDeclarations()
Retrieve the Set of Declaration s in the propagated Tuples.

Specified by:
getTupleDeclarations in class TupleSource
Returns:
The Set of Declarations in progated Tuples.

assertTuple

public void assertTuple(ReteTuple tuple,
                        WorkingMemoryImpl workingMemory)
                 throws AssertionException
Assert a new Tuple.

Specified by:
assertTuple in interface TupleSink
Parameters:
tuple - The Tuple being asserted.
workingMemory - The working memory seesion.
Throws:
AssertionException - If an error occurs while asserting.

retractTuples

public void retractTuples(TupleKey key,
                          WorkingMemoryImpl workingMemory)
                   throws RetractionException
Retract tuples.

Specified by:
retractTuples in interface TupleSink
Parameters:
key - The tuple key.
workingMemory - The working memory seesion.
Throws:
RetractionException - If an error occurs while retracting.

modifyTuples

public void modifyTuples(FactHandle trigger,
                         TupleSet newTuples,
                         WorkingMemoryImpl workingMemory)
                  throws FactException
Modify tuples.

Specified by:
modifyTuples in interface TupleSink
Parameters:
trigger - The root fact object handle.
newTuples - Modification replacement tuples.
workingMemory - The working memory session.
Throws:
FactException - If an error occurs while modifying.

toString

public String toString()
Produce a debug string.

Returns:
The debug string.

setTupleSink

protected void setTupleSink(TupleSink tupleSink)
Set the TupleSink that receives Tuples propagated from this TupleSource.

Parameters:
tupleSink - The TupleSink to receive propagated Tuples.

propagateAssertTuple

protected void propagateAssertTuple(ReteTuple tuple,
                                    WorkingMemoryImpl workingMemory)
                             throws AssertionException
Propagate the assertion of a Tuple to this node's TupleSink.

Parameters:
tuple - The Tuple to propagate.
workingMemory - the working memory session.
Throws:
AssertionException - If an errors occurs while attempting assertion.

propagateRetractTuples

protected void propagateRetractTuples(TupleKey key,
                                      WorkingMemoryImpl workingMemory)
                               throws RetractionException
Propagate the retration of a Tuple to this node's TupleSink.

Parameters:
key - The tuple key.
workingMemory - The working memory session.
Throws:
RetractionException - If an error occurs while attempting retraction

propagateModifyTuples

protected void propagateModifyTuples(FactHandle trigger,
                                     TupleSet newTuples,
                                     WorkingMemoryImpl workingMemory)
                              throws FactException
Propagate the modification of Tuple s to this node's TupleSink.

Parameters:
trigger - The modification trigger object handle.
newTuples - Modification replacement tuples.
workingMemory - The working memory session.
Throws:
FactException - If an error occurs while attempting modification.

getTupleSink

public TupleSink getTupleSink()
Retrieve the TupleSink that receives propagated Tuples.

Returns:
The TupleSink that receives propagated Tuples.


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