org.drools.reteoo.impl
Class JoinMemoryImpl

java.lang.Object
  |
  +--org.drools.reteoo.impl.JoinMemoryImpl
All Implemented Interfaces:
JoinMemory

public class JoinMemoryImpl
extends java.lang.Object
implements JoinMemory

Memory for left and right inputs of a JoinNode.

Author:
bob mcwhirter
See Also:
JoinMemory, JoinNodeImpl, ReteTuple

Constructor Summary
JoinMemoryImpl(JoinNodeImpl node)
          Construct.
 
Method Summary
protected  java.util.Set addLeftTuple(ReteTuple tuple)
          Add a ReteTuple received from the JoinNode's left input to the left side of this memory, and attempt to join to existing Tuples in the right side.
protected  java.util.Set addRightTuple(ReteTuple tuple)
          Add a ReteTuple received from the JoinNode's right input to the right side of this memory, and attempt to join to existing Tuples in the left side.
protected  java.util.Set attemptJoin(ReteTuple tuple, java.util.Iterator tupleIter)
          Attempt to join the tuple against the tuples available through the tupleIterator.
protected  ReteTuple attemptJoin(ReteTuple left, ReteTuple right)
          Attempt to join two Tuples.
protected  java.util.Iterator getJoinDeclarationIterator()
          Retrieve an Iterator over the common Declarations used to join Tuples from the left and right side memories.
protected  java.util.Iterator getLeftTupleIterator()
          Retrieve an Iterator over the Tuples held in the left side memory.
protected  org.drools.reteoo.impl.TupleSet getLeftTuples()
          Retrieve the List of Tuples held in the left side memory.
protected  java.util.Iterator getRightTupleIterator()
          Retrieve an Iterator over the Tuples held in the right side memory.
protected  org.drools.reteoo.impl.TupleSet getRightTuples()
          Retrieve the List of Tuples held in the right side memory.
protected  void modifyLeftTuples(java.lang.Object trigger, org.drools.reteoo.impl.TupleSet newTuples, JoinNodeImpl joinNode, WorkingMemory workingMemory)
          Modify tuples on the left-side.
protected  void modifyRightTuples(java.lang.Object trigger, org.drools.reteoo.impl.TupleSet newTuples, JoinNodeImpl joinNode, WorkingMemory workingMemory)
          Modify tuples on the right-side.
protected  void modifyTuples(java.lang.Object trigger, org.drools.reteoo.impl.TupleSet newTuples, org.drools.reteoo.impl.TupleSet thisSideTuples, org.drools.reteoo.impl.TupleSet thatSideTuples, JoinNodeImpl joinNode, WorkingMemory workingMemory)
          Modify tuples
protected  void retractObject(java.lang.Object object)
          Retract an object from this memory.
protected  void retractTuples(java.util.Set keys)
          Retract tuples from this memory.
protected  void retractTuples(org.drools.reteoo.impl.TupleKey key)
          Retract tuples from this memory.
 java.lang.String toString()
          Produce debug string.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

JoinMemoryImpl

public JoinMemoryImpl(JoinNodeImpl node)
Construct.
Parameters:
node - The JoinNode this memory is for.
Method Detail

retractObject

protected void retractObject(java.lang.Object object)
Retract an object from this memory.
Parameters:
object - The object to retract.

retractTuples

protected void retractTuples(java.util.Set keys)
Retract tuples from this memory.
Parameters:
keys - The keys for the tuples to be removed.

retractTuples

protected void retractTuples(org.drools.reteoo.impl.TupleKey key)
Retract tuples from this memory.
Parameters:
key - The key for the tuples to be removed.

modifyLeftTuples

protected void modifyLeftTuples(java.lang.Object trigger,
                                org.drools.reteoo.impl.TupleSet newTuples,
                                JoinNodeImpl joinNode,
                                WorkingMemory workingMemory)
                         throws FactException
Modify tuples on the left-side.
Parameters:
trigger - Triggering object.
newTuples - Modification replacement tuples.
joinNode - This memory's join node.
workingMemory - The working memory session.
Throws:
FactException - if an error occurs during modification.

modifyRightTuples

protected void modifyRightTuples(java.lang.Object trigger,
                                 org.drools.reteoo.impl.TupleSet newTuples,
                                 JoinNodeImpl joinNode,
                                 WorkingMemory workingMemory)
                          throws FactException
Modify tuples on the right-side.
Parameters:
trigger - Triggering object.
newTuples - Modification replacement tuples.
joinNode - This memory's join node.
workingMemory - The working memory session.
Throws:
FactException - if an error occurs during modification.

modifyTuples

protected void modifyTuples(java.lang.Object trigger,
                            org.drools.reteoo.impl.TupleSet newTuples,
                            org.drools.reteoo.impl.TupleSet thisSideTuples,
                            org.drools.reteoo.impl.TupleSet thatSideTuples,
                            JoinNodeImpl joinNode,
                            WorkingMemory workingMemory)
                     throws FactException
Modify tuples
Parameters:
trigger - Triggering object.
newTuples - Modification replacement tuples.
thisSideTuples - The tuples on the side that's receiving the modifications.
thatSideTuples - The tuples on the side that's not receiving the modifications.
joinNode - This memory's join node.
workingMemory - The working memory session.
Throws:
FactException - if an error occurs during modification.

addLeftTuple

protected java.util.Set addLeftTuple(ReteTuple tuple)
Add a ReteTuple received from the JoinNode's left input to the left side of this memory, and attempt to join to existing Tuples in the right side.
Parameters:
tuple - The Tuple to add to the left side memory.
Returns:
A List of Tuples successfully created by joining the incoming tuple against existing Tuples on the right side memory.
See Also:
JoinNodeImpl, ReteTuple

getLeftTuples

protected org.drools.reteoo.impl.TupleSet getLeftTuples()
Retrieve the List of Tuples held in the left side memory.
Returns:
The List of Tuples help in the left side memory.

getLeftTupleIterator

protected java.util.Iterator getLeftTupleIterator()
Retrieve an Iterator over the Tuples held in the left side memory.
Returns:
An Iterator over the Tuples help in the left side memory.

addRightTuple

protected java.util.Set addRightTuple(ReteTuple tuple)
Add a ReteTuple received from the JoinNode's right input to the right side of this memory, and attempt to join to existing Tuples in the left side.
Parameters:
tuple - The Tuple to add to the right side memory.
Returns:
A List of Tuples successfully created by joining the incoming tuple against existing Tuples on the left side memory.
See Also:
JoinNodeImpl, ReteTuple

getRightTuples

protected org.drools.reteoo.impl.TupleSet getRightTuples()
Retrieve the List of Tuples held in the right side memory.
Returns:
The List of Tuples help in the right side memory.

getRightTupleIterator

protected java.util.Iterator getRightTupleIterator()
Retrieve an Iterator over the Tuples held in the right side memory.
Returns:
An Iterator over the Tuples help in the right side memory.

getJoinDeclarationIterator

protected java.util.Iterator getJoinDeclarationIterator()
Retrieve an Iterator over the common Declarations used to join Tuples from the left and right side memories.
Returns:
An Iterator of common join Declarations.

attemptJoin

protected java.util.Set attemptJoin(ReteTuple tuple,
                                    java.util.Iterator tupleIter)
Attempt to join the tuple against the tuples available through the tupleIterator.
Parameters:
tuple - The Tuple to attempt joining.
tupleIter - The Iterator over Tuples to attempt joining to the tuple parameter.
Returns:
A possibly empty List of joined Tuples.

attemptJoin

protected ReteTuple attemptJoin(ReteTuple left,
                                ReteTuple right)
Attempt to join two Tuples.
Parameters:
left - The left-side Tuple.
right - The right-side Tuple.
Returns:
A newly joined Tuple if a join is possible, else null.

toString

public java.lang.String toString()
Produce debug string.
Overrides:
toString in class java.lang.Object
Returns:
The debug string.


Copyright © 2001-2003 The Werken Company. All Rights Reserved.