[jboss-svn-commits] JBL Code SVN: r17533 - in labs/jbossrules/branches/righttuple: drools-compiler/src/main/java/org/drools/process/builder and 15 other directories.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Thu Jan 3 20:54:46 EST 2008


Author: mark.proctor at jboss.com
Date: 2008-01-03 20:54:45 -0500 (Thu, 03 Jan 2008)
New Revision: 17533

Added:
   labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/CompositeRightTupleSinkAdapter.java
   labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/EmptyLeftTupleSinkAdapter.java
   labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/EmptyRightTupleSinkAdapter.java
   labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/LeftTuple.java
   labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/LeftTupleMemory.java
   labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/LeftTupleSink.java
   labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/LeftTupleSinkNode.java
   labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/LeftTupleSinkNodeList.java
   labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/LeftTupleSinkPropagator.java
   labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/LeftTupleSource.java
   labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/RightTupleMemory.java
   labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/RightTupleSink.java
   labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/RightTupleSinkNode.java
   labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/RightTupleSinkNodeList.java
   labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/RightTupleSource.java
   labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/RightTupletSinkPropagator.java
   labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/SingleLeftTupleSinkAdapter.java
   labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/SingleRightTupletSinkAdapter.java
Removed:
   labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/CompositeObjectSinkAdapter.java
   labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/EmptyObjectSinkAdapter.java
   labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/EmptyTupleSinkAdapter.java
   labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/FactHandleMemory.java
   labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/ObjectSink.java
   labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/ObjectSinkNode.java
   labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/ObjectSinkNodeList.java
   labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/ObjectSinkPropagator.java
   labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/ObjectSource.java
   labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/ReteTuple.java
   labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/SingleObjectSinkAdapter.java
   labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/SingleTupleSinkAdapter.java
   labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/TupleMemory.java
   labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/TupleSink.java
   labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/TupleSinkNode.java
   labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/TupleSinkNodeList.java
   labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/TupleSinkPropagator.java
   labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/TupleSource.java
   labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/util/FactEntry.java
   labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/util/LinkedListNode.java
Modified:
   labs/jbossrules/branches/righttuple/drools-compiler/src/main/java/org/drools/compiler/ProcessBuilder.java
   labs/jbossrules/branches/righttuple/drools-compiler/src/main/java/org/drools/process/builder/ProcessNodeBuilderRegistry.java
   labs/jbossrules/branches/righttuple/drools-compiler/src/test/java/org/drools/reteoo/ReteooBuilderTest.java
   labs/jbossrules/branches/righttuple/drools-compiler/src/test/java/org/drools/rule/builder/dialect/java/JavaActionBuilderTest.java
   labs/jbossrules/branches/righttuple/drools-compiler/src/test/java/org/drools/rule/builder/dialect/mvel/MVELActionBuilderTest.java
   labs/jbossrules/branches/righttuple/drools-compiler/src/test/java/org/drools/rule/builder/dialect/mvel/MVELConsequenceBuilderTest.java
   labs/jbossrules/branches/righttuple/drools-compiler/src/test/java/org/drools/rule/builder/dialect/mvel/MVELDecisionBuilderTest.java
   labs/jbossrules/branches/righttuple/drools-compiler/src/test/java/org/drools/rule/builder/dialect/mvel/MVELEvalBuilderTest.java
   labs/jbossrules/branches/righttuple/drools-compiler/src/test/java/org/drools/rule/builder/dialect/mvel/MVELPredicateBuilderTest.java
   labs/jbossrules/branches/righttuple/drools-compiler/src/test/java/org/drools/rule/builder/dialect/mvel/MVELReturnValueBuilderTest.java
   labs/jbossrules/branches/righttuple/drools-compiler/src/test/java/org/drools/rule/builder/dialect/mvel/MVELSalienceBuilderTest.java
   labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/base/mvel/DroolsMVELFactory.java
   labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/common/BetaConstraints.java
   labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/common/DefaultAgenda.java
   labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/common/DefaultBetaConstraints.java
   labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/common/DoubleBetaConstraints.java
   labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/common/EmptyBetaConstraints.java
   labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/common/InstanceEqualsConstraint.java
   labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/common/InstanceNotEqualsConstraint.java
   labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/common/PropagationContextImpl.java
   labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/common/QuadroupleBetaConstraints.java
   labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/common/ScheduledAgendaItem.java
   labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/common/SingleBetaConstraints.java
   labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/common/TripleBetaConstraints.java
   labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/common/TupleStartEqualsConstraint.java
   labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/conflict/TotalRecencyConflictResolver.java
   labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/AccumulateNode.java
   labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/AlphaNode.java
   labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/BetaMemory.java
   labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/BetaNode.java
   labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/CollectNode.java
   labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/CompositeTupleSinkAdapter.java
   labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/EvalConditionNode.java
   labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/ExistsNode.java
   labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/FromNode.java
   labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/JoinNode.java
   labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/LeftInputAdapterNode.java
   labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/MemoryVisitor.java
   labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/NotNode.java
   labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/ObjectTypeNode.java
   labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/QueryTerminalNode.java
   labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/Rete.java
   labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/ReteooRuleBase.java
   labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/RightInputAdapterNode.java
   labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/RuleTerminalNode.java
   labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/builder/AccumulateBuilder.java
   labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/builder/BuildContext.java
   labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/builder/BuildUtils.java
   labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/builder/CollectBuilder.java
   labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/builder/EvalBuilder.java
   labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/builder/FromBuilder.java
   labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/builder/GroupElementBuilder.java
   labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/builder/PatternBuilder.java
   labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/rule/AbstractCompositeConstraint.java
   labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/rule/AbstractCompositeRestriction.java
   labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/rule/AndCompositeRestriction.java
   labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/rule/AndConstraint.java
   labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/rule/ContextEntry.java
   labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/rule/LiteralRestriction.java
   labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/rule/MultiRestrictionFieldConstraint.java
   labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/rule/OrCompositeRestriction.java
   labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/rule/OrConstraint.java
   labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/rule/PredicateConstraint.java
   labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/rule/ReturnValueConstraint.java
   labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/rule/ReturnValueRestriction.java
   labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/rule/VariableConstraint.java
   labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/rule/VariableRestriction.java
   labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/spi/BetaNodeFieldConstraint.java
   labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/spi/PropagationContext.java
   labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/spi/Restriction.java
   labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/util/AbstractBaseLinkedListNode.java
   labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/util/AbstractHashTable.java
   labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/util/Entry.java
   labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/util/FactHandleIndexHashTable.java
   labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/util/FactHashTable.java
   labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/util/FactList.java
   labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/util/LinkedList.java
   labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/util/ObjectHashMap.java
   labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/util/ObjectHashSet.java
   labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/util/TupleHashTable.java
   labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/util/TupleIndexHashTable.java
   labs/jbossrules/branches/righttuple/drools-core/src/test/java/org/drools/common/BaseBetaConstraintsTest.java
   labs/jbossrules/branches/righttuple/drools-core/src/test/java/org/drools/reteoo/AccumulateNodeTest.java
   labs/jbossrules/branches/righttuple/drools-core/src/test/java/org/drools/reteoo/AgendaTest.java
   labs/jbossrules/branches/righttuple/drools-core/src/test/java/org/drools/reteoo/AlphaNodeTest.java
   labs/jbossrules/branches/righttuple/drools-core/src/test/java/org/drools/reteoo/BetaNodeTest.java
   labs/jbossrules/branches/righttuple/drools-core/src/test/java/org/drools/reteoo/CollectNodeTest.java
   labs/jbossrules/branches/righttuple/drools-core/src/test/java/org/drools/reteoo/CompositeObjectSinkAdapterTest.java
   labs/jbossrules/branches/righttuple/drools-core/src/test/java/org/drools/reteoo/EvalConditionNodeTest.java
   labs/jbossrules/branches/righttuple/drools-core/src/test/java/org/drools/reteoo/ExistsNodeTest.java
   labs/jbossrules/branches/righttuple/drools-core/src/test/java/org/drools/reteoo/FromNodeTest.java
   labs/jbossrules/branches/righttuple/drools-core/src/test/java/org/drools/reteoo/InstrumentedReteTuple.java
   labs/jbossrules/branches/righttuple/drools-core/src/test/java/org/drools/reteoo/JoinNodeTest.java
   labs/jbossrules/branches/righttuple/drools-core/src/test/java/org/drools/reteoo/LeftInputAdapterNodeTest.java
   labs/jbossrules/branches/righttuple/drools-core/src/test/java/org/drools/reteoo/LogicalAssertionTest.java
   labs/jbossrules/branches/righttuple/drools-core/src/test/java/org/drools/reteoo/MockObjectSink.java
   labs/jbossrules/branches/righttuple/drools-core/src/test/java/org/drools/reteoo/MockObjectSource.java
   labs/jbossrules/branches/righttuple/drools-core/src/test/java/org/drools/reteoo/MockTupleSink.java
   labs/jbossrules/branches/righttuple/drools-core/src/test/java/org/drools/reteoo/MockTupleSource.java
   labs/jbossrules/branches/righttuple/drools-core/src/test/java/org/drools/reteoo/NotNodeTest.java
   labs/jbossrules/branches/righttuple/drools-core/src/test/java/org/drools/reteoo/ObjectSourceTest.java
   labs/jbossrules/branches/righttuple/drools-core/src/test/java/org/drools/reteoo/ObjectTypeNodeTest.java
   labs/jbossrules/branches/righttuple/drools-core/src/test/java/org/drools/reteoo/ReteTest.java
   labs/jbossrules/branches/righttuple/drools-core/src/test/java/org/drools/reteoo/RuleFlowGroupTest.java
   labs/jbossrules/branches/righttuple/drools-core/src/test/java/org/drools/reteoo/SchedulerTest.java
   labs/jbossrules/branches/righttuple/drools-core/src/test/java/org/drools/reteoo/TupleSourceTest.java
   labs/jbossrules/branches/righttuple/drools-core/src/test/java/org/drools/spi/MockConstraint.java
   labs/jbossrules/branches/righttuple/drools-core/src/test/java/org/drools/util/FieldIndexHashTableTest.java
Log:
-refactored code to use a RightTuple on the object sinks and source. manners and waltz appear to atleast run.

Modified: labs/jbossrules/branches/righttuple/drools-compiler/src/main/java/org/drools/compiler/ProcessBuilder.java
===================================================================
--- labs/jbossrules/branches/righttuple/drools-compiler/src/main/java/org/drools/compiler/ProcessBuilder.java	2008-01-04 00:57:26 UTC (rev 17532)
+++ labs/jbossrules/branches/righttuple/drools-compiler/src/main/java/org/drools/compiler/ProcessBuilder.java	2008-01-04 01:54:45 UTC (rev 17533)
@@ -28,7 +28,6 @@
 
 import org.drools.lang.descr.ActionDescr;
 import org.drools.lang.descr.ProcessDescr;
-import org.drools.process.builder.StoreNodeBuilder;
 import org.drools.process.builder.ProcessNodeBuilder;
 import org.drools.process.builder.ProcessNodeBuilderRegistry;
 import org.drools.process.builder.SplitNodeBuilder;

Modified: labs/jbossrules/branches/righttuple/drools-compiler/src/main/java/org/drools/process/builder/ProcessNodeBuilderRegistry.java
===================================================================
--- labs/jbossrules/branches/righttuple/drools-compiler/src/main/java/org/drools/process/builder/ProcessNodeBuilderRegistry.java	2008-01-04 00:57:26 UTC (rev 17532)
+++ labs/jbossrules/branches/righttuple/drools-compiler/src/main/java/org/drools/process/builder/ProcessNodeBuilderRegistry.java	2008-01-04 01:54:45 UTC (rev 17533)
@@ -13,10 +13,10 @@
     public ProcessNodeBuilderRegistry() {
         this.registry = new HashMap<Class< ? extends Node>, ProcessNodeBuilder>();
 
-        register( ActionNodeImpl.class,
-                  new StoreNodeBuilder() );
-        register( SplitImpl.class,
-                  new SplitNodeBuilder() );
+//        register( ActionNodeImpl.class,
+//                  new StoreNodeBuilder() );
+//        register( SplitImpl.class,
+//                  new SplitNodeBuilder() );
     }
 
     public void register(Class< ? extends Node> cls,

Modified: labs/jbossrules/branches/righttuple/drools-compiler/src/test/java/org/drools/reteoo/ReteooBuilderTest.java
===================================================================
--- labs/jbossrules/branches/righttuple/drools-compiler/src/test/java/org/drools/reteoo/ReteooBuilderTest.java	2008-01-04 00:57:26 UTC (rev 17532)
+++ labs/jbossrules/branches/righttuple/drools-compiler/src/test/java/org/drools/reteoo/ReteooBuilderTest.java	2008-01-04 01:54:45 UTC (rev 17533)
@@ -77,12 +77,12 @@
                       object1,
                       object2 );
 
-        if ( object1 instanceof ObjectSource ) {
-            final ObjectSource source1 = (ObjectSource) object1;
-            final ObjectSource source2 = (ObjectSource) object2;
+        if ( object1 instanceof RightTupleSource ) {
+            final RightTupleSource source1 = (RightTupleSource) object1;
+            final RightTupleSource source2 = (RightTupleSource) object2;
 
-            final ObjectSink[] list1 = source1.sink.getSinks();
-            final ObjectSink[] list2 = source2.sink.getSinks();
+            final RightTupleSink[] list1 = source1.sink.getSinks();
+            final RightTupleSink[] list2 = source2.sink.getSinks();
 
             assertEquals( object1.getClass() + " nodes have different number of sinks",
                           list1.length,
@@ -92,12 +92,12 @@
                 nodesEquals( list1[i],
                              list2[i] );
             }
-        } else if ( object1 instanceof TupleSource ) {
-            final TupleSource source1 = (TupleSource) object1;
-            final TupleSource source2 = (TupleSource) object2;
+        } else if ( object1 instanceof LeftTupleSource ) {
+            final LeftTupleSource source1 = (LeftTupleSource) object1;
+            final LeftTupleSource source2 = (LeftTupleSource) object2;
 
-            final TupleSink[] list1 = source1.sink.getSinks();
-            final TupleSink[] list2 = source2.sink.getSinks();
+            final LeftTupleSink[] list1 = source1.sink.getSinks();
+            final LeftTupleSink[] list2 = source2.sink.getSinks();
 
             assertEquals( object1.getClass() + " nodes have different number of sinks",
                           list1.length,

Modified: labs/jbossrules/branches/righttuple/drools-compiler/src/test/java/org/drools/rule/builder/dialect/java/JavaActionBuilderTest.java
===================================================================
--- labs/jbossrules/branches/righttuple/drools-compiler/src/test/java/org/drools/rule/builder/dialect/java/JavaActionBuilderTest.java	2008-01-04 00:57:26 UTC (rev 17532)
+++ labs/jbossrules/branches/righttuple/drools-compiler/src/test/java/org/drools/rule/builder/dialect/java/JavaActionBuilderTest.java	2008-01-04 01:54:45 UTC (rev 17533)
@@ -33,7 +33,7 @@
 import org.drools.lang.descr.PackageDescr;
 import org.drools.lang.descr.ProcessDescr;
 import org.drools.lang.descr.RuleDescr;
-import org.drools.reteoo.ReteTuple;
+import org.drools.reteoo.LeftTuple;
 import org.drools.rule.Declaration;
 import org.drools.rule.Package;
 import org.drools.rule.Pattern;

Modified: labs/jbossrules/branches/righttuple/drools-compiler/src/test/java/org/drools/rule/builder/dialect/mvel/MVELActionBuilderTest.java
===================================================================
--- labs/jbossrules/branches/righttuple/drools-compiler/src/test/java/org/drools/rule/builder/dialect/mvel/MVELActionBuilderTest.java	2008-01-04 00:57:26 UTC (rev 17532)
+++ labs/jbossrules/branches/righttuple/drools-compiler/src/test/java/org/drools/rule/builder/dialect/mvel/MVELActionBuilderTest.java	2008-01-04 01:54:45 UTC (rev 17533)
@@ -32,7 +32,7 @@
 import org.drools.lang.descr.ActionDescr;
 import org.drools.lang.descr.PackageDescr;
 import org.drools.lang.descr.RuleDescr;
-import org.drools.reteoo.ReteTuple;
+import org.drools.reteoo.LeftTuple;
 import org.drools.rule.Declaration;
 import org.drools.rule.Package;
 import org.drools.rule.Pattern;

Modified: labs/jbossrules/branches/righttuple/drools-compiler/src/test/java/org/drools/rule/builder/dialect/mvel/MVELConsequenceBuilderTest.java
===================================================================
--- labs/jbossrules/branches/righttuple/drools-compiler/src/test/java/org/drools/rule/builder/dialect/mvel/MVELConsequenceBuilderTest.java	2008-01-04 00:57:26 UTC (rev 17532)
+++ labs/jbossrules/branches/righttuple/drools-compiler/src/test/java/org/drools/rule/builder/dialect/mvel/MVELConsequenceBuilderTest.java	2008-01-04 01:54:45 UTC (rev 17533)
@@ -29,7 +29,7 @@
 import org.drools.lang.descr.ActionDescr;
 import org.drools.lang.descr.PackageDescr;
 import org.drools.lang.descr.RuleDescr;
-import org.drools.reteoo.ReteTuple;
+import org.drools.reteoo.LeftTuple;
 import org.drools.rule.Declaration;
 import org.drools.rule.Package;
 import org.drools.rule.Pattern;
@@ -88,7 +88,7 @@
         final Cheese cheddar = new Cheese( "cheddar",
                                            10 );
         final InternalFactHandle f0 = (InternalFactHandle) wm.insert( cheddar );
-        final ReteTuple tuple = new ReteTuple( f0 );
+        final LeftTuple tuple = new LeftTuple( f0 );
 
         final AgendaItem item = new AgendaItem( 0,
                                                 tuple,
@@ -156,7 +156,7 @@
         final Cheese cheddar = new Cheese( "cheddar",
                                            10 );
         final InternalFactHandle f0 = (InternalFactHandle) wm.insert( cheddar );
-        final ReteTuple tuple = new ReteTuple( f0 );
+        final LeftTuple tuple = new LeftTuple( f0 );
 
         final AgendaItem item = new AgendaItem( 0,
                                                 tuple,

Modified: labs/jbossrules/branches/righttuple/drools-compiler/src/test/java/org/drools/rule/builder/dialect/mvel/MVELDecisionBuilderTest.java
===================================================================
--- labs/jbossrules/branches/righttuple/drools-compiler/src/test/java/org/drools/rule/builder/dialect/mvel/MVELDecisionBuilderTest.java	2008-01-04 00:57:26 UTC (rev 17532)
+++ labs/jbossrules/branches/righttuple/drools-compiler/src/test/java/org/drools/rule/builder/dialect/mvel/MVELDecisionBuilderTest.java	2008-01-04 01:54:45 UTC (rev 17533)
@@ -32,7 +32,7 @@
 import org.drools.lang.descr.ActionDescr;
 import org.drools.lang.descr.PackageDescr;
 import org.drools.lang.descr.RuleDescr;
-import org.drools.reteoo.ReteTuple;
+import org.drools.reteoo.LeftTuple;
 import org.drools.rule.Declaration;
 import org.drools.rule.Package;
 import org.drools.rule.Pattern;

Modified: labs/jbossrules/branches/righttuple/drools-compiler/src/test/java/org/drools/rule/builder/dialect/mvel/MVELEvalBuilderTest.java
===================================================================
--- labs/jbossrules/branches/righttuple/drools-compiler/src/test/java/org/drools/rule/builder/dialect/mvel/MVELEvalBuilderTest.java	2008-01-04 00:57:26 UTC (rev 17532)
+++ labs/jbossrules/branches/righttuple/drools-compiler/src/test/java/org/drools/rule/builder/dialect/mvel/MVELEvalBuilderTest.java	2008-01-04 01:54:45 UTC (rev 17533)
@@ -17,7 +17,7 @@
 import org.drools.compiler.PackageBuilderConfiguration;
 import org.drools.lang.descr.EvalDescr;
 import org.drools.lang.descr.RuleDescr;
-import org.drools.reteoo.ReteTuple;
+import org.drools.reteoo.LeftTuple;
 import org.drools.rule.Declaration;
 import org.drools.rule.EvalCondition;
 import org.drools.rule.Package;
@@ -76,7 +76,7 @@
         final Cheese cheddar = new Cheese( "cheddar",
                                            10 );
         final InternalFactHandle f0 = (InternalFactHandle) wm.insert( cheddar );
-        final ReteTuple tuple = new ReteTuple( f0 );
+        final LeftTuple tuple = new LeftTuple( f0 );
 
         assertTrue( eval.isAllowed( tuple,
                                     wm ) );

Modified: labs/jbossrules/branches/righttuple/drools-compiler/src/test/java/org/drools/rule/builder/dialect/mvel/MVELPredicateBuilderTest.java
===================================================================
--- labs/jbossrules/branches/righttuple/drools-compiler/src/test/java/org/drools/rule/builder/dialect/mvel/MVELPredicateBuilderTest.java	2008-01-04 00:57:26 UTC (rev 17532)
+++ labs/jbossrules/branches/righttuple/drools-compiler/src/test/java/org/drools/rule/builder/dialect/mvel/MVELPredicateBuilderTest.java	2008-01-04 01:54:45 UTC (rev 17533)
@@ -18,7 +18,7 @@
 import org.drools.compiler.PackageBuilderConfiguration;
 import org.drools.lang.descr.PredicateDescr;
 import org.drools.lang.descr.RuleDescr;
-import org.drools.reteoo.ReteTuple;
+import org.drools.reteoo.LeftTuple;
 import org.drools.rule.Declaration;
 import org.drools.rule.Package;
 import org.drools.rule.Pattern;
@@ -105,7 +105,7 @@
                                            10 );
         final InternalFactHandle f0 = (InternalFactHandle) wm.insert( cheddar );
         final InternalFactHandle f1 = (InternalFactHandle) wm.insert( stilton );
-        final ReteTuple tuple = new ReteTuple( f0 );
+        final LeftTuple tuple = new LeftTuple( f0 );
 
         final PredicateContextEntry predicateContext = new PredicateContextEntry();
         predicateContext.leftTuple = tuple;

Modified: labs/jbossrules/branches/righttuple/drools-compiler/src/test/java/org/drools/rule/builder/dialect/mvel/MVELReturnValueBuilderTest.java
===================================================================
--- labs/jbossrules/branches/righttuple/drools-compiler/src/test/java/org/drools/rule/builder/dialect/mvel/MVELReturnValueBuilderTest.java	2008-01-04 00:57:26 UTC (rev 17532)
+++ labs/jbossrules/branches/righttuple/drools-compiler/src/test/java/org/drools/rule/builder/dialect/mvel/MVELReturnValueBuilderTest.java	2008-01-04 01:54:45 UTC (rev 17533)
@@ -20,7 +20,7 @@
 import org.drools.compiler.PackageBuilderConfiguration;
 import org.drools.lang.descr.ReturnValueRestrictionDescr;
 import org.drools.lang.descr.RuleDescr;
-import org.drools.reteoo.ReteTuple;
+import org.drools.reteoo.LeftTuple;
 import org.drools.rule.Declaration;
 import org.drools.rule.Package;
 import org.drools.rule.Pattern;
@@ -111,10 +111,10 @@
         final Cheese cheddar = new Cheese( "cheddar",
                                            10 );
         final InternalFactHandle f0 = (InternalFactHandle) wm.insert( cheddar );
-        ReteTuple tuple = new ReteTuple( f0 );
+        LeftTuple tuple = new LeftTuple( f0 );
 
         final InternalFactHandle f1 = (InternalFactHandle) wm.insert( stilton );
-        tuple = new ReteTuple( tuple,
+        tuple = new LeftTuple( tuple,
                                f1 );
 
         final Cheese brie = new Cheese( "brie",

Modified: labs/jbossrules/branches/righttuple/drools-compiler/src/test/java/org/drools/rule/builder/dialect/mvel/MVELSalienceBuilderTest.java
===================================================================
--- labs/jbossrules/branches/righttuple/drools-compiler/src/test/java/org/drools/rule/builder/dialect/mvel/MVELSalienceBuilderTest.java	2008-01-04 00:57:26 UTC (rev 17532)
+++ labs/jbossrules/branches/righttuple/drools-compiler/src/test/java/org/drools/rule/builder/dialect/mvel/MVELSalienceBuilderTest.java	2008-01-04 01:54:45 UTC (rev 17533)
@@ -16,7 +16,7 @@
 import org.drools.compiler.PackageBuilder;
 import org.drools.compiler.PackageBuilderConfiguration;
 import org.drools.lang.descr.RuleDescr;
-import org.drools.reteoo.ReteTuple;
+import org.drools.reteoo.LeftTuple;
 import org.drools.rule.Declaration;
 import org.drools.rule.Package;
 import org.drools.rule.Pattern;
@@ -64,7 +64,7 @@
 
         final Person p = new Person("mark", "", 31);
         final InternalFactHandle f0 = (InternalFactHandle) wm.insert( p );
-        final ReteTuple tuple = new ReteTuple( f0 );
+        final LeftTuple tuple = new LeftTuple( f0 );
 
         SalienceBuilder salienceBuilder = new MVELSalienceBuilder();
         salienceBuilder.build( context );

Modified: labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/base/mvel/DroolsMVELFactory.java
===================================================================
--- labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/base/mvel/DroolsMVELFactory.java	2008-01-04 00:57:26 UTC (rev 17532)
+++ labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/base/mvel/DroolsMVELFactory.java	2008-01-04 01:54:45 UTC (rev 17533)
@@ -14,7 +14,7 @@
 
 import org.drools.WorkingMemory;
 import org.drools.common.DroolsObjectInputStream;
-import org.drools.reteoo.ReteTuple;
+import org.drools.reteoo.LeftTuple;
 import org.drools.rule.Declaration;
 import org.drools.rule.Package;
 import org.drools.spi.KnowledgeHelper;
@@ -158,7 +158,7 @@
                            final WorkingMemory workingMemory,
                            final Map variables) {
         if ( tuple != null ) {
-            this.tupleObjects = ((ReteTuple) tuple).toObjectArray();
+            this.tupleObjects = ((LeftTuple) tuple).toObjectArray();
         }
         this.knowledgeHelper = knowledgeHelper;
         this.object = object;

Modified: labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/common/BetaConstraints.java
===================================================================
--- labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/common/BetaConstraints.java	2008-01-04 00:57:26 UTC (rev 17532)
+++ labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/common/BetaConstraints.java	2008-01-04 01:54:45 UTC (rev 17533)
@@ -4,7 +4,8 @@
 
 import org.drools.RuleBaseConfiguration;
 import org.drools.reteoo.BetaMemory;
-import org.drools.reteoo.ReteTuple;
+import org.drools.reteoo.LeftTuple;
+import org.drools.reteoo.RightTuple;
 import org.drools.util.LinkedList;
 
 public interface BetaConstraints
@@ -12,14 +13,14 @@
     Serializable {
 
     public void updateFromTuple(InternalWorkingMemory workingMemory,
-                                ReteTuple tuple);
+                                LeftTuple tuple);
 
-    public void updateFromFactHandle(InternalWorkingMemory workingMemory,
-                                     InternalFactHandle handle);
+    public void updateFromRightTuple(InternalWorkingMemory workingMemory,
+                                     RightTuple rightTuple);
 
     public boolean isAllowedCachedLeft(InternalFactHandle handle);
 
-    public boolean isAllowedCachedRight(ReteTuple tuple);
+    public boolean isAllowedCachedRight(LeftTuple tuple);
 
     public LinkedList getConstraints();
 

Modified: labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/common/DefaultAgenda.java
===================================================================
--- labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/common/DefaultAgenda.java	2008-01-04 00:57:26 UTC (rev 17532)
+++ labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/common/DefaultAgenda.java	2008-01-04 01:54:45 UTC (rev 17533)
@@ -38,8 +38,7 @@
 import org.drools.spi.ConsequenceExceptionHandler;
 import org.drools.spi.KnowledgeHelper;
 import org.drools.spi.RuleFlowGroup;
-import org.drools.util.LinkedListNode;
-import org.drools.util.Queueable;
+import org.drools.util.Entry;
 
 /**
  * Rule-firing Agenda.
@@ -349,7 +348,7 @@
      */
     public Activation[] getScheduledActivations() {
         final List list = new ArrayList( this.scheduledActivations.size() );
-        for ( LinkedListNode node = this.scheduledActivations.getFirst(); node != null; node = node.getNext() ) {
+        for ( Entry node = this.scheduledActivations.getFirst(); node != null; node = node.getNext() ) {
             list.add( node );
         }
         return (Activation[]) list.toArray( new Activation[list.size()] );

Modified: labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/common/DefaultBetaConstraints.java
===================================================================
--- labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/common/DefaultBetaConstraints.java	2008-01-04 00:57:26 UTC (rev 17532)
+++ labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/common/DefaultBetaConstraints.java	2008-01-04 01:54:45 UTC (rev 17533)
@@ -23,9 +23,10 @@
 import org.drools.RuleBaseConfiguration;
 import org.drools.base.evaluators.Operator;
 import org.drools.reteoo.BetaMemory;
-import org.drools.reteoo.FactHandleMemory;
-import org.drools.reteoo.ReteTuple;
-import org.drools.reteoo.TupleMemory;
+import org.drools.reteoo.RightTuple;
+import org.drools.reteoo.RightTupleMemory;
+import org.drools.reteoo.LeftTuple;
+import org.drools.reteoo.LeftTupleMemory;
 import org.drools.rule.ContextEntry;
 import org.drools.rule.VariableConstraint;
 import org.drools.spi.BetaNodeFieldConstraint;
@@ -132,7 +133,7 @@
      * @see org.drools.common.BetaNodeConstraints#updateFromTuple(org.drools.reteoo.ReteTuple)
      */
     public void updateFromTuple(final InternalWorkingMemory workingMemory,
-                                final ReteTuple tuple) {
+                                final LeftTuple tuple) {
         for ( ContextEntry context = this.contexts; context != null; context = context.getNext() ) {
             context.updateFromTuple( workingMemory,
                                      tuple );
@@ -142,11 +143,11 @@
     /* (non-Javadoc)
      * @see org.drools.common.BetaNodeConstraints#updateFromFactHandle(org.drools.common.InternalFactHandle)
      */
-    public void updateFromFactHandle(final InternalWorkingMemory workingMemory,
-                                     final InternalFactHandle handle) {
+    public void updateFromRightTuple(final InternalWorkingMemory workingMemory,
+                                     final RightTuple rightTuple) {
         for ( ContextEntry context = this.contexts; context != null; context = context.getNext() ) {
             context.updateFromFactHandle( workingMemory,
-                                          handle );
+                                          rightTuple.getHandle() );
         }
     }
 
@@ -172,7 +173,7 @@
     /* (non-Javadoc)
      * @see org.drools.common.BetaNodeConstraints#isAllowedCachedRight(org.drools.reteoo.ReteTuple)
      */
-    public boolean isAllowedCachedRight(final ReteTuple tuple) {
+    public boolean isAllowedCachedRight(final LeftTuple tuple) {
         // skip the indexed constraints
         LinkedListEntry entry = (LinkedListEntry) findNode( this.indexed );
 
@@ -218,24 +219,24 @@
             }
 
             final FieldIndex[] indexes = (FieldIndex[]) list.toArray( new FieldIndex[list.size()] );
-            TupleMemory tupleMemory;
+            LeftTupleMemory tupleMemory;
             if ( config.isIndexLeftBetaMemory() ) {
                 tupleMemory = new TupleIndexHashTable( indexes );
             } else {
                 tupleMemory = new TupleHashTable();
             }
 
-            FactHandleMemory factHandleMemory;
+            RightTupleMemory factHandleMemory;
             if ( config.isIndexRightBetaMemory() ) {
                 factHandleMemory = new FactHandleIndexHashTable( indexes );
             } else {
-                factHandleMemory = config.isSequential() ? (FactHandleMemory) new FactList() : (FactHandleMemory) new FactHashTable();
+                factHandleMemory = config.isSequential() ? (RightTupleMemory) new FactList() : (RightTupleMemory) new FactHashTable();
             }
             memory = new BetaMemory( config.isSequential() ? null : tupleMemory,
                                      factHandleMemory );
         } else {
             memory = new BetaMemory( config.isSequential() ? null : new TupleHashTable(),
-                                     config.isSequential() ? (FactHandleMemory) new FactList() : (FactHandleMemory) new FactHashTable() );
+                                     config.isSequential() ? (RightTupleMemory) new FactList() : (RightTupleMemory) new FactHashTable() );
         }
 
         return memory;

Modified: labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/common/DoubleBetaConstraints.java
===================================================================
--- labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/common/DoubleBetaConstraints.java	2008-01-04 00:57:26 UTC (rev 17532)
+++ labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/common/DoubleBetaConstraints.java	2008-01-04 01:54:45 UTC (rev 17533)
@@ -23,9 +23,10 @@
 import org.drools.RuleBaseConfiguration;
 import org.drools.base.evaluators.Operator;
 import org.drools.reteoo.BetaMemory;
-import org.drools.reteoo.FactHandleMemory;
-import org.drools.reteoo.ReteTuple;
-import org.drools.reteoo.TupleMemory;
+import org.drools.reteoo.RightTuple;
+import org.drools.reteoo.RightTupleMemory;
+import org.drools.reteoo.LeftTuple;
+import org.drools.reteoo.LeftTupleMemory;
 import org.drools.rule.ContextEntry;
 import org.drools.rule.VariableConstraint;
 import org.drools.spi.BetaNodeFieldConstraint;
@@ -121,7 +122,7 @@
      * @see org.drools.common.BetaNodeConstraints#updateFromTuple(org.drools.reteoo.ReteTuple)
      */
     public void updateFromTuple(final InternalWorkingMemory workingMemory,
-                                final ReteTuple tuple) {
+                                final LeftTuple tuple) {
         this.context0.updateFromTuple( workingMemory,
                                        tuple );
         this.context1.updateFromTuple( workingMemory,
@@ -131,12 +132,12 @@
     /* (non-Javadoc)
      * @see org.drools.common.BetaNodeConstraints#updateFromFactHandle(org.drools.common.InternalFactHandle)
      */
-    public void updateFromFactHandle(final InternalWorkingMemory workingMemory,
-                                     final InternalFactHandle handle) {
+    public void updateFromRightTuple(final InternalWorkingMemory workingMemory,
+                                     final RightTuple rightTuple) {
         this.context0.updateFromFactHandle( workingMemory,
-                                            handle );
+                                            rightTuple.getHandle() );
         this.context1.updateFromFactHandle( workingMemory,
-                                            handle );
+                                            rightTuple.getHandle() );
     }
 
     /* (non-Javadoc)
@@ -151,7 +152,7 @@
     /* (non-Javadoc)
      * @see org.drools.common.BetaNodeConstraints#isAllowedCachedRight(org.drools.reteoo.ReteTuple)
      */
-    public boolean isAllowedCachedRight(final ReteTuple tuple) {
+    public boolean isAllowedCachedRight(final LeftTuple tuple) {
         return this.constraint0.isAllowedCachedRight( tuple,
                                                       this.context0 ) && this.constraint1.isAllowedCachedRight( tuple,
                                                                                                                 this.context1 );
@@ -200,24 +201,24 @@
         if ( !list.isEmpty() ) {
             final FieldIndex[] indexes = (FieldIndex[]) list.toArray( new FieldIndex[list.size()] );
 
-            TupleMemory tupleMemory;
+            LeftTupleMemory tupleMemory;
             if ( config.isIndexLeftBetaMemory() ) {
                 tupleMemory = new TupleIndexHashTable( indexes );
             } else {
                 tupleMemory = new TupleHashTable();
             }
 
-            FactHandleMemory factHandleMemory;
+            RightTupleMemory factHandleMemory;
             if ( config.isIndexRightBetaMemory() ) {
                 factHandleMemory = new FactHandleIndexHashTable( indexes );
             } else {
-                factHandleMemory = config.isSequential() ? (FactHandleMemory) new FactList() : (FactHandleMemory) new FactHashTable();
+                factHandleMemory = config.isSequential() ? (RightTupleMemory) new FactList() : (RightTupleMemory) new FactHashTable();
             }
             memory = new BetaMemory( config.isSequential() ? null : tupleMemory,
                                      factHandleMemory );
         } else {
             memory = new BetaMemory( config.isSequential() ? null : new TupleHashTable(),
-                                     config.isSequential() ? (FactHandleMemory) new FactList() : (FactHandleMemory) new FactHashTable() );
+                                     config.isSequential() ? (RightTupleMemory) new FactList() : (RightTupleMemory) new FactHashTable() );
         }
 
         return memory;

Modified: labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/common/EmptyBetaConstraints.java
===================================================================
--- labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/common/EmptyBetaConstraints.java	2008-01-04 00:57:26 UTC (rev 17532)
+++ labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/common/EmptyBetaConstraints.java	2008-01-04 01:54:45 UTC (rev 17533)
@@ -20,8 +20,9 @@
 
 import org.drools.RuleBaseConfiguration;
 import org.drools.reteoo.BetaMemory;
-import org.drools.reteoo.FactHandleMemory;
-import org.drools.reteoo.ReteTuple;
+import org.drools.reteoo.RightTuple;
+import org.drools.reteoo.RightTupleMemory;
+import org.drools.reteoo.LeftTuple;
 import org.drools.util.FactHashTable;
 import org.drools.util.FactList;
 import org.drools.util.LinkedList;
@@ -50,14 +51,14 @@
      * @see org.drools.common.BetaNodeConstraints#updateFromTuple(org.drools.reteoo.ReteTuple)
      */
     public void updateFromTuple(final InternalWorkingMemory workingMemory,
-                                final ReteTuple tuple) {
+                                final LeftTuple tuple) {
     }
 
     /* (non-Javadoc)
      * @see org.drools.common.BetaNodeConstraints#updateFromFactHandle(org.drools.common.InternalFactHandle)
      */
-    public void updateFromFactHandle(final InternalWorkingMemory workingMemory,
-                                     final InternalFactHandle handle) {
+    public void updateFromRightTuple(final InternalWorkingMemory workingMemory,
+                                     final RightTuple rightTuple) {
     }
 
     /* (non-Javadoc)
@@ -70,7 +71,7 @@
     /* (non-Javadoc)
      * @see org.drools.common.BetaNodeConstraints#isAllowedCachedRight(org.drools.reteoo.ReteTuple)
      */
-    public boolean isAllowedCachedRight(final ReteTuple tuple) {
+    public boolean isAllowedCachedRight(final LeftTuple tuple) {
         return true;
     }
 
@@ -88,7 +89,7 @@
 
     public BetaMemory createBetaMemory(final RuleBaseConfiguration config) {
         final BetaMemory memory = new BetaMemory( config.isSequential() ? null : new TupleHashTable(),
-                                                  config.isSequential() ? (FactHandleMemory) new FactList() : (FactHandleMemory) new FactHashTable() );
+                                                  config.isSequential() ? (RightTupleMemory) new FactList() : (RightTupleMemory) new FactHashTable() );
 
         return memory;
     }

Modified: labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/common/InstanceEqualsConstraint.java
===================================================================
--- labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/common/InstanceEqualsConstraint.java	2008-01-04 00:57:26 UTC (rev 17532)
+++ labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/common/InstanceEqualsConstraint.java	2008-01-04 01:54:45 UTC (rev 17533)
@@ -16,7 +16,7 @@
 
 package org.drools.common;
 
-import org.drools.reteoo.ReteTuple;
+import org.drools.reteoo.LeftTuple;
 import org.drools.rule.Pattern;
 import org.drools.rule.ContextEntry;
 import org.drools.rule.Declaration;
@@ -66,7 +66,7 @@
         return ((InstanceEqualsConstraintContextEntry) context).left == handle.getObject();
     }
 
-    public boolean isAllowedCachedRight(final ReteTuple tuple,
+    public boolean isAllowedCachedRight(final LeftTuple tuple,
                                         final ContextEntry context) {
         return tuple.get( this.otherPattern.getOffset() ).getObject() == ((InstanceEqualsConstraintContextEntry) context).right;
     }
@@ -122,7 +122,7 @@
         }
 
         public void updateFromTuple(final InternalWorkingMemory workingMemory,
-                                    final ReteTuple tuple) {
+                                    final LeftTuple tuple) {
             this.left = tuple.get( this.pattern.getOffset() ).getObject();
         }
 

Modified: labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/common/InstanceNotEqualsConstraint.java
===================================================================
--- labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/common/InstanceNotEqualsConstraint.java	2008-01-04 00:57:26 UTC (rev 17532)
+++ labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/common/InstanceNotEqualsConstraint.java	2008-01-04 01:54:45 UTC (rev 17533)
@@ -16,7 +16,7 @@
  * limitations under the License.
  */
 
-import org.drools.reteoo.ReteTuple;
+import org.drools.reteoo.LeftTuple;
 import org.drools.rule.Pattern;
 import org.drools.rule.ContextEntry;
 import org.drools.rule.Declaration;
@@ -62,7 +62,7 @@
         return ((InstanceNotEqualsConstraintContextEntry) context).left != handle.getObject();
     }
 
-    public boolean isAllowedCachedRight(final ReteTuple tuple,
+    public boolean isAllowedCachedRight(final LeftTuple tuple,
                                         final ContextEntry context) {
         return tuple.get( this.otherPattern.getOffset() ).getObject() != ((InstanceNotEqualsConstraintContextEntry) context).right;
     }
@@ -116,7 +116,7 @@
         }
 
         public void updateFromTuple(final InternalWorkingMemory workingMemory,
-                                    final ReteTuple tuple) {
+                                    final LeftTuple tuple) {
             this.left = tuple.get( this.pattern.getOffset() ).getObject();
         }
 

Modified: labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/common/PropagationContextImpl.java
===================================================================
--- labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/common/PropagationContextImpl.java	2008-01-04 00:57:26 UTC (rev 17532)
+++ labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/common/PropagationContextImpl.java	2008-01-04 01:54:45 UTC (rev 17533)
@@ -16,7 +16,7 @@
  * limitations under the License.
  */
 
-import org.drools.reteoo.ReteTuple;
+import org.drools.reteoo.LeftTuple;
 import org.drools.rule.EntryPoint;
 import org.drools.rule.Rule;
 import org.drools.spi.Activation;
@@ -119,7 +119,7 @@
             this.retracted = new ObjectHashMap();
         }
 
-        ReteTuple tuple = (ReteTuple) activation.getTuple();
+        LeftTuple tuple = (LeftTuple) activation.getTuple();
 
         ObjectHashMap tuples = (ObjectHashMap) this.retracted.get( rule );
         if ( tuples == null ) {
@@ -132,7 +132,7 @@
     }
 
     public Activation removeRetractedTuple(final Rule rule,
-                                           final ReteTuple tuple) {
+                                           final LeftTuple tuple) {
         if ( this.retracted == null ) {
             return null;
         }

Modified: labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/common/QuadroupleBetaConstraints.java
===================================================================
--- labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/common/QuadroupleBetaConstraints.java	2008-01-04 00:57:26 UTC (rev 17532)
+++ labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/common/QuadroupleBetaConstraints.java	2008-01-04 01:54:45 UTC (rev 17533)
@@ -23,9 +23,10 @@
 import org.drools.RuleBaseConfiguration;
 import org.drools.base.evaluators.Operator;
 import org.drools.reteoo.BetaMemory;
-import org.drools.reteoo.FactHandleMemory;
-import org.drools.reteoo.ReteTuple;
-import org.drools.reteoo.TupleMemory;
+import org.drools.reteoo.RightTuple;
+import org.drools.reteoo.RightTupleMemory;
+import org.drools.reteoo.LeftTuple;
+import org.drools.reteoo.LeftTupleMemory;
 import org.drools.rule.ContextEntry;
 import org.drools.rule.VariableConstraint;
 import org.drools.spi.BetaNodeFieldConstraint;
@@ -174,7 +175,7 @@
      * @see org.drools.common.BetaNodeConstraints#updateFromTuple(org.drools.reteoo.ReteTuple)
      */
     public void updateFromTuple(final InternalWorkingMemory workingMemory,
-                                final ReteTuple tuple) {
+                                final LeftTuple tuple) {
         this.context0.updateFromTuple( workingMemory,
                                        tuple );
         this.context1.updateFromTuple( workingMemory,
@@ -188,16 +189,16 @@
     /* (non-Javadoc)
      * @see org.drools.common.BetaNodeConstraints#updateFromFactHandle(org.drools.common.InternalFactHandle)
      */
-    public void updateFromFactHandle(final InternalWorkingMemory workingMemory,
-                                     final InternalFactHandle handle) {
+    public void updateFromRightTuple(final InternalWorkingMemory workingMemory,
+                                     final RightTuple rightTuple) {
         this.context0.updateFromFactHandle( workingMemory,
-                                            handle );
+                                            rightTuple.getHandle() );
         this.context1.updateFromFactHandle( workingMemory,
-                                            handle );
+                                            rightTuple.getHandle() );
         this.context2.updateFromFactHandle( workingMemory,
-                                            handle );
+                                            rightTuple.getHandle() );
         this.context3.updateFromFactHandle( workingMemory,
-                                            handle );
+                                            rightTuple.getHandle() );
     }
 
     /* (non-Javadoc)
@@ -220,7 +221,7 @@
     /* (non-Javadoc)
      * @see org.drools.common.BetaNodeConstraints#isAllowedCachedRight(org.drools.reteoo.ReteTuple)
      */
-    public boolean isAllowedCachedRight(final ReteTuple tuple) {
+    public boolean isAllowedCachedRight(final LeftTuple tuple) {
         return this.constraint0.isAllowedCachedRight( tuple,
                                                       this.context0 ) && this.constraint1.isAllowedCachedRight( tuple,
                                                                                                                 this.context1 ) && this.constraint2.isAllowedCachedRight( tuple,
@@ -294,24 +295,24 @@
 
         if ( !list.isEmpty() ) {
             final FieldIndex[] indexes = (FieldIndex[]) list.toArray( new FieldIndex[list.size()] );
-            TupleMemory tupleMemory;
+            LeftTupleMemory tupleMemory;
             if ( conf.isIndexLeftBetaMemory() ) {
                 tupleMemory = new TupleIndexHashTable( indexes );
             } else {
                 tupleMemory = new TupleHashTable();
             }
 
-            FactHandleMemory factHandleMemory;
+            RightTupleMemory factHandleMemory;
             if ( conf.isIndexRightBetaMemory() ) {
                 factHandleMemory = new FactHandleIndexHashTable( indexes );
             } else {
-                factHandleMemory = conf.isSequential() ? (FactHandleMemory) new FactList() : (FactHandleMemory) new FactHashTable();
+                factHandleMemory = conf.isSequential() ? (RightTupleMemory) new FactList() : (RightTupleMemory) new FactHashTable();
             }
             memory = new BetaMemory( conf.isSequential() ? null : tupleMemory,
                                      factHandleMemory );
         } else {
             memory = new BetaMemory( conf.isSequential() ? null : new TupleHashTable(),
-                                     conf.isSequential() ? (FactHandleMemory) new FactList() : (FactHandleMemory) new FactHashTable() );
+                                     conf.isSequential() ? (RightTupleMemory) new FactList() : (RightTupleMemory) new FactHashTable() );
         }
 
         return memory;

Modified: labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/common/ScheduledAgendaItem.java
===================================================================
--- labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/common/ScheduledAgendaItem.java	2008-01-04 00:57:26 UTC (rev 17532)
+++ labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/common/ScheduledAgendaItem.java	2008-01-04 01:54:45 UTC (rev 17533)
@@ -25,8 +25,8 @@
 import org.drools.spi.AgendaGroup;
 import org.drools.spi.PropagationContext;
 import org.drools.spi.Tuple;
+import org.drools.util.Entry;
 import org.drools.util.LinkedList;
-import org.drools.util.LinkedListNode;
 
 /**
  * Item entry in the <code>Agenda</code>.
@@ -37,7 +37,7 @@
     implements
     Activation,
     Serializable,
-    LinkedListNode {
+    Entry {
     // ------------------------------------------------------------
     // Instance members
     // ------------------------------------------------------------
@@ -47,10 +47,10 @@
      */
     private static final long        serialVersionUID = 400L;
 
-    private LinkedListNode           previous;
+    private Entry                    previous;
 
-    private LinkedListNode           next;
-
+    private Entry                    next;
+ 
     /** The tuple. */
     private final Tuple              tuple;
 
@@ -139,19 +139,19 @@
         return this.activationNumber;
     }
 
-    public LinkedListNode getNext() {
+    public Entry getNext() {
         return this.next;
     }
 
-    public void setNext(final LinkedListNode next) {
+    public void setNext(final Entry next) {
         this.next = next;
     }
 
-    public LinkedListNode getPrevious() {
+    public Entry getPrevious() {
         return this.previous;
     }
 
-    public void setPrevious(final LinkedListNode previous) {
+    public void setPrevious(final Entry previous) {
         this.previous = previous;
     }
 

Modified: labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/common/SingleBetaConstraints.java
===================================================================
--- labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/common/SingleBetaConstraints.java	2008-01-04 00:57:26 UTC (rev 17532)
+++ labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/common/SingleBetaConstraints.java	2008-01-04 01:54:45 UTC (rev 17533)
@@ -21,9 +21,10 @@
 import org.drools.RuleBaseConfiguration;
 import org.drools.base.evaluators.Operator;
 import org.drools.reteoo.BetaMemory;
-import org.drools.reteoo.FactHandleMemory;
-import org.drools.reteoo.ReteTuple;
-import org.drools.reteoo.TupleMemory;
+import org.drools.reteoo.RightTuple;
+import org.drools.reteoo.RightTupleMemory;
+import org.drools.reteoo.LeftTuple;
+import org.drools.reteoo.LeftTupleMemory;
 import org.drools.rule.ContextEntry;
 import org.drools.rule.VariableConstraint;
 import org.drools.spi.BetaNodeFieldConstraint;
@@ -96,7 +97,7 @@
      * @see org.drools.common.BetaNodeConstraints#updateFromTuple(org.drools.reteoo.ReteTuple)
      */
     public void updateFromTuple(final InternalWorkingMemory workingMemory,
-                                final ReteTuple tuple) {
+                                final LeftTuple tuple) {
         this.context.updateFromTuple( workingMemory,
                                       tuple );
     }
@@ -104,10 +105,10 @@
     /* (non-Javadoc)
      * @see org.drools.common.BetaNodeConstraints#updateFromFactHandle(org.drools.common.InternalFactHandle)
      */
-    public void updateFromFactHandle(final InternalWorkingMemory workingMemory,
-                                     final InternalFactHandle handle) {
+    public void updateFromRightTuple(final InternalWorkingMemory workingMemory,
+                                     final RightTuple rightTuple) {
         this.context.updateFromFactHandle( workingMemory,
-                                           handle );
+                                           rightTuple.getHandle() );
     }
 
     /* (non-Javadoc)
@@ -121,7 +122,7 @@
     /* (non-Javadoc)
      * @see org.drools.common.BetaNodeConstraints#isAllowedCachedRight(org.drools.reteoo.ReteTuple)
      */
-    public boolean isAllowedCachedRight(final ReteTuple tuple) {
+    public boolean isAllowedCachedRight(final LeftTuple tuple) {
         return this.constraint.isAllowedCachedRight( tuple,
                                                      this.context );
     }
@@ -145,14 +146,14 @@
             final FieldIndex index = new FieldIndex( variableConstraint.getFieldExtractor(),
                                                      variableConstraint.getRequiredDeclarations()[0],
                                                      variableConstraint.getEvaluator() );
-            TupleMemory tupleMemory;
+            LeftTupleMemory tupleMemory;
             if ( this.conf.isIndexLeftBetaMemory() ) {
                 tupleMemory = new TupleIndexHashTable( new FieldIndex[]{index} );
             } else {
                 tupleMemory = new TupleHashTable();
             }
 
-            FactHandleMemory factHandleMemory;
+            RightTupleMemory factHandleMemory;
             if ( this.conf.isIndexRightBetaMemory() ) {
                 factHandleMemory = new FactHandleIndexHashTable( new FieldIndex[]{index} );
             } else {

Modified: labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/common/TripleBetaConstraints.java
===================================================================
--- labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/common/TripleBetaConstraints.java	2008-01-04 00:57:26 UTC (rev 17532)
+++ labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/common/TripleBetaConstraints.java	2008-01-04 01:54:45 UTC (rev 17533)
@@ -23,9 +23,10 @@
 import org.drools.RuleBaseConfiguration;
 import org.drools.base.evaluators.Operator;
 import org.drools.reteoo.BetaMemory;
-import org.drools.reteoo.FactHandleMemory;
-import org.drools.reteoo.ReteTuple;
-import org.drools.reteoo.TupleMemory;
+import org.drools.reteoo.RightTuple;
+import org.drools.reteoo.RightTupleMemory;
+import org.drools.reteoo.LeftTuple;
+import org.drools.reteoo.LeftTupleMemory;
 import org.drools.rule.ContextEntry;
 import org.drools.rule.VariableConstraint;
 import org.drools.spi.BetaNodeFieldConstraint;
@@ -144,7 +145,7 @@
      * @see org.drools.common.BetaNodeConstraints#updateFromTuple(org.drools.reteoo.ReteTuple)
      */
     public void updateFromTuple(final InternalWorkingMemory workingMemory,
-                                final ReteTuple tuple) {
+                                final LeftTuple tuple) {
         this.context0.updateFromTuple( workingMemory,
                                        tuple );
         this.context1.updateFromTuple( workingMemory,
@@ -156,14 +157,14 @@
     /* (non-Javadoc)
      * @see org.drools.common.BetaNodeConstraints#updateFromFactHandle(org.drools.common.InternalFactHandle)
      */
-    public void updateFromFactHandle(final InternalWorkingMemory workingMemory,
-                                     final InternalFactHandle handle) {
+    public void updateFromRightTuple(final InternalWorkingMemory workingMemory,
+                                     final RightTuple rightTuple) {
         this.context0.updateFromFactHandle( workingMemory,
-                                            handle );
+                                            rightTuple.getHandle() );
         this.context1.updateFromFactHandle( workingMemory,
-                                            handle );
+                                            rightTuple.getHandle() );
         this.context2.updateFromFactHandle( workingMemory,
-                                            handle );
+                                            rightTuple.getHandle() );
     }
 
     /* (non-Javadoc)
@@ -184,7 +185,7 @@
     /* (non-Javadoc)
      * @see org.drools.common.BetaNodeConstraints#isAllowedCachedRight(org.drools.reteoo.ReteTuple)
      */
-    public boolean isAllowedCachedRight(final ReteTuple tuple) {
+    public boolean isAllowedCachedRight(final LeftTuple tuple) {
         return this.constraint0.isAllowedCachedRight( tuple,
                                                       this.context0 ) && this.constraint1.isAllowedCachedRight( tuple,
                                                                                                                 this.context1 ) && this.constraint2.isAllowedCachedRight( tuple,
@@ -245,24 +246,24 @@
 
         if ( !list.isEmpty() ) {
             final FieldIndex[] indexes = (FieldIndex[]) list.toArray( new FieldIndex[list.size()] );
-            TupleMemory tupleMemory;
+            LeftTupleMemory tupleMemory;
             if ( conf.isIndexLeftBetaMemory() ) {
                 tupleMemory = new TupleIndexHashTable( indexes );
             } else {
                 tupleMemory = new TupleHashTable();
             }
 
-            FactHandleMemory factHandleMemory;
+            RightTupleMemory factHandleMemory;
             if ( conf.isIndexRightBetaMemory() ) {
                 factHandleMemory = new FactHandleIndexHashTable( indexes );
             } else {
-                factHandleMemory = conf.isSequential() ? (FactHandleMemory) new FactList() : (FactHandleMemory) new FactHashTable();
+                factHandleMemory = conf.isSequential() ? (RightTupleMemory) new FactList() : (RightTupleMemory) new FactHashTable();
             }
             memory = new BetaMemory( conf.isSequential() ? null : tupleMemory,
                                      factHandleMemory );
         } else {
             memory = new BetaMemory( conf.isSequential() ? null : new TupleHashTable(),
-                                     conf.isSequential() ? (FactHandleMemory) new FactList() : (FactHandleMemory) new FactHashTable() );
+                                     conf.isSequential() ? (RightTupleMemory) new FactList() : (RightTupleMemory) new FactHashTable() );
         }
 
         return memory;

Modified: labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/common/TupleStartEqualsConstraint.java
===================================================================
--- labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/common/TupleStartEqualsConstraint.java	2008-01-04 00:57:26 UTC (rev 17532)
+++ labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/common/TupleStartEqualsConstraint.java	2008-01-04 01:54:45 UTC (rev 17533)
@@ -16,7 +16,7 @@
 
 package org.drools.common;
 
-import org.drools.reteoo.ReteTuple;
+import org.drools.reteoo.LeftTuple;
 import org.drools.rule.ContextEntry;
 import org.drools.rule.Declaration;
 import org.drools.spi.BetaNodeFieldConstraint;
@@ -76,11 +76,11 @@
     public boolean isAllowedCachedLeft(final ContextEntry context,
                                        final InternalFactHandle handle) {
         // object MUST be a ReteTuple
-        final ReteTuple tuple = ((ReteTuple) handle.getObject()).getSubTuple( ((TupleStartEqualsConstraintContextEntry) context).compareSize );
+        final LeftTuple tuple = ((LeftTuple) handle.getObject()).getSubTuple( ((TupleStartEqualsConstraintContextEntry) context).compareSize );
         return ((TupleStartEqualsConstraintContextEntry) context).left.equals( tuple );
     }
 
-    public boolean isAllowedCachedRight(final ReteTuple tuple,
+    public boolean isAllowedCachedRight(final LeftTuple tuple,
                                         final ContextEntry context) {
         return tuple.equals( ((TupleStartEqualsConstraintContextEntry) context).right.getSubTuple( tuple.size() ) );
     }
@@ -110,8 +110,8 @@
 
         private static final long serialVersionUID = 400L;
 
-        public ReteTuple          left;
-        public ReteTuple          right;
+        public LeftTuple          left;
+        public LeftTuple          right;
 
         // the size of the tuple to compare
         public int                compareSize;
@@ -130,7 +130,7 @@
         }
 
         public void updateFromTuple(final InternalWorkingMemory workingMemory,
-                                    final ReteTuple tuple) {
+                                    final LeftTuple tuple) {
             this.left = tuple;
             this.compareSize = tuple.size();
         }
@@ -139,7 +139,7 @@
                                          final InternalFactHandle handle) {
             // if it is not a rete tuple, then there is a bug in the engine...
             // it MUST be a rete tuple
-            this.right = (ReteTuple) handle.getObject();
+            this.right = (LeftTuple) handle.getObject();
         }
     }
 }

Modified: labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/conflict/TotalRecencyConflictResolver.java
===================================================================
--- labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/conflict/TotalRecencyConflictResolver.java	2008-01-04 00:57:26 UTC (rev 17532)
+++ labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/conflict/TotalRecencyConflictResolver.java	2008-01-04 01:54:45 UTC (rev 17533)
@@ -16,7 +16,7 @@
 
 package org.drools.conflict;
 
-import org.drools.reteoo.ReteTuple;
+import org.drools.reteoo.LeftTuple;
 import org.drools.spi.Activation;
 import org.drools.spi.ConflictResolver;
 
@@ -73,10 +73,10 @@
                        final Activation rhs) {
         long leftRecency = 0;
         long rightRecency = 0;
-        if ( lhs.getTuple() instanceof ReteTuple ) {
+        if ( lhs.getTuple() instanceof LeftTuple ) {
             leftRecency = (lhs.getTuple()).getRecency();
         }
-        if ( rhs.getTuple() instanceof ReteTuple ) {
+        if ( rhs.getTuple() instanceof LeftTuple ) {
             rightRecency = (rhs.getTuple()).getRecency();
         }
         return (rightRecency > leftRecency) ? 1 : (rightRecency < leftRecency) ? -1 : 0;

Modified: labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/AccumulateNode.java
===================================================================
--- labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/AccumulateNode.java	2008-01-04 00:57:26 UTC (rev 17532)
+++ labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/AccumulateNode.java	2008-01-04 01:54:45 UTC (rev 17533)
@@ -52,8 +52,8 @@
     private final BetaConstraints            resultBinder;
 
     public AccumulateNode(final int id,
-                          final TupleSource leftInput,
-                          final ObjectSource rightInput,
+                          final LeftTupleSource leftInput,
+                          final RightTupleSource rightInput,
                           final AlphaNodeFieldConstraint[] resultConstraints,
                           final BetaConstraints sourceBinder,
                           final BetaConstraints resultBinder,
@@ -90,7 +90,7 @@
      *   Object result = this.accumulator.accumulate( ... );
      *  
      */
-    public void assertTuple(final ReteTuple leftTuple,
+    public void assertTuple(final LeftTuple leftTuple,
                             final PropagationContext context,
                             final InternalWorkingMemory workingMemory) {
 
@@ -99,7 +99,7 @@
         AccumulateResult accresult = new AccumulateResult();
 
         if ( this.tupleMemoryEnabled ) {
-            memory.betaMemory.getTupleMemory().add( leftTuple );
+            memory.betaMemory.getLeftTupleMemory().add( leftTuple );
             memory.betaMemory.getCreatedHandles().put( leftTuple,
                                             accresult,
                                             false );
@@ -113,7 +113,7 @@
                               leftTuple,
                               workingMemory );
 
-        final Iterator it = memory.betaMemory.getFactHandleMemory().iterator( leftTuple );
+        final Iterator it = memory.betaMemory.getRightTupleMemory().iterator( leftTuple );
         this.constraints.updateFromTuple( workingMemory,
                                           leftTuple );
 
@@ -122,7 +122,7 @@
             if ( this.constraints.isAllowedCachedLeft( handle ) ) {
                 if ( this.unwrapRightObject ) {
                     // if there is a subnetwork, handle must be unwrapped
-                    ReteTuple tuple = (ReteTuple) handle.getObject(); 
+                    LeftTuple tuple = (LeftTuple) handle.getObject(); 
                     handle = tuple.getLastHandle();
                     this.accumulate.accumulate( memory.workingMemoryContext,
                                                 accContext,
@@ -185,11 +185,11 @@
      * it must always also retreat it.
      * 
      */
-    public void retractTuple(final ReteTuple leftTuple,
+    public void retractTuple(final LeftTuple leftTuple,
                              final PropagationContext context,
                              final InternalWorkingMemory workingMemory) {
         final AccumulateMemory memory = (AccumulateMemory) workingMemory.getNodeMemory( this );
-        memory.betaMemory.getTupleMemory().remove( leftTuple );
+        memory.betaMemory.getLeftTupleMemory().remove( leftTuple );
         final AccumulateResult accresult = (AccumulateResult) memory.betaMemory.getCreatedHandles().remove( leftTuple );
 
         // if tuple was propagated
@@ -214,30 +214,30 @@
      *  2. For each matching tuple, call a modify tuple
      *  
      */
-    public void assertObject(final InternalFactHandle handle,
+    public void assertRightTuple(final RightTuple rightTuple,
                              final PropagationContext context,
                              final InternalWorkingMemory workingMemory) {
 
         final AccumulateMemory memory = (AccumulateMemory) workingMemory.getNodeMemory( this );
-        memory.betaMemory.getFactHandleMemory().add( handle );
+        memory.betaMemory.getRightTupleMemory().add( rightTuple );
 
         if ( ! this.tupleMemoryEnabled ) {
             // do nothing here, as we know there are no left tuples at this stage in sequential mode.
             return;
         }
 
-        this.constraints.updateFromFactHandle( workingMemory,
-                                               handle );
+        this.constraints.updateFromRightTuple( workingMemory,
+                                               rightTuple );
 
         // need to clone the tuples to avoid concurrent modification exceptions
-        Entry[] tuples = memory.betaMemory.getTupleMemory().toArray();
+        Entry[] tuples = memory.betaMemory.getLeftTupleMemory().toArray();
         for ( int i = 0; i < tuples.length; i++ ) {
-            ReteTuple tuple = (ReteTuple) tuples[i];
+            LeftTuple tuple = (LeftTuple) tuples[i];
             if ( this.constraints.isAllowedCachedRight( tuple ) ) {
                 if ( this.accumulate.supportsReverse() || context.getType() == PropagationContext.ASSERTION ) {
                     modifyTuple( true,
                                  tuple,
-                                 handle,
+                                 rightTuple,
                                  context,
                                  workingMemory );
                 } else {
@@ -259,25 +259,25 @@
      *  If an object is retract, call modify tuple for each
      *  tuple match.
      */
-    public void retractObject(final InternalFactHandle handle,
+    public void retractRightTuple(final RightTuple rightTuple,
                               final PropagationContext context,
                               final InternalWorkingMemory workingMemory) {
         final AccumulateMemory memory = (AccumulateMemory) workingMemory.getNodeMemory( this );
-        if ( !memory.betaMemory.getFactHandleMemory().remove( handle ) ) {
+        if ( !memory.betaMemory.getRightTupleMemory().remove( rightTuple ) ) {
             return;
         }
 
-        this.constraints.updateFromFactHandle( workingMemory,
-                                               handle );
+        this.constraints.updateFromRightTuple( workingMemory,
+                                               rightTuple );
         // need to clone the tuples to avoid concurrent modification exceptions
-        Entry[] tuples = memory.betaMemory.getTupleMemory().toArray();
+        Entry[] tuples = memory.betaMemory.getLeftTupleMemory().toArray();
         for ( int i = 0; i < tuples.length; i++ ) {
-            ReteTuple tuple = (ReteTuple) tuples[i];
+            LeftTuple tuple = (LeftTuple) tuples[i];
             if ( this.constraints.isAllowedCachedRight( tuple ) ) {
                 if ( this.accumulate.supportsReverse() ) {
                     this.modifyTuple( false,
                                       tuple,
-                                      handle,
+                                      rightTuple,
                                       context,
                                       workingMemory );
                 } else {
@@ -293,7 +293,7 @@
     }
 
     public void modifyTuple(final boolean isAssert,
-                            final ReteTuple leftTuple,
+                            final LeftTuple leftTuple,
                             InternalFactHandle handle,
                             final PropagationContext context,
                             final InternalWorkingMemory workingMemory) {
@@ -313,10 +313,10 @@
             accresult.handle = null;
         }
 
-        ReteTuple tuple = leftTuple;
+        LeftTuple tuple = leftTuple;
         if ( this.unwrapRightObject ) {
             // if there is a subnetwork, handle must be unwrapped
-            tuple = (ReteTuple) handle.getObject();
+            tuple = (LeftTuple) handle.getObject();
             handle = tuple.getLastHandle();
         }
 
@@ -399,7 +399,7 @@
         }
     }
 
-    public void updateSink(final TupleSink sink,
+    public void updateSink(final LeftTupleSink sink,
                            final PropagationContext context,
                            final InternalWorkingMemory workingMemory) {
         final AccumulateMemory memory = (AccumulateMemory) workingMemory.getNodeMemory( this );
@@ -408,7 +408,7 @@
 
         for ( ObjectEntry entry = (ObjectEntry) it.next(); entry != null; entry = (ObjectEntry) it.next() ) {
             AccumulateResult accresult = (AccumulateResult) entry.getValue();
-            sink.assertTuple( new ReteTuple( (ReteTuple) entry.getKey(),
+            sink.assertTuple( new LeftTuple( (LeftTuple) entry.getKey(),
                                              accresult.handle ),
                               context,
                               workingMemory );

Modified: labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/AlphaNode.java
===================================================================
--- labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/AlphaNode.java	2008-01-04 00:57:26 UTC (rev 17532)
+++ labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/AlphaNode.java	2008-01-04 01:54:45 UTC (rev 17533)
@@ -25,7 +25,6 @@
 import org.drools.reteoo.builder.BuildContext;
 import org.drools.spi.AlphaNodeFieldConstraint;
 import org.drools.spi.PropagationContext;
-import org.drools.util.FactEntry;
 import org.drools.util.FactHashTable;
 import org.drools.util.Iterator;
 
@@ -40,9 +39,9 @@
  * @author <a href="mailto:bob at werken.com">Bob McWhirter</a>
  *
  */
-public class AlphaNode extends ObjectSource
+public class AlphaNode extends RightTupleSource
     implements
-    ObjectSinkNode,
+    RightTupleSinkNode,
     NodeMemory {
 
     /**
@@ -53,12 +52,12 @@
     /** The <code>FieldConstraint</code> */
     private final AlphaNodeFieldConstraint constraint;
 
-    private ObjectSinkNode                 previousObjectSinkNode;
-    private ObjectSinkNode                 nextObjectSinkNode;
+    private RightTupleSinkNode                 previousRightTupleSinkNode;
+    private RightTupleSinkNode                 nextRightTupleNode;
 
-    private boolean                        objectMemoryEnabled;
+    private boolean                        rightTupleMemoryEnabled;
 
-    private boolean                        objectMemoryAllowed;
+    private boolean                        rightTupleMemoryAllowed;
 
     /**
      * Construct an <code>AlphaNode</code> with a unique id using the provided
@@ -74,17 +73,17 @@
      */
     public AlphaNode(final int id,
                      final AlphaNodeFieldConstraint constraint,
-                     final ObjectSource objectSource,
+                     final RightTupleSource objectSource,
                      final BuildContext context) {
         super( id,
                objectSource,
                context.getRuleBase().getConfiguration().getAlphaNodeHashingThreshold() );
         this.constraint = constraint;
-        this.objectMemoryAllowed = context.isAlphaMemoryAllowed();
-        if ( this.objectMemoryAllowed ) {
-            this.objectMemoryEnabled = context.getRuleBase().getConfiguration().isAlphaMemory();
+        this.rightTupleMemoryAllowed = context.isAlphaMemoryAllowed();
+        if ( this.rightTupleMemoryAllowed ) {
+            this.rightTupleMemoryEnabled = context.getRuleBase().getConfiguration().isAlphaMemory();
         } else {
-            this.objectMemoryEnabled = false;
+            this.rightTupleMemoryEnabled = false;
         }
     }
 
@@ -111,8 +110,8 @@
 
         // we are attaching this node with existing working memories
         // indicating that we are in a dynamic environment, that might benefit from alpha node memory, if allowed
-        if ( this.objectMemoryAllowed ) {
-            setObjectMemoryEnabled( true );
+        if ( this.rightTupleMemoryAllowed ) {
+            setRightTupleMemoryEnabled( true );
         }
         for ( int i = 0, length = workingMemories.length; i < length; i++ ) {
             final InternalWorkingMemory workingMemory = workingMemories[i];
@@ -126,50 +125,50 @@
         }
     }
 
-    public void assertObject(final InternalFactHandle handle,
+    public void assertRightTuple(final RightTuple rightTuple,
                              final PropagationContext context,
                              final InternalWorkingMemory workingMemory) throws FactException {
-        if ( this.constraint.isAllowed( handle,
+        if ( this.constraint.isAllowed( rightTuple.getHandle(),
                                         workingMemory ) ) {
-            if ( isObjectMemoryEnabled() ) {
+            if ( isRightTupleMemoryEnabled() ) {
                 final FactHashTable memory = (FactHashTable) workingMemory.getNodeMemory( this );
-                memory.add( handle,
+                memory.add( rightTuple,
                             false );
             }
 
-            this.sink.propagateAssertObject( handle,
+            this.sink.propagateAssertRightTuple( rightTuple,
                                              context,
                                              workingMemory );
         }
     }
 
-    public void retractObject(final InternalFactHandle handle,
+    public void retractRightTuple(final RightTuple rightTuple,
                               final PropagationContext context,
                               final InternalWorkingMemory workingMemory) {
         boolean propagate = true;
-        if ( isObjectMemoryEnabled() ) {
+        if ( isRightTupleMemoryEnabled() ) {
             final FactHashTable memory = (FactHashTable) workingMemory.getNodeMemory( this );
-            propagate = memory.remove( handle );
+            propagate = memory.remove( rightTuple );
         } else {
-            propagate = this.constraint.isAllowed( handle,
+            propagate = this.constraint.isAllowed( rightTuple.getHandle(),
                                                    workingMemory );
         }
         if ( propagate ) {
-            this.sink.propagateRetractObject( handle,
+            this.sink.propagateRetractRightTuple( rightTuple,
                                               context,
                                               workingMemory,
                                               true );
         }
     }
 
-    public void updateSink(final ObjectSink sink,
+    public void updateSink(final RightTupleSink sink,
                            final PropagationContext context,
                            final InternalWorkingMemory workingMemory) {
         FactHashTable memory = null;
 
-        if ( !isObjectMemoryEnabled() ) {
+        if ( !isRightTupleMemoryEnabled() ) {
             // get the objects from the parent
-            ObjectSinkUpdateAdapter adapter = new ObjectSinkUpdateAdapter( sink, this.constraint );
+            RightTupleSinkUpdateAdapter adapter = new RightTupleSinkUpdateAdapter( sink, this.constraint );
             this.objectSource.updateSink( adapter,
                                           context,
                                           workingMemory );
@@ -177,8 +176,8 @@
             // if already has memory, just iterate and propagate
             memory = (FactHashTable) workingMemory.getNodeMemory( this );
             final Iterator it = memory.iterator();
-            for ( FactEntry entry = (FactEntry) it.next(); entry != null; entry = (FactEntry) it.next() ) {
-                sink.assertObject( entry.getFactHandle(),
+            for ( RightTuple entry = (RightTuple) it.next(); entry != null; entry = (RightTuple) it.next() ) {
+                sink.assertRightTuple( entry,
                                    context,
                                    workingMemory );
             }
@@ -189,7 +188,7 @@
                        final InternalWorkingMemory[] workingMemories) {
 
         if ( !node.isInUse() ) {
-            removeObjectSink( (ObjectSink) node );
+            removeObjectSink( (RightTupleSink) node );
         }
         removeShare();
         if ( !this.isInUse() ) {
@@ -201,16 +200,16 @@
                                   workingMemories );
     }
 
-    public void setObjectMemoryAllowed(boolean objectMemoryAllowed) {
-        this.objectMemoryAllowed = objectMemoryAllowed;
+    public void setRightTupleMemoryAllowed(boolean objectMemoryAllowed) {
+        this.rightTupleMemoryAllowed = objectMemoryAllowed;
     }
 
-    public boolean isObjectMemoryEnabled() {
-        return this.objectMemoryEnabled;
+    public boolean isRightTupleMemoryEnabled() {
+        return this.rightTupleMemoryEnabled;
     }
 
-    public void setObjectMemoryEnabled(boolean objectMemoryEnabled) {
-        this.objectMemoryEnabled = objectMemoryEnabled;
+    public void setRightTupleMemoryEnabled(boolean objectMemoryEnabled) {
+        this.rightTupleMemoryEnabled = objectMemoryEnabled;
     }
 
     /**
@@ -223,7 +222,7 @@
     /** 
      * @inheritDoc
      */
-    protected void addObjectSink(final ObjectSink objectSink) {
+    protected void addObjectSink(final RightTupleSink objectSink) {
         super.addObjectSink( objectSink );
     }
 
@@ -259,8 +258,8 @@
      * @return
      *      The next ObjectSinkNode
      */
-    public ObjectSinkNode getNextObjectSinkNode() {
-        return this.nextObjectSinkNode;
+    public RightTupleSinkNode getNextRightTupleSinkNode() {
+        return this.nextRightTupleNode;
     }
 
     /**
@@ -268,8 +267,8 @@
      * @param next
      *      The next ObjectSinkNode
      */
-    public void setNextObjectSinkNode(final ObjectSinkNode next) {
-        this.nextObjectSinkNode = next;
+    public void setNextRightTupleSinkNode(final RightTupleSinkNode next) {
+        this.nextRightTupleNode = next;
     }
 
     /**
@@ -277,8 +276,8 @@
      * @return
      *      The previous ObjectSinkNode
      */
-    public ObjectSinkNode getPreviousObjectSinkNode() {
-        return this.previousObjectSinkNode;
+    public RightTupleSinkNode getPreviousRightTupleSinkNode() {
+        return this.previousRightTupleSinkNode;
     }
 
     /**
@@ -286,8 +285,8 @@
      * @param previous
      *      The previous ObjectSinkNode
      */
-    public void setPreviousObjectSinkNode(final ObjectSinkNode previous) {
-        this.previousObjectSinkNode = previous;
+    public void setPreviousRightTupleSinkNode(final RightTupleSinkNode previous) {
+        this.previousRightTupleSinkNode = previous;
     }
 
     /**
@@ -296,24 +295,24 @@
      * @author mproctor
      *
      */
-    private static class ObjectSinkUpdateAdapter
+    private static class RightTupleSinkUpdateAdapter
         implements
-        ObjectSink {
-        private final ObjectSink sink;
+        RightTupleSink {
+        private final RightTupleSink sink;
         private final AlphaNodeFieldConstraint constraint;
 
-        public ObjectSinkUpdateAdapter(final ObjectSink sink, 
+        public RightTupleSinkUpdateAdapter(final RightTupleSink sink, 
                                        final AlphaNodeFieldConstraint constraint ) {
             this.sink = sink;
             this.constraint = constraint;
         }
 
-        public void assertObject(final InternalFactHandle handle,
+        public void assertRightTuple(final RightTuple rightTuple,
                                  final PropagationContext context,
                                  final InternalWorkingMemory workingMemory) {
-            if ( this.constraint.isAllowed( handle,
+            if ( this.constraint.isAllowed( rightTuple.getHandle(),
                                             workingMemory ) ) {
-                this.sink.assertObject( handle,
+                this.sink.assertRightTuple( rightTuple,
                                         context,
                                         workingMemory );
             }
@@ -325,17 +324,17 @@
             throw new UnsupportedOperationException( "ObjectSinkUpdateAdapter onlys supports assertObject method calls" );
         }
 
-        public void retractObject(final InternalFactHandle handle,
+        public void retractRightTuple(final RightTuple rightTuple,
                                   final PropagationContext context,
                                   final InternalWorkingMemory workingMemory) {
             throw new UnsupportedOperationException( "ObjectSinkUpdateAdapter onlys supports assertObject method calls" );
         }
 
-        public boolean isObjectMemoryEnabled() {
+        public boolean isRightTupleMemoryEnabled() {
             throw new UnsupportedOperationException( "ObjectSinkUpdateAdapter have no Object memory" );
         }
 
-        public void setObjectMemoryEnabled(boolean objectMemoryEnabled) {
+        public void setRightTupleMemoryEnabled(boolean objectMemoryEnabled) {
             throw new UnsupportedOperationException( "ObjectSinkUpdateAdapter have no Object memory" );
         }
     }

Modified: labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/BetaMemory.java
===================================================================
--- labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/BetaMemory.java	2008-01-04 00:57:26 UTC (rev 17532)
+++ labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/BetaMemory.java	2008-01-04 01:54:45 UTC (rev 17533)
@@ -4,34 +4,32 @@
 
 import org.drools.util.ObjectHashMap;
 
-public class BetaMemory
-    implements
-    Serializable {
+public class BetaMemory implements Serializable {
 
-    private static final long serialVersionUID = 400L;
+	private static final long serialVersionUID = 400L;
 
-    private TupleMemory       tupleMemory;
-    private FactHandleMemory  factHandleMemory;
-    private ObjectHashMap     createdHandles;
+	private LeftTupleMemory leftTupleMemory;
+	private RightTupleMemory rightTupleMemory;
+	private ObjectHashMap createdHandles;
 
-    public BetaMemory(final TupleMemory tupleMemory,
-                      final FactHandleMemory objectMemory) {
-        this.tupleMemory = tupleMemory;
-        this.factHandleMemory = objectMemory;
-    }
+	public BetaMemory(final LeftTupleMemory leftTupleMemory,
+		final RightTupleMemory rightTupleMemory) {
+		this.leftTupleMemory = leftTupleMemory;
+		this.rightTupleMemory = rightTupleMemory;
+	}
 
-    public FactHandleMemory getFactHandleMemory() {
-        return this.factHandleMemory;
-    }
+	public RightTupleMemory getRightTupleMemory() {
+		return this.rightTupleMemory;
+	}
 
-    public TupleMemory getTupleMemory() {
-        return this.tupleMemory;
-    }
+	public LeftTupleMemory getLeftTupleMemory() {
+		return this.leftTupleMemory;
+	}
 
-    public ObjectHashMap getCreatedHandles() {
-        if ( this.createdHandles == null ) {
-            this.createdHandles = new ObjectHashMap();
-        }
-        return this.createdHandles;
-    }
+	public ObjectHashMap getCreatedHandles() {
+		if (this.createdHandles == null) {
+			this.createdHandles = new ObjectHashMap();
+		}
+		return this.createdHandles;
+	}
 }

Modified: labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/BetaNode.java
===================================================================
--- labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/BetaNode.java	2008-01-04 00:57:26 UTC (rev 17532)
+++ labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/BetaNode.java	2008-01-04 01:54:45 UTC (rev 17533)
@@ -35,35 +35,35 @@
  * both TupleSink and ObjectSink and as such can receive <code>Tuple</code>s and <code>FactHandle</code>s. BetaNode uses BetaMemory
  * to store the propagated instances.
  * 
- * @see org.drools.reteoo.TupleSource
- * @see org.drools.reteoo.TupleSink
+ * @see org.drools.reteoo.LeftTupleSource
+ * @see org.drools.reteoo.LeftTupleSink
  * @see org.drools.reteoo.BetaMemory
  * 
  * @author <a href="mailto:mark.proctor at jboss.com">Mark Proctor</a>
  * @author <a href="mailto:bob at werken.com">Bob McWhirter</a>
  */
-abstract class BetaNode extends TupleSource
+abstract class BetaNode extends LeftTupleSource
     implements
-    TupleSinkNode,
-    ObjectSinkNode,
+    LeftTupleSinkNode,
+    RightTupleSinkNode,
     NodeMemory {
     // ------------------------------------------------------------
     // Instance members
     // ------------------------------------------------------------
 
     /** The left input <code>TupleSource</code>. */
-    protected final TupleSource     leftInput;
+    protected final LeftTupleSource     leftInput;
 
     /** The right input <code>TupleSource</code>. */
-    protected final ObjectSource    rightInput;
+    protected final RightTupleSource    rightInput;
 
     protected final BetaConstraints constraints;
 
-    private TupleSinkNode           previousTupleSinkNode;
-    private TupleSinkNode           nextTupleSinkNode;
+    private LeftTupleSinkNode           previousTupleSinkNode;
+    private LeftTupleSinkNode           nextTupleSinkNode;
 
-    private ObjectSinkNode          previousObjectSinkNode;
-    private ObjectSinkNode          nextObjectSinkNode;
+    private RightTupleSinkNode          previousObjectSinkNode;
+    private RightTupleSinkNode          nextObjectSinkNode;
     
     protected boolean               objectMemory = true; // hard coded to true
     protected boolean               tupleMemoryEnabled;
@@ -81,8 +81,8 @@
      *            The right input <code>ObjectSource</code>.
      */
     BetaNode(final int id,
-             final TupleSource leftInput,
-             final ObjectSource rightInput,
+             final LeftTupleSource leftInput,
+             final RightTupleSource rightInput,
              final BetaConstraints constraints) {
         super( id );
         this.leftInput = leftInput;
@@ -116,7 +116,7 @@
     public List getRules() {
         final List list = new ArrayList();
 
-        final TupleSink[] sinks = this.sink.getSinks();
+        final LeftTupleSink[] sinks = this.sink.getSinks();
         for ( int i = 0, length = sinks.length; i < length; i++ ) {
             if ( sinks[i] instanceof RuleTerminalNode ) {
                 list.add( ((RuleTerminalNode) sinks[i]).getRule().getName() );
@@ -129,7 +129,7 @@
     }
 
     public ObjectTypeNode getObjectTypeNode() {
-        ObjectSource source = this.rightInput;
+        RightTupleSource source = this.rightInput;
         while ( !(source instanceof ObjectTypeNode) ) {
             source = source.objectSource;
         }
@@ -158,7 +158,7 @@
     public void remove(final BaseNode node,
                        final InternalWorkingMemory[] workingMemories) {
         if ( !node.isInUse() ) {
-            removeTupleSink( (TupleSink) node );
+            removeTupleSink( (LeftTupleSink) node );
         }
         removeShare();
 
@@ -174,11 +174,11 @@
 
     }
 
-    public boolean isObjectMemoryEnabled() {
+    public boolean isRightTupleMemoryEnabled() {
         return objectMemory;
     }
 
-    public void setObjectMemoryEnabled(boolean objectMemory) {
+    public void setRightTupleMemoryEnabled(boolean objectMemory) {
         this.objectMemory = objectMemory;
     }
     
@@ -235,7 +235,7 @@
      * @return
      *      The next TupleSinkNode
      */
-    public TupleSinkNode getNextTupleSinkNode() {
+    public LeftTupleSinkNode getNextLeftTupleSinkNode() {
         return this.nextTupleSinkNode;
     }
 
@@ -244,7 +244,7 @@
      * @param next
      *      The next TupleSinkNode
      */
-    public void setNextTupleSinkNode(final TupleSinkNode next) {
+    public void setNextLeftTupleSinkNode(final LeftTupleSinkNode next) {
         this.nextTupleSinkNode = next;
     }
 
@@ -253,7 +253,7 @@
      * @return
      *      The previous TupleSinkNode
      */
-    public TupleSinkNode getPreviousTupleSinkNode() {
+    public LeftTupleSinkNode getPreviousLeftTupleSinkNode() {
         return this.previousTupleSinkNode;
     }
 
@@ -262,7 +262,7 @@
      * @param previous
      *      The previous TupleSinkNode
      */
-    public void setPreviousTupleSinkNode(final TupleSinkNode previous) {
+    public void setPreviousLeftTupleSinkNode(final LeftTupleSinkNode previous) {
         this.previousTupleSinkNode = previous;
     }
 
@@ -271,7 +271,7 @@
      * @return
      *      The next ObjectSinkNode
      */
-    public ObjectSinkNode getNextObjectSinkNode() {
+    public RightTupleSinkNode getNextRightTupleSinkNode() {
         return this.nextObjectSinkNode;
     }
 
@@ -280,7 +280,7 @@
      * @param next
      *      The next ObjectSinkNode
      */
-    public void setNextObjectSinkNode(final ObjectSinkNode next) {
+    public void setNextRightTupleSinkNode(final RightTupleSinkNode next) {
         this.nextObjectSinkNode = next;
     }
 
@@ -289,7 +289,7 @@
      * @return
      *      The previous ObjectSinkNode
      */
-    public ObjectSinkNode getPreviousObjectSinkNode() {
+    public RightTupleSinkNode getPreviousRightTupleSinkNode() {
         return this.previousObjectSinkNode;
     }
 
@@ -298,7 +298,7 @@
      * @param previous
      *      The previous ObjectSinkNode
      */
-    public void setPreviousObjectSinkNode(final ObjectSinkNode previous) {
+    public void setPreviousRightTupleSinkNode(final RightTupleSinkNode previous) {
         this.previousObjectSinkNode = previous;
     }
 

Modified: labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/CollectNode.java
===================================================================
--- labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/CollectNode.java	2008-01-04 00:57:26 UTC (rev 17532)
+++ labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/CollectNode.java	2008-01-04 01:54:45 UTC (rev 17533)
@@ -38,8 +38,8 @@
  */
 public class CollectNode extends BetaNode
     implements
-    TupleSink,
-    ObjectSink {
+    LeftTupleSink,
+    RightTupleSink {
 
     private static final long                serialVersionUID = 400L;
 
@@ -67,8 +67,8 @@
      *            The collect conditional element
      */
     public CollectNode(final int id,
-                       final TupleSource leftInput,
-                       final ObjectSource rightInput,
+                       final LeftTupleSource leftInput,
+                       final RightTupleSource rightInput,
                        final AlphaNodeFieldConstraint[] resultConstraints,
                        final BetaConstraints sourceBinder,
                        final BetaConstraints resultsBinder,
@@ -99,7 +99,7 @@
      *  4.2. Propagate the tuple
      *  
      */
-    public void assertTuple(final ReteTuple leftTuple,
+    public void assertTuple(final LeftTuple leftTuple,
                             final PropagationContext context,
                             final InternalWorkingMemory workingMemory) {
 
@@ -113,14 +113,14 @@
         
         // do not add tuple and result to the memory in sequential mode
         if ( this.tupleMemoryEnabled ) {
-            memory.getTupleMemory().add( leftTuple );
+            memory.getLeftTupleMemory().add( leftTuple );
             memory.getCreatedHandles().put( leftTuple,
                                             colresult,
                                             false );
         }
 
 
-        final Iterator it = memory.getFactHandleMemory().iterator( leftTuple );
+        final Iterator it = memory.getRightTupleMemory().iterator( leftTuple );
         this.constraints.updateFromTuple( workingMemory,
                                           leftTuple );
 
@@ -128,7 +128,7 @@
             InternalFactHandle handle = entry.getFactHandle();
             if ( this.constraints.isAllowedCachedLeft( handle ) ) {
                 if( this.unwrapRightObject ) {
-                    handle = ((ReteTuple) handle.getObject()).getLastHandle(); 
+                    handle = ((LeftTuple) handle.getObject()).getLastHandle(); 
                 }
                 result.add( handle.getObject() );
             }
@@ -159,12 +159,12 @@
     /**
      * @inheritDoc
      */
-    public void retractTuple(final ReteTuple leftTuple,
+    public void retractTuple(final LeftTuple leftTuple,
                              final PropagationContext context,
                              final InternalWorkingMemory workingMemory) {
 
         final BetaMemory memory = (BetaMemory) workingMemory.getNodeMemory( this );
-        memory.getTupleMemory().remove( leftTuple );
+        memory.getLeftTupleMemory().remove( leftTuple );
         CollectResult result = (CollectResult) memory.getCreatedHandles().remove( leftTuple );
         final InternalFactHandle handle = result.handle;
 
@@ -190,29 +190,29 @@
      *  2. For each matching tuple, call a modify tuple
      *  
      */
-    public void assertObject(final InternalFactHandle handle,
+    public void assertRightTuple(final RightTuple rightTuple,
                              final PropagationContext context,
                              final InternalWorkingMemory workingMemory) {
 
         final BetaMemory memory = (BetaMemory) workingMemory.getNodeMemory( this );
-        memory.getFactHandleMemory().add( handle );
+        memory.getRightTupleMemory().add( rightTuple );
         
         if ( !this.tupleMemoryEnabled ) {
             // do nothing here, as we know there are no left tuples at this stage in sequential mode.
             return;
         }        
 
-        this.constraints.updateFromFactHandle( workingMemory,
-                                               handle );
+        this.constraints.updateFromRightTuple( workingMemory,
+                                               rightTuple );
 
         // need to clone the tuples to avoid concurrent modification exceptions
-        Entry[] tuples = memory.getTupleMemory().toArray();
+        Entry[] tuples = memory.getLeftTupleMemory().toArray();
         for ( int i = 0; i < tuples.length; i++ ) {
-            ReteTuple tuple = (ReteTuple) tuples[i];
+            LeftTuple tuple = (LeftTuple) tuples[i];
             if ( this.constraints.isAllowedCachedRight( tuple ) ) {
                 this.modifyTuple( true,
                                   tuple,
-                                  handle,
+                                  rightTuple,
                                   context,
                                   workingMemory );
             }
@@ -225,27 +225,27 @@
      *  If an object is retract, call modify tuple for each
      *  tuple match.
      */
-    public void retractObject(final InternalFactHandle handle,
+    public void retractRightTuple(final RightTuple rightTuple,
                               final PropagationContext context,
                               final InternalWorkingMemory workingMemory) {
 
         final BetaMemory memory = (BetaMemory) workingMemory.getNodeMemory( this );
-        if ( !memory.getFactHandleMemory().remove( handle ) ) {
+        if ( !memory.getRightTupleMemory().remove( rightTuple ) ) {
             return;
         }
 
-        this.constraints.updateFromFactHandle( workingMemory,
-                                               handle );
+        this.constraints.updateFromRightTuple( workingMemory,
+                                               rightTuple );
 
         // need to clone the tuples to avoid concurrent modification exceptions
-        Entry[] tuples = memory.getTupleMemory().toArray();
+        Entry[] tuples = memory.getLeftTupleMemory().toArray();
         for ( int i = 0; i < tuples.length; i++ ) {
-            ReteTuple tuple = (ReteTuple) tuples[i];
+            LeftTuple tuple = (LeftTuple) tuples[i];
             if ( this.constraints.isAllowedCachedRight( tuple ) ) {
                 
                 this.modifyTuple( false,
                                   tuple,
-                                  handle,
+                                  rightTuple,
                                   context,
                                   workingMemory );
             }
@@ -262,7 +262,7 @@
      * @param workingMemory
      */
     public void modifyTuple(final boolean isAssert,
-                            final ReteTuple leftTuple,
+                            final LeftTuple leftTuple,
                             InternalFactHandle handle,
                             final PropagationContext context,
                             final InternalWorkingMemory workingMemory) {
@@ -282,7 +282,7 @@
         
         // if there is a subnetwork, we need to unwrapp the object from inside the tuple
         if( this.unwrapRightObject ) {
-            handle = ((ReteTuple) handle.getObject()).getLastHandle(); 
+            handle = ((LeftTuple) handle.getObject()).getLastHandle(); 
         }
 
         if ( context.getType() == PropagationContext.ASSERTION ) {
@@ -319,7 +319,7 @@
         }
     }
 
-    public void updateSink(final TupleSink sink,
+    public void updateSink(final LeftTupleSink sink,
                            final PropagationContext context,
                            final InternalWorkingMemory workingMemory) {
         final BetaMemory memory = (BetaMemory) workingMemory.getNodeMemory( this );
@@ -328,7 +328,7 @@
 
         for ( ObjectEntry entry = (ObjectEntry) it.next(); entry != null; entry = (ObjectEntry) it.next() ) {
             CollectResult result = (CollectResult) entry.getValue();
-            sink.assertTuple( new ReteTuple( (ReteTuple) entry.getKey(),
+            sink.assertTuple( new LeftTuple( (LeftTuple) entry.getKey(),
                                              result.handle ),
                               context,
                               workingMemory );

Deleted: labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/CompositeObjectSinkAdapter.java
===================================================================
--- labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/CompositeObjectSinkAdapter.java	2008-01-04 00:57:26 UTC (rev 17532)
+++ labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/CompositeObjectSinkAdapter.java	2008-01-04 01:54:45 UTC (rev 17533)
@@ -1,742 +0,0 @@
-package org.drools.reteoo;
-
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.drools.base.ValueType;
-import org.drools.base.evaluators.Operator;
-import org.drools.common.InternalFactHandle;
-import org.drools.common.InternalWorkingMemory;
-import org.drools.rule.LiteralConstraint;
-import org.drools.spi.AlphaNodeFieldConstraint;
-import org.drools.spi.Evaluator;
-import org.drools.spi.Extractor;
-import org.drools.spi.FieldExtractor;
-import org.drools.spi.FieldValue;
-import org.drools.spi.PropagationContext;
-import org.drools.util.Iterator;
-import org.drools.util.LinkedList;
-import org.drools.util.LinkedListNode;
-import org.drools.util.ObjectHashMap;
-import org.drools.util.ObjectHashMap.ObjectEntry;
-
-public class CompositeObjectSinkAdapter
-    implements
-    ObjectSinkPropagator {
-
-    //    /** You can override this property via a system property (eg -Ddrools.hashThreshold=4) */
-    //    public static final String HASH_THRESHOLD_SYSTEM_PROPERTY = "drools.hashThreshold";
-    //
-    //    /** The threshold for when hashing kicks in */
-    //    public static final int    THRESHOLD_TO_HASH              = Integer.parseInt( System.getProperty( HASH_THRESHOLD_SYSTEM_PROPERTY,
-    //                                                                                                      "3" ) );
-
-    private static final long serialVersionUID = 400L;
-    ObjectSinkNodeList        otherSinks;
-    ObjectSinkNodeList        hashableSinks;
-
-    LinkedList                hashedFieldIndexes;
-
-    ObjectHashMap             hashedSinkMap;
-
-    private HashKey           hashKey;
-
-    private final int         alphaNodeHashingThreshold;
-
-    public CompositeObjectSinkAdapter() {
-        this( 3 );
-    }
-
-    public CompositeObjectSinkAdapter(final int alphaNodeHashingThreshold) {
-        this.hashKey = new HashKey();
-        this.alphaNodeHashingThreshold = alphaNodeHashingThreshold;
-    }
-
-    public void addObjectSink(final ObjectSink sink) {
-        if ( sink instanceof AlphaNode ) {
-            final AlphaNode alphaNode = (AlphaNode) sink;
-            final AlphaNodeFieldConstraint fieldConstraint = alphaNode.getConstraint();
-
-            if ( fieldConstraint instanceof LiteralConstraint ) {
-                final LiteralConstraint literalConstraint = (LiteralConstraint) fieldConstraint;
-                final Evaluator evaluator = literalConstraint.getEvaluator();
-
-                if ( evaluator.getOperator() == Operator.EQUAL && literalConstraint.getFieldExtractor().getValueType() != ValueType.OBJECT_TYPE ) {
-                    final int index = literalConstraint.getFieldExtractor().getIndex();
-                    final FieldIndex fieldIndex = registerFieldIndex( index,
-                                                                      literalConstraint.getFieldExtractor() );
-
-                    if ( fieldIndex.getCount() >= this.alphaNodeHashingThreshold && this.alphaNodeHashingThreshold != 0) {
-                        if ( !fieldIndex.isHashed() ) {
-                            hashSinks( fieldIndex );
-                        }
-                        final FieldValue value = literalConstraint.getField();
-                        // no need to check, we know  the sink  does not exist
-                        this.hashedSinkMap.put( new HashKey( index,
-                                                             value,
-                                                             fieldIndex.getFieldExtractor() ),
-                                                sink,
-                                                false );
-                    } else {
-                        if ( this.hashableSinks == null ) {
-                            this.hashableSinks = new ObjectSinkNodeList();
-                        }
-                        this.hashableSinks.add( (ObjectSinkNode) sink );
-                    }
-                    return;
-                }
-
-            }
-        }
-
-        if ( this.otherSinks == null ) {
-            this.otherSinks = new ObjectSinkNodeList();
-        }
-
-        this.otherSinks.add( (ObjectSinkNode) sink );
-    }
-
-    public void removeObjectSink(final ObjectSink sink) {
-        if ( sink instanceof AlphaNode ) {
-            final AlphaNode alphaNode = (AlphaNode) sink;
-            final AlphaNodeFieldConstraint fieldConstraint = alphaNode.getConstraint();
-
-            if ( fieldConstraint instanceof LiteralConstraint ) {
-                final LiteralConstraint literalConstraint = (LiteralConstraint) fieldConstraint;
-                final Evaluator evaluator = literalConstraint.getEvaluator();
-                final FieldValue value = literalConstraint.getField();
-
-                if ( evaluator.getOperator() == Operator.EQUAL && literalConstraint.getFieldExtractor().getValueType() != ValueType.OBJECT_TYPE ) {
-                    final int index = literalConstraint.getFieldExtractor().getIndex();
-                    final FieldIndex fieldIndex = unregisterFieldIndex( index );
-
-                    if ( fieldIndex.isHashed() ) {
-                        this.hashKey.setValue( index,
-                                               fieldIndex.getFieldExtractor(),
-                                               value );
-                        this.hashedSinkMap.remove( this.hashKey );
-                        if ( fieldIndex.getCount() <= this.alphaNodeHashingThreshold - 1 ) {
-                            // we have less than three so unhash
-                            unHashSinks( fieldIndex );
-                        }
-                    } else {
-                        this.hashableSinks.remove( (ObjectSinkNode) sink );
-                    }
-
-                    if ( this.hashableSinks != null && this.hashableSinks.isEmpty() ) {
-                        this.hashableSinks = null;
-                    }
-
-                    return;
-                }
-            }
-        }
-
-        this.otherSinks.remove( (ObjectSinkNode) sink );
-
-        if ( this.otherSinks.isEmpty() ) {
-            this.otherSinks = null;
-        }
-    }
-
-    public void hashSinks(final FieldIndex fieldIndex) {
-        final int index = fieldIndex.getIndex();
-
-        final List list = new ArrayList();
-
-        if ( this.hashedSinkMap == null ) {
-            this.hashedSinkMap = new ObjectHashMap();
-        }
-
-        for ( ObjectSinkNode sink = this.hashableSinks.getFirst(); sink != null; sink = sink.getNextObjectSinkNode() ) {
-            final AlphaNode alphaNode = (AlphaNode) sink;
-            final AlphaNodeFieldConstraint fieldConstraint = alphaNode.getConstraint();
-            final LiteralConstraint literalConstraint = (LiteralConstraint) fieldConstraint;
-            final Evaluator evaluator = literalConstraint.getEvaluator();
-            if ( evaluator.getOperator() == Operator.EQUAL && index == literalConstraint.getFieldExtractor().getIndex() ) {
-                final FieldValue value = literalConstraint.getField();
-                list.add( sink );
-                this.hashedSinkMap.put( new HashKey( index,
-                                                     value,
-                                                     fieldIndex.getFieldExtractor() ),
-                                        sink );
-            }
-        }
-
-        for ( final java.util.Iterator it = list.iterator(); it.hasNext(); ) {
-            final ObjectSinkNode sink = (ObjectSinkNode) it.next();
-            this.hashableSinks.remove( sink );
-        }
-
-        if ( this.hashableSinks.isEmpty() ) {
-            this.hashableSinks = null;
-        }
-
-        fieldIndex.setHashed( true );
-    }
-
-    public void unHashSinks(final FieldIndex fieldIndex) {
-        final int index = fieldIndex.getIndex();
-
-        final List sinks = new ArrayList();
-
-        //iterate twice as custom iterator is immutable
-        final Iterator mapIt = this.hashedSinkMap.newIterator();
-        for ( ObjectHashMap.ObjectEntry e = (ObjectHashMap.ObjectEntry) mapIt.next(); e != null; ) {
-
-            sinks.add( e.getValue() );
-            e = (ObjectHashMap.ObjectEntry) mapIt.next();
-        }
-
-        for ( final java.util.Iterator iter = sinks.iterator(); iter.hasNext(); ) {
-            final AlphaNode sink = (AlphaNode) iter.next();
-            final AlphaNode alphaNode = sink;
-            final AlphaNodeFieldConstraint fieldConstraint = alphaNode.getConstraint();
-            final LiteralConstraint literalConstraint = (LiteralConstraint) fieldConstraint;
-            final Evaluator evaluator = literalConstraint.getEvaluator();
-            if ( evaluator.getOperator() == Operator.EQUAL && index == literalConstraint.getFieldExtractor().getIndex() ) {
-                final FieldValue value = literalConstraint.getField();
-                if ( this.hashableSinks == null ) {
-                    this.hashableSinks = new ObjectSinkNodeList();
-                }
-                this.hashableSinks.add( sink );
-                this.hashedSinkMap.remove( new HashKey( index,
-                                                        value,
-                                                        fieldIndex.getFieldExtractor() ) );
-            };
-        }
-
-        if ( this.hashedSinkMap.isEmpty() ) {
-            this.hashedSinkMap = null;
-        }
-
-        fieldIndex.setHashed( false );
-    }
-
-    /**
-     * Returns a FieldIndex which Keeps a count on how many times a particular field is used with an equality check in the sinks.
-     * @param index
-     * @param fieldExtractor
-     * @return
-     */
-    private FieldIndex registerFieldIndex(final int index,
-                                          final FieldExtractor fieldExtractor) {
-        FieldIndex fieldIndex = null;
-
-        // is linkedlist null, if so create and add
-        if ( this.hashedFieldIndexes == null ) {
-            this.hashedFieldIndexes = new LinkedList();
-            fieldIndex = new FieldIndex( index,
-                                         fieldExtractor );
-            this.hashedFieldIndexes.add( fieldIndex );
-        }
-
-        // still null, so see if it already exists
-        if ( fieldIndex == null ) {
-            fieldIndex = findFieldIndex( index );
-        }
-
-        // doesn't exist so create it
-        if ( fieldIndex == null ) {
-            fieldIndex = new FieldIndex( index,
-                                         fieldExtractor );
-            this.hashedFieldIndexes.add( fieldIndex );
-        }
-
-        fieldIndex.increaseCounter();
-
-        return fieldIndex;
-    }
-
-    private FieldIndex unregisterFieldIndex(final int index) {
-        final FieldIndex fieldIndex = findFieldIndex( index );
-        fieldIndex.decreaseCounter();
-
-        // if the fieldcount is 0 then remove it from the linkedlist
-        if ( fieldIndex.getCount() == 0 ) {
-            this.hashedFieldIndexes.remove( fieldIndex );
-
-            // if the linkedlist is empty then null it
-            if ( this.hashedFieldIndexes.isEmpty() ) {
-                this.hashedFieldIndexes = null;
-            }
-        }
-
-        return fieldIndex;
-    }
-
-    private FieldIndex findFieldIndex(final int index) {
-        for ( FieldIndex node = (FieldIndex) this.hashedFieldIndexes.getFirst(); node != null; node = (FieldIndex) node.getNext() ) {
-            if ( node.getIndex() == index ) {
-                return node;
-            }
-        }
-
-        return null;
-    }
-
-    public void propagateAssertObject(final InternalFactHandle handle,
-                                      final PropagationContext context,
-                                      final InternalWorkingMemory workingMemory) {
-        final Object object = handle.getObject();
-
-        // Iterates t he FieldIndex collection, which tells you if particularly field is hashed or not
-        // if the field is hashed then it builds the hashkey to return the correct sink for the current objects slot's
-        // value, one object may have multiple fields indexed.
-        if ( this.hashedFieldIndexes != null ) {
-            // Iterate the FieldIndexes to see if any are hashed        
-            for ( FieldIndex fieldIndex = (FieldIndex) this.hashedFieldIndexes.getFirst(); fieldIndex != null; fieldIndex = (FieldIndex) fieldIndex.getNext() ) {
-                if ( !fieldIndex.isHashed() ) {
-                    continue;
-                }
-                // this field is hashed so set the existing hashKey and see if there is a sink for it
-                final int index = fieldIndex.getIndex();
-                final FieldExtractor extractor = fieldIndex.getFieldExtactor();
-                this.hashKey.setValue( index,
-                                       object,
-                                       extractor );
-                final ObjectSink sink = (ObjectSink) this.hashedSinkMap.get( this.hashKey );
-                if ( sink != null ) {
-                    // The sink exists so propagate
-                    sink.assertObject( handle,
-                                       context,
-                                       workingMemory );
-                }
-            }
-        }
-
-        // propagate unhashed
-        if ( this.hashableSinks != null ) {
-            for ( ObjectSinkNode sink = this.hashableSinks.getFirst(); sink != null; sink = sink.getNextObjectSinkNode() ) {
-                sink.assertObject( handle,
-                                   context,
-                                   workingMemory );
-            }
-        }
-
-        if ( this.otherSinks != null ) {
-            // propagate others
-            for ( ObjectSinkNode sink = this.otherSinks.getFirst(); sink != null; sink = sink.getNextObjectSinkNode() ) {
-                sink.assertObject( handle,
-                                   context,
-                                   workingMemory );
-            }
-        }
-
-    }
-
-    public void propagateRetractObject(final InternalFactHandle handle,
-                                       final PropagationContext context,
-                                       final InternalWorkingMemory workingMemory,
-                                       final boolean useHash) {
-        if ( this.hashedFieldIndexes != null ) {
-            if ( useHash && this.hashedSinkMap != null ) {
-                final Object object = handle.getObject();
-                // Iterate the FieldIndexes to see if any are hashed        
-                for ( FieldIndex fieldIndex = (FieldIndex) this.hashedFieldIndexes.getFirst(); fieldIndex != null; fieldIndex = (FieldIndex) fieldIndex.getNext() ) {
-                    // this field is hashed so set the existing hashKey and see if there is a sink for it
-                    if ( !fieldIndex.isHashed() ) {
-                        continue;
-                    }
-
-                    final int index = fieldIndex.getIndex();
-                    final FieldExtractor extractor = fieldIndex.getFieldExtactor();
-                    this.hashKey.setValue( index,
-                                           object,
-                                           extractor );
-                    final ObjectSink sink = (ObjectSink) this.hashedSinkMap.get( this.hashKey );
-                    if ( sink != null ) {
-                        // The sink exists so propagate
-                        sink.retractObject( handle,
-                                            context,
-                                            workingMemory );
-                    }
-                }
-            } else if ( this.hashedSinkMap != null ) {
-                final Iterator it = this.hashedSinkMap.newIterator();
-                for ( ObjectEntry entry = (ObjectEntry) it.next(); entry != null; entry = (ObjectEntry) it.next() ) {
-                    final ObjectSink sink = (ObjectSink) entry.getValue();
-                    sink.retractObject( handle,
-                                        context,
-                                        workingMemory );
-                }
-            }
-        }
-
-        if ( this.hashableSinks != null ) {
-            // we can't retrieve hashed sinks, as the field value might have changed, so we have to iterate and propagate to all hashed sinks
-            for ( ObjectSinkNode sink = this.hashableSinks.getFirst(); sink != null; sink = sink.getNextObjectSinkNode() ) {
-                sink.retractObject( handle,
-                                    context,
-                                    workingMemory );
-            }
-        }
-
-        if ( this.otherSinks != null ) {
-            // propagate others
-            for ( ObjectSinkNode sink = this.otherSinks.getFirst(); sink != null; sink = sink.getNextObjectSinkNode() ) {
-                sink.retractObject( handle,
-                                    context,
-                                    workingMemory );
-            }
-        }
-    }
-
-    public ObjectSink[] getSinks() {
-        final List list = new ArrayList();
-
-        if ( this.otherSinks != null ) {
-            for ( ObjectSinkNode sink = this.otherSinks.getFirst(); sink != null; sink = sink.getNextObjectSinkNode() ) {
-                list.add( sink );
-            }
-        }
-
-        if ( this.hashableSinks != null ) {
-            for ( ObjectSinkNode sink = this.hashableSinks.getFirst(); sink != null; sink = sink.getNextObjectSinkNode() ) {
-                list.add( sink );
-            }
-        }
-
-        if ( this.hashedSinkMap != null ) {
-            final Iterator it = this.hashedSinkMap.newIterator();
-            for ( ObjectEntry entry = (ObjectEntry) it.next(); entry != null; entry = (ObjectEntry) it.next() ) {
-                final ObjectSink sink = (ObjectSink) entry.getValue();
-                list.add( sink );
-            }
-        }
-
-        return (ObjectSink[]) list.toArray( new ObjectSink[list.size()] );
-    }
-
-    public int size() {
-        int size = 0;
-        size += ((this.otherSinks != null) ? this.otherSinks.size() : 0);
-        size += ((this.hashableSinks != null) ? this.hashableSinks.size() : 0);
-        size += ((this.hashedSinkMap != null) ? this.hashedSinkMap.size() : 0);
-        return size;
-    }
-
-    public static class HashKey
-        implements
-        Serializable {
-        private static final long serialVersionUID = 400L;
-
-        private static final byte OBJECT           = 1;
-        private static final byte LONG             = 2;
-        private static final byte DOUBLE           = 3;
-        private static final byte BOOL             = 4;
-
-        private int               index;
-
-        private byte              type;
-        private Object            ovalue;
-        private long              lvalue;
-        private boolean           bvalue;
-        private double            dvalue;
-        
-        private boolean           isNull;
-
-        private int               hashCode;
-
-        public HashKey() {
-        }
-
-        public HashKey(final int index,
-                       final FieldValue value,
-                       final Extractor extractor ) {
-            this.setValue( index,
-                           extractor, 
-                           value );
-        }
-
-        public HashKey(final int index,
-                       final Object value,
-                       final Extractor extractor) {
-            this.setValue( index,
-                           value,
-                           extractor );
-        }
-
-        public int getIndex() {
-            return this.index;
-        }
-
-        public void setValue(final int index,
-                             final Object value,
-                             final Extractor extractor) {
-            this.index = index;
-            final ValueType vtype = extractor.getValueType();
-            
-            isNull = extractor.isNullValue(null, value);
-            
-            if ( vtype.isBoolean() ) {
-                this.type = BOOL;
-            	if ( !isNull ) {
-            		this.bvalue = extractor.getBooleanValue( null, value );
-                    this.setHashCode( this.bvalue ? 1231 : 1237 );
-            	} else {
-                    this.setHashCode( 0 );
-            	}
-            } else if ( vtype.isIntegerNumber() || vtype.isChar() ) {
-                this.type = LONG;
-                if ( !isNull ) {
-                    this.lvalue = extractor.getLongValue( null, value );
-                    this.setHashCode( (int) (this.lvalue ^ (this.lvalue >>> 32)) );
-                } else {
-                    this.setHashCode( 0 );
-                }
-            } else if ( vtype.isFloatNumber() ) {
-                this.type = DOUBLE;
-            	if ( !isNull ) {                
-	                this.dvalue = extractor.getDoubleValue( null, value );
-	                final long temp = Double.doubleToLongBits( this.dvalue );
-	                this.setHashCode( (int) (temp ^ (temp >>> 32)) );
-            	} else {
-            		this.setHashCode( 0 );
-            	}
-            } else {
-                this.type = OBJECT;
-            	if ( !isNull ) {
-            		this.ovalue = extractor.getValue( null, value );
-            		this.setHashCode( this.ovalue != null ? this.ovalue.hashCode() : 0 );
-            	} else {
-            		this.setHashCode( 0 );
-            	}                
-            }
-        }
-
-        public void setValue(final int index,
-                             final Extractor extractor,
-                             final FieldValue value) {
-            this.index = index;
-            
-            this.isNull = value.isNull();
-            final ValueType vtype = extractor.getValueType();
-            
-            if ( vtype.isBoolean() ) {
-                this.type = BOOL;
-                if ( !isNull ) {      
-	                this.bvalue = value.getBooleanValue();
-	                this.setHashCode( this.bvalue ? 1231 : 1237 );
-                } else {
-             		this.setHashCode( 0 );
-                }
-            } else if ( vtype.isIntegerNumber() ) {
-                this.type = LONG;
-                if ( !isNull ) {      
-	                this.lvalue = value.getLongValue();
-	                this.setHashCode( (int) (this.lvalue ^ (this.lvalue >>> 32)) );
-                } else {
-             		this.setHashCode( 0 );
-                }
-            } else if ( vtype.isFloatNumber() ) {
-                this.type = DOUBLE;
-                if ( !isNull ) {      
-	                this.dvalue = value.getDoubleValue();
-	                final long temp = Double.doubleToLongBits( this.dvalue );
-	                this.setHashCode( (int) (temp ^ (temp >>> 32)) );
-                } else {
-             		this.setHashCode( 0 );
-                }
-            } else {
-                this.type = OBJECT;
-                if ( !isNull ) {      
-	                this.ovalue = value.getValue();
-	                this.setHashCode( this.ovalue != null ? this.ovalue.hashCode() : 0 );
-                } else {
-             		this.setHashCode( 0 );
-                }
-            }
-        }
-
-        private void setHashCode(final int hashSeed) {
-            final int PRIME = 31;
-            int result = 1;
-            result = PRIME * result + hashSeed;
-            result = PRIME * result + this.index;
-            this.hashCode = result;
-        }
-
-        public boolean getBooleanValue() {
-            switch ( this.type ) {
-                case BOOL :
-                    return this.bvalue;
-                case OBJECT :
-                    if ( this.ovalue == null ) {
-                        return false;
-                    } else if ( this.ovalue instanceof Boolean ) {
-                        return ((Boolean) this.ovalue).booleanValue();
-                    } else if ( this.ovalue instanceof String ) {
-                        return Boolean.valueOf( (String) this.ovalue ).booleanValue();
-                    } else {
-                        throw new ClassCastException( "Can't convert " + this.ovalue.getClass() + " to a boolean value." );
-                    }
-                case LONG :
-                    throw new ClassCastException( "Can't convert long to a boolean value." );
-                case DOUBLE :
-                    throw new ClassCastException( "Can't convert double to a boolean value." );
-
-            }
-            return false;
-        }
-
-        public long getLongValue() {
-            switch ( this.type ) {
-                case BOOL :
-                    return this.bvalue ? 1 : 0;
-                case OBJECT :
-                    if ( this.ovalue == null ) {
-                        return 0;
-                    } else if ( this.ovalue instanceof Number ) {
-                        return ((Number) this.ovalue).longValue();
-                    } else if ( this.ovalue instanceof String ) {
-                        return Long.parseLong( (String) this.ovalue );
-                    } else {
-                        throw new ClassCastException( "Can't convert " + this.ovalue.getClass() + " to a long value." );
-                    }
-                case LONG :
-                    return this.lvalue;
-                case DOUBLE :
-                    return (long) this.dvalue;
-
-            }
-            return 0;
-        }
-
-        public double getDoubleValue() {
-            switch ( this.type ) {
-                case BOOL :
-                    return this.bvalue ? 1 : 0;
-                case OBJECT :
-                    if ( this.ovalue == null ) {
-                        return 0;
-                    } else if ( this.ovalue instanceof Number ) {
-                        return ((Number) this.ovalue).doubleValue();
-                    } else if ( this.ovalue instanceof String ) {
-                        return Double.parseDouble( (String) this.ovalue );
-                    } else {
-                        throw new ClassCastException( "Can't convert " + this.ovalue.getClass() + " to a double value." );
-                    }
-                case LONG :
-                    return this.lvalue;
-                case DOUBLE :
-                    return this.dvalue;
-            }
-            return 0;
-        }
-
-        public Object getObjectValue() {
-            switch ( this.type ) {
-                case BOOL :
-                    return this.bvalue ? Boolean.TRUE : Boolean.FALSE;
-                case OBJECT :
-                    return this.ovalue;
-                case LONG :
-                    return new Long( this.lvalue );
-                case DOUBLE :
-                    return new Double( this.dvalue );
-            }
-            return null;
-        }
-
-        public int hashCode() {
-            return this.hashCode;
-        }
-
-        public boolean equals(final Object object) {
-            final HashKey other = (HashKey) object;
-            
-            if ( this.isNull ) {
-            	return ( other.isNull );
-            }
-
-            switch ( this.type ) {
-                case BOOL :
-                    return (this.index == other.index) && (this.bvalue == other.getBooleanValue());
-                case LONG :
-                    return (this.index == other.index) && (this.lvalue == other.getLongValue());
-                case DOUBLE :
-                    return (this.index == other.index) && (this.dvalue == other.getDoubleValue());
-                case OBJECT :
-                    final Object otherValue = other.getObjectValue();
-                    if ( (this.ovalue != null) && (this.ovalue instanceof Number) && (otherValue instanceof Number) ) {
-                        return (this.index == other.index) && (((Number) this.ovalue).doubleValue() == ((Number) otherValue).doubleValue());
-                    }
-                    return (this.index == other.index) && ( this.ovalue == null ? otherValue == null : this.ovalue.equals( otherValue ));
-            }
-            return false;
-        }
-
-    }
-
-    public static class FieldIndex
-        implements
-        LinkedListNode {
-        private static final long serialVersionUID = 400L;
-        private final int         index;
-        private FieldExtractor    fieldExtactor;
-
-        private int               count;
-
-        private boolean           hashed;
-
-        private LinkedListNode    previous;
-        private LinkedListNode    next;
-
-        public FieldIndex(final int index,
-                          final FieldExtractor fieldExtractor) {
-            this.index = index;
-            this.fieldExtactor = fieldExtractor;
-        }
-
-        public FieldExtractor getFieldExtractor() {
-            return this.fieldExtactor;
-        }
-
-        public int getIndex() {
-            return this.index;
-        }
-
-        public int getCount() {
-            return this.count;
-        }
-
-        public FieldExtractor getFieldExtactor() {
-            return this.fieldExtactor;
-        }
-
-        public boolean isHashed() {
-            return this.hashed;
-        }
-
-        public void setHashed(final boolean hashed) {
-            this.hashed = hashed;
-        }
-
-        public void increaseCounter() {
-            this.count++;
-        }
-
-        public void decreaseCounter() {
-            this.count--;
-        }
-
-        public LinkedListNode getNext() {
-            return this.next;
-        }
-
-        public LinkedListNode getPrevious() {
-            return this.previous;
-        }
-
-        public void setNext(final LinkedListNode next) {
-            this.next = next;
-
-        }
-
-        public void setPrevious(final LinkedListNode previous) {
-            this.previous = previous;
-        }
-    }
-}

Copied: labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/CompositeRightTupleSinkAdapter.java (from rev 17522, labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/CompositeObjectSinkAdapter.java)
===================================================================
--- labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/CompositeRightTupleSinkAdapter.java	                        (rev 0)
+++ labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/CompositeRightTupleSinkAdapter.java	2008-01-04 01:54:45 UTC (rev 17533)
@@ -0,0 +1,746 @@
+package org.drools.reteoo;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.drools.base.ValueType;
+import org.drools.base.evaluators.Operator;
+import org.drools.common.InternalWorkingMemory;
+import org.drools.rule.LiteralConstraint;
+import org.drools.spi.AlphaNodeFieldConstraint;
+import org.drools.spi.Evaluator;
+import org.drools.spi.Extractor;
+import org.drools.spi.FieldExtractor;
+import org.drools.spi.FieldValue;
+import org.drools.spi.PropagationContext;
+import org.drools.util.Entry;
+import org.drools.util.Iterator;
+import org.drools.util.LinkedList;
+import org.drools.util.ObjectHashMap;
+import org.drools.util.ObjectHashMap.ObjectEntry;
+
+public class CompositeRightTupleSinkAdapter
+    implements
+    RightTupletSinkPropagator {
+
+    //    /** You can override this property via a system property (eg -Ddrools.hashThreshold=4) */
+    //    public static final String HASH_THRESHOLD_SYSTEM_PROPERTY = "drools.hashThreshold";
+    //
+    //    /** The threshold for when hashing kicks in */
+    //    public static final int    THRESHOLD_TO_HASH              = Integer.parseInt( System.getProperty( HASH_THRESHOLD_SYSTEM_PROPERTY,
+    //                                                                                                      "3" ) );
+
+    private static final long serialVersionUID = 400L;
+    RightTupleSinkNodeList    otherSinks;
+    RightTupleSinkNodeList    hashableSinks;
+
+    LinkedList                hashedFieldIndexes;
+
+    ObjectHashMap             hashedSinkMap;
+
+    private HashKey           hashKey;
+
+    private final int         alphaNodeHashingThreshold;
+
+    public CompositeRightTupleSinkAdapter() {
+        this( 3 );
+    }
+
+    public CompositeRightTupleSinkAdapter(final int alphaNodeHashingThreshold) {
+        this.hashKey = new HashKey();
+        this.alphaNodeHashingThreshold = alphaNodeHashingThreshold;
+    }
+
+    public void addObjectSink(final RightTupleSink sink) {
+        if ( sink instanceof AlphaNode ) {
+            final AlphaNode alphaNode = (AlphaNode) sink;
+            final AlphaNodeFieldConstraint fieldConstraint = alphaNode.getConstraint();
+
+            if ( fieldConstraint instanceof LiteralConstraint ) {
+                final LiteralConstraint literalConstraint = (LiteralConstraint) fieldConstraint;
+                final Evaluator evaluator = literalConstraint.getEvaluator();
+
+                if ( evaluator.getOperator() == Operator.EQUAL && literalConstraint.getFieldExtractor().getValueType() != ValueType.OBJECT_TYPE ) {
+                    final int index = literalConstraint.getFieldExtractor().getIndex();
+                    final FieldIndex fieldIndex = registerFieldIndex( index,
+                                                                      literalConstraint.getFieldExtractor() );
+
+                    if ( fieldIndex.getCount() >= this.alphaNodeHashingThreshold && this.alphaNodeHashingThreshold != 0 ) {
+                        if ( !fieldIndex.isHashed() ) {
+                            hashSinks( fieldIndex );
+                        }
+                        final FieldValue value = literalConstraint.getField();
+                        // no need to check, we know  the sink  does not exist
+                        this.hashedSinkMap.put( new HashKey( index,
+                                                             value,
+                                                             fieldIndex.getFieldExtractor() ),
+                                                sink,
+                                                false );
+                    } else {
+                        if ( this.hashableSinks == null ) {
+                            this.hashableSinks = new RightTupleSinkNodeList();
+                        }
+                        this.hashableSinks.add( (RightTupleSinkNode) sink );
+                    }
+                    return;
+                }
+
+            }
+        }
+
+        if ( this.otherSinks == null ) {
+            this.otherSinks = new RightTupleSinkNodeList();
+        }
+
+        this.otherSinks.add( (RightTupleSinkNode) sink );
+    }
+
+    public void removeObjectSink(final RightTupleSink sink) {
+        if ( sink instanceof AlphaNode ) {
+            final AlphaNode alphaNode = (AlphaNode) sink;
+            final AlphaNodeFieldConstraint fieldConstraint = alphaNode.getConstraint();
+
+            if ( fieldConstraint instanceof LiteralConstraint ) {
+                final LiteralConstraint literalConstraint = (LiteralConstraint) fieldConstraint;
+                final Evaluator evaluator = literalConstraint.getEvaluator();
+                final FieldValue value = literalConstraint.getField();
+
+                if ( evaluator.getOperator() == Operator.EQUAL && literalConstraint.getFieldExtractor().getValueType() != ValueType.OBJECT_TYPE ) {
+                    final int index = literalConstraint.getFieldExtractor().getIndex();
+                    final FieldIndex fieldIndex = unregisterFieldIndex( index );
+
+                    if ( fieldIndex.isHashed() ) {
+                        this.hashKey.setValue( index,
+                                               fieldIndex.getFieldExtractor(),
+                                               value );
+                        this.hashedSinkMap.remove( this.hashKey );
+                        if ( fieldIndex.getCount() <= this.alphaNodeHashingThreshold - 1 ) {
+                            // we have less than three so unhash
+                            unHashSinks( fieldIndex );
+                        }
+                    } else {
+                        this.hashableSinks.remove( (RightTupleSinkNode) sink );
+                    }
+
+                    if ( this.hashableSinks != null && this.hashableSinks.isEmpty() ) {
+                        this.hashableSinks = null;
+                    }
+
+                    return;
+                }
+            }
+        }
+
+        this.otherSinks.remove( (RightTupleSinkNode) sink );
+
+        if ( this.otherSinks.isEmpty() ) {
+            this.otherSinks = null;
+        }
+    }
+
+    public void hashSinks(final FieldIndex fieldIndex) {
+        final int index = fieldIndex.getIndex();
+
+        final List list = new ArrayList();
+
+        if ( this.hashedSinkMap == null ) {
+            this.hashedSinkMap = new ObjectHashMap();
+        }
+
+        for ( RightTupleSinkNode sink = this.hashableSinks.getFirst(); sink != null; sink = sink.getNextRightTupleSinkNode() ) {
+            final AlphaNode alphaNode = (AlphaNode) sink;
+            final AlphaNodeFieldConstraint fieldConstraint = alphaNode.getConstraint();
+            final LiteralConstraint literalConstraint = (LiteralConstraint) fieldConstraint;
+            final Evaluator evaluator = literalConstraint.getEvaluator();
+            if ( evaluator.getOperator() == Operator.EQUAL && index == literalConstraint.getFieldExtractor().getIndex() ) {
+                final FieldValue value = literalConstraint.getField();
+                list.add( sink );
+                this.hashedSinkMap.put( new HashKey( index,
+                                                     value,
+                                                     fieldIndex.getFieldExtractor() ),
+                                        sink );
+            }
+        }
+
+        for ( final java.util.Iterator it = list.iterator(); it.hasNext(); ) {
+            final RightTupleSinkNode sink = (RightTupleSinkNode) it.next();
+            this.hashableSinks.remove( sink );
+        }
+
+        if ( this.hashableSinks.isEmpty() ) {
+            this.hashableSinks = null;
+        }
+
+        fieldIndex.setHashed( true );
+    }
+
+    public void unHashSinks(final FieldIndex fieldIndex) {
+        final int index = fieldIndex.getIndex();
+
+        final List sinks = new ArrayList();
+
+        //iterate twice as custom iterator is immutable
+        final Iterator mapIt = this.hashedSinkMap.newIterator();
+        for ( ObjectHashMap.ObjectEntry e = (ObjectHashMap.ObjectEntry) mapIt.next(); e != null; ) {
+
+            sinks.add( e.getValue() );
+            e = (ObjectHashMap.ObjectEntry) mapIt.next();
+        }
+
+        for ( final java.util.Iterator iter = sinks.iterator(); iter.hasNext(); ) {
+            final AlphaNode sink = (AlphaNode) iter.next();
+            final AlphaNode alphaNode = sink;
+            final AlphaNodeFieldConstraint fieldConstraint = alphaNode.getConstraint();
+            final LiteralConstraint literalConstraint = (LiteralConstraint) fieldConstraint;
+            final Evaluator evaluator = literalConstraint.getEvaluator();
+            if ( evaluator.getOperator() == Operator.EQUAL && index == literalConstraint.getFieldExtractor().getIndex() ) {
+                final FieldValue value = literalConstraint.getField();
+                if ( this.hashableSinks == null ) {
+                    this.hashableSinks = new RightTupleSinkNodeList();
+                }
+                this.hashableSinks.add( sink );
+                this.hashedSinkMap.remove( new HashKey( index,
+                                                        value,
+                                                        fieldIndex.getFieldExtractor() ) );
+            };
+        }
+
+        if ( this.hashedSinkMap.isEmpty() ) {
+            this.hashedSinkMap = null;
+        }
+
+        fieldIndex.setHashed( false );
+    }
+
+    /**
+     * Returns a FieldIndex which Keeps a count on how many times a particular field is used with an equality check in the sinks.
+     * @param index
+     * @param fieldExtractor
+     * @return
+     */
+    private FieldIndex registerFieldIndex(final int index,
+                                          final FieldExtractor fieldExtractor) {
+        FieldIndex fieldIndex = null;
+
+        // is linkedlist null, if so create and add
+        if ( this.hashedFieldIndexes == null ) {
+            this.hashedFieldIndexes = new LinkedList();
+            fieldIndex = new FieldIndex( index,
+                                         fieldExtractor );
+            this.hashedFieldIndexes.add( fieldIndex );
+        }
+
+        // still null, so see if it already exists
+        if ( fieldIndex == null ) {
+            fieldIndex = findFieldIndex( index );
+        }
+
+        // doesn't exist so create it
+        if ( fieldIndex == null ) {
+            fieldIndex = new FieldIndex( index,
+                                         fieldExtractor );
+            this.hashedFieldIndexes.add( fieldIndex );
+        }
+
+        fieldIndex.increaseCounter();
+
+        return fieldIndex;
+    }
+
+    private FieldIndex unregisterFieldIndex(final int index) {
+        final FieldIndex fieldIndex = findFieldIndex( index );
+        fieldIndex.decreaseCounter();
+
+        // if the fieldcount is 0 then remove it from the linkedlist
+        if ( fieldIndex.getCount() == 0 ) {
+            this.hashedFieldIndexes.remove( fieldIndex );
+
+            // if the linkedlist is empty then null it
+            if ( this.hashedFieldIndexes.isEmpty() ) {
+                this.hashedFieldIndexes = null;
+            }
+        }
+
+        return fieldIndex;
+    }
+
+    private FieldIndex findFieldIndex(final int index) {
+        for ( FieldIndex node = (FieldIndex) this.hashedFieldIndexes.getFirst(); node != null; node = (FieldIndex) node.getNext() ) {
+            if ( node.getIndex() == index ) {
+                return node;
+            }
+        }
+
+        return null;
+    }
+
+    public void propagateAssertRightTuple(final RightTuple rightTuple,
+                                          final PropagationContext context,
+                                          final InternalWorkingMemory workingMemory) {
+        final Object object = rightTuple.getHandle().getObject();
+
+        // Iterates t he FieldIndex collection, which tells you if particularly field is hashed or not
+        // if the field is hashed then it builds the hashkey to return the correct sink for the current objects slot's
+        // value, one object may have multiple fields indexed.
+        if ( this.hashedFieldIndexes != null ) {
+            // Iterate the FieldIndexes to see if any are hashed        
+            for ( FieldIndex fieldIndex = (FieldIndex) this.hashedFieldIndexes.getFirst(); fieldIndex != null; fieldIndex = (FieldIndex) fieldIndex.getNext() ) {
+                if ( !fieldIndex.isHashed() ) {
+                    continue;
+                }
+                // this field is hashed so set the existing hashKey and see if there is a sink for it
+                final int index = fieldIndex.getIndex();
+                final FieldExtractor extractor = fieldIndex.getFieldExtactor();
+                this.hashKey.setValue( index,
+                                       object,
+                                       extractor );
+                final RightTupleSink sink = (RightTupleSink) this.hashedSinkMap.get( this.hashKey );
+                if ( sink != null ) {
+                    // The sink exists so propagate
+                    sink.assertRightTuple( new RightTuple( rightTuple ),
+                                           context,
+                                           workingMemory );
+                }
+            }
+        }
+
+        // propagate unhashed
+        if ( this.hashableSinks != null ) {
+            for ( RightTupleSinkNode sink = this.hashableSinks.getFirst(); sink != null; sink = sink.getNextRightTupleSinkNode() ) {
+                sink.assertRightTuple( new RightTuple( rightTuple ),
+                                       context,
+                                       workingMemory );
+            }
+        }
+
+        if ( this.otherSinks != null ) {
+            // propagate others
+            for ( RightTupleSinkNode sink = this.otherSinks.getFirst(); sink != null; sink = sink.getNextRightTupleSinkNode() ) {
+                sink.assertRightTuple( new RightTuple( rightTuple ),
+                                       context,
+                                       workingMemory );
+            }
+        }
+
+    }
+
+    public void propagateRetractRightTuple(final RightTuple rightTuple,
+                                           final PropagationContext context,
+                                           final InternalWorkingMemory workingMemory,
+                                           final boolean useHash) {
+        if ( this.hashedFieldIndexes != null ) {
+            if ( useHash && this.hashedSinkMap != null ) {
+                final Object object = rightTuple.getHandle().getObject();
+                // Iterate the FieldIndexes to see if any are hashed        
+                for ( FieldIndex fieldIndex = (FieldIndex) this.hashedFieldIndexes.getFirst(); fieldIndex != null; fieldIndex = (FieldIndex) fieldIndex.getNext() ) {
+                    // this field is hashed so set the existing hashKey and see if there is a sink for it
+                    if ( !fieldIndex.isHashed() ) {
+                        continue;
+                    }
+
+                    final int index = fieldIndex.getIndex();
+                    final FieldExtractor extractor = fieldIndex.getFieldExtactor();
+                    this.hashKey.setValue( index,
+                                           object,
+                                           extractor );
+                    final RightTupleSink sink = (RightTupleSink) this.hashedSinkMap.get( this.hashKey );
+                    if ( sink != null ) {
+                        // The sink exists so propagate
+                        sink.retractRightTuple( new RightTuple( rightTuple ),
+                                                context,
+                                                workingMemory );
+                    }
+                }
+            } else if ( this.hashedSinkMap != null ) {
+                final Iterator it = this.hashedSinkMap.newIterator();
+                for ( ObjectEntry entry = (ObjectEntry) it.next(); entry != null; entry = (ObjectEntry) it.next() ) {
+                    final RightTupleSink sink = (RightTupleSink) entry.getValue();
+                    sink.retractRightTuple( new RightTuple( rightTuple ),
+                                            context,
+                                            workingMemory );
+                }
+            }
+        }
+
+        if ( this.hashableSinks != null ) {
+            // we can't retrieve hashed sinks, as the field value might have changed, so we have to iterate and propagate to all hashed sinks
+            for ( RightTupleSinkNode sink = this.hashableSinks.getFirst(); sink != null; sink = sink.getNextRightTupleSinkNode() ) {
+                sink.retractRightTuple( new RightTuple( rightTuple ),
+                                        context,
+                                        workingMemory );
+            }
+        }
+
+        if ( this.otherSinks != null ) {
+            // propagate others
+            for ( RightTupleSinkNode sink = this.otherSinks.getFirst(); sink != null; sink = sink.getNextRightTupleSinkNode() ) {
+                sink.retractRightTuple( new RightTuple( rightTuple ),
+                                        context,
+                                        workingMemory );
+            }
+        }
+    }
+
+    public RightTupleSink[] getSinks() {
+        final List list = new ArrayList();
+
+        if ( this.otherSinks != null ) {
+            for ( RightTupleSinkNode sink = this.otherSinks.getFirst(); sink != null; sink = sink.getNextRightTupleSinkNode() ) {
+                list.add( sink );
+            }
+        }
+
+        if ( this.hashableSinks != null ) {
+            for ( RightTupleSinkNode sink = this.hashableSinks.getFirst(); sink != null; sink = sink.getNextRightTupleSinkNode() ) {
+                list.add( sink );
+            }
+        }
+
+        if ( this.hashedSinkMap != null ) {
+            final Iterator it = this.hashedSinkMap.newIterator();
+            for ( ObjectEntry entry = (ObjectEntry) it.next(); entry != null; entry = (ObjectEntry) it.next() ) {
+                final RightTupleSink sink = (RightTupleSink) entry.getValue();
+                list.add( sink );
+            }
+        }
+
+        return (RightTupleSink[]) list.toArray( new RightTupleSink[list.size()] );
+    }
+
+    public int size() {
+        int size = 0;
+        size += ((this.otherSinks != null) ? this.otherSinks.size() : 0);
+        size += ((this.hashableSinks != null) ? this.hashableSinks.size() : 0);
+        size += ((this.hashedSinkMap != null) ? this.hashedSinkMap.size() : 0);
+        return size;
+    }
+
+    public static class HashKey
+        implements
+        Serializable {
+        private static final long serialVersionUID = 400L;
+
+        private static final byte OBJECT           = 1;
+        private static final byte LONG             = 2;
+        private static final byte DOUBLE           = 3;
+        private static final byte BOOL             = 4;
+
+        private int               index;
+
+        private byte              type;
+        private Object            ovalue;
+        private long              lvalue;
+        private boolean           bvalue;
+        private double            dvalue;
+
+        private boolean           isNull;
+
+        private int               hashCode;
+
+        public HashKey() {
+        }
+
+        public HashKey(final int index,
+                       final FieldValue value,
+                       final Extractor extractor) {
+            this.setValue( index,
+                           extractor,
+                           value );
+        }
+
+        public HashKey(final int index,
+                       final Object value,
+                       final Extractor extractor) {
+            this.setValue( index,
+                           value,
+                           extractor );
+        }
+
+        public int getIndex() {
+            return this.index;
+        }
+
+        public void setValue(final int index,
+                             final Object value,
+                             final Extractor extractor) {
+            this.index = index;
+            final ValueType vtype = extractor.getValueType();
+
+            isNull = extractor.isNullValue( null,
+                                            value );
+
+            if ( vtype.isBoolean() ) {
+                this.type = BOOL;
+                if ( !isNull ) {
+                    this.bvalue = extractor.getBooleanValue( null,
+                                                             value );
+                    this.setHashCode( this.bvalue ? 1231 : 1237 );
+                } else {
+                    this.setHashCode( 0 );
+                }
+            } else if ( vtype.isIntegerNumber() || vtype.isChar() ) {
+                this.type = LONG;
+                if ( !isNull ) {
+                    this.lvalue = extractor.getLongValue( null,
+                                                          value );
+                    this.setHashCode( (int) (this.lvalue ^ (this.lvalue >>> 32)) );
+                } else {
+                    this.setHashCode( 0 );
+                }
+            } else if ( vtype.isFloatNumber() ) {
+                this.type = DOUBLE;
+                if ( !isNull ) {
+                    this.dvalue = extractor.getDoubleValue( null,
+                                                            value );
+                    final long temp = Double.doubleToLongBits( this.dvalue );
+                    this.setHashCode( (int) (temp ^ (temp >>> 32)) );
+                } else {
+                    this.setHashCode( 0 );
+                }
+            } else {
+                this.type = OBJECT;
+                if ( !isNull ) {
+                    this.ovalue = extractor.getValue( null,
+                                                      value );
+                    this.setHashCode( this.ovalue != null ? this.ovalue.hashCode() : 0 );
+                } else {
+                    this.setHashCode( 0 );
+                }
+            }
+        }
+
+        public void setValue(final int index,
+                             final Extractor extractor,
+                             final FieldValue value) {
+            this.index = index;
+
+            this.isNull = value.isNull();
+            final ValueType vtype = extractor.getValueType();
+
+            if ( vtype.isBoolean() ) {
+                this.type = BOOL;
+                if ( !isNull ) {
+                    this.bvalue = value.getBooleanValue();
+                    this.setHashCode( this.bvalue ? 1231 : 1237 );
+                } else {
+                    this.setHashCode( 0 );
+                }
+            } else if ( vtype.isIntegerNumber() ) {
+                this.type = LONG;
+                if ( !isNull ) {
+                    this.lvalue = value.getLongValue();
+                    this.setHashCode( (int) (this.lvalue ^ (this.lvalue >>> 32)) );
+                } else {
+                    this.setHashCode( 0 );
+                }
+            } else if ( vtype.isFloatNumber() ) {
+                this.type = DOUBLE;
+                if ( !isNull ) {
+                    this.dvalue = value.getDoubleValue();
+                    final long temp = Double.doubleToLongBits( this.dvalue );
+                    this.setHashCode( (int) (temp ^ (temp >>> 32)) );
+                } else {
+                    this.setHashCode( 0 );
+                }
+            } else {
+                this.type = OBJECT;
+                if ( !isNull ) {
+                    this.ovalue = value.getValue();
+                    this.setHashCode( this.ovalue != null ? this.ovalue.hashCode() : 0 );
+                } else {
+                    this.setHashCode( 0 );
+                }
+            }
+        }
+
+        private void setHashCode(final int hashSeed) {
+            final int PRIME = 31;
+            int result = 1;
+            result = PRIME * result + hashSeed;
+            result = PRIME * result + this.index;
+            this.hashCode = result;
+        }
+
+        public boolean getBooleanValue() {
+            switch ( this.type ) {
+                case BOOL :
+                    return this.bvalue;
+                case OBJECT :
+                    if ( this.ovalue == null ) {
+                        return false;
+                    } else if ( this.ovalue instanceof Boolean ) {
+                        return ((Boolean) this.ovalue).booleanValue();
+                    } else if ( this.ovalue instanceof String ) {
+                        return Boolean.valueOf( (String) this.ovalue ).booleanValue();
+                    } else {
+                        throw new ClassCastException( "Can't convert " + this.ovalue.getClass() + " to a boolean value." );
+                    }
+                case LONG :
+                    throw new ClassCastException( "Can't convert long to a boolean value." );
+                case DOUBLE :
+                    throw new ClassCastException( "Can't convert double to a boolean value." );
+
+            }
+            return false;
+        }
+
+        public long getLongValue() {
+            switch ( this.type ) {
+                case BOOL :
+                    return this.bvalue ? 1 : 0;
+                case OBJECT :
+                    if ( this.ovalue == null ) {
+                        return 0;
+                    } else if ( this.ovalue instanceof Number ) {
+                        return ((Number) this.ovalue).longValue();
+                    } else if ( this.ovalue instanceof String ) {
+                        return Long.parseLong( (String) this.ovalue );
+                    } else {
+                        throw new ClassCastException( "Can't convert " + this.ovalue.getClass() + " to a long value." );
+                    }
+                case LONG :
+                    return this.lvalue;
+                case DOUBLE :
+                    return (long) this.dvalue;
+
+            }
+            return 0;
+        }
+
+        public double getDoubleValue() {
+            switch ( this.type ) {
+                case BOOL :
+                    return this.bvalue ? 1 : 0;
+                case OBJECT :
+                    if ( this.ovalue == null ) {
+                        return 0;
+                    } else if ( this.ovalue instanceof Number ) {
+                        return ((Number) this.ovalue).doubleValue();
+                    } else if ( this.ovalue instanceof String ) {
+                        return Double.parseDouble( (String) this.ovalue );
+                    } else {
+                        throw new ClassCastException( "Can't convert " + this.ovalue.getClass() + " to a double value." );
+                    }
+                case LONG :
+                    return this.lvalue;
+                case DOUBLE :
+                    return this.dvalue;
+            }
+            return 0;
+        }
+
+        public Object getObjectValue() {
+            switch ( this.type ) {
+                case BOOL :
+                    return this.bvalue ? Boolean.TRUE : Boolean.FALSE;
+                case OBJECT :
+                    return this.ovalue;
+                case LONG :
+                    return new Long( this.lvalue );
+                case DOUBLE :
+                    return new Double( this.dvalue );
+            }
+            return null;
+        }
+
+        public int hashCode() {
+            return this.hashCode;
+        }
+
+        public boolean equals(final Object object) {
+            final HashKey other = (HashKey) object;
+
+            if ( this.isNull ) {
+                return (other.isNull );
+            }
+
+            switch ( this.type ) {
+                case BOOL :
+                    return (this.index == other.index) && (this.bvalue == other.getBooleanValue());
+                case LONG :
+                    return (this.index == other.index) && (this.lvalue == other.getLongValue());
+                case DOUBLE :
+                    return (this.index == other.index) && (this.dvalue == other.getDoubleValue());
+                case OBJECT :
+                    final Object otherValue = other.getObjectValue();
+                    if ( (this.ovalue != null) && (this.ovalue instanceof Number) && (otherValue instanceof Number) ) {
+                        return (this.index == other.index) && (((Number) this.ovalue).doubleValue() == ((Number) otherValue).doubleValue());
+                    }
+                    return (this.index == other.index) && (this.ovalue == null ? otherValue == null : this.ovalue.equals( otherValue ));
+            }
+            return false;
+        }
+
+    }
+
+    public static class FieldIndex
+        implements
+        Entry {
+        private static final long serialVersionUID = 400L;
+        private final int         index;
+        private FieldExtractor    fieldExtactor;
+
+        private int               count;
+
+        private boolean           hashed;
+
+        private Entry             previous;
+        private Entry             next;
+
+        public FieldIndex(final int index,
+                          final FieldExtractor fieldExtractor) {
+            this.index = index;
+            this.fieldExtactor = fieldExtractor;
+        }
+
+        public FieldExtractor getFieldExtractor() {
+            return this.fieldExtactor;
+        }
+
+        public int getIndex() {
+            return this.index;
+        }
+
+        public int getCount() {
+            return this.count;
+        }
+
+        public FieldExtractor getFieldExtactor() {
+            return this.fieldExtactor;
+        }
+
+        public boolean isHashed() {
+            return this.hashed;
+        }
+
+        public void setHashed(final boolean hashed) {
+            this.hashed = hashed;
+        }
+
+        public void increaseCounter() {
+            this.count++;
+        }
+
+        public void decreaseCounter() {
+            this.count--;
+        }
+
+        public Entry getNext() {
+            return this.next;
+        }
+
+        public Entry getPrevious() {
+            return this.previous;
+        }
+
+        public void setNext(final Entry next) {
+            this.next = next;
+
+        }
+
+        public void setPrevious(final Entry previous) {
+            this.previous = previous;
+        }
+    }
+}

Modified: labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/CompositeTupleSinkAdapter.java
===================================================================
--- labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/CompositeTupleSinkAdapter.java	2008-01-04 00:57:26 UTC (rev 17532)
+++ labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/CompositeTupleSinkAdapter.java	2008-01-04 01:54:45 UTC (rev 17533)
@@ -1,96 +1,95 @@
 package org.drools.reteoo;
 
-import org.drools.common.InternalFactHandle;
 import org.drools.common.InternalWorkingMemory;
 import org.drools.spi.PropagationContext;
 
 public class CompositeTupleSinkAdapter
     implements
-    TupleSinkPropagator {
-    private TupleSinkNodeList sinks;
+    LeftTupleSinkPropagator {
+    private LeftTupleSinkNodeList sinks;
 
     public CompositeTupleSinkAdapter() {
-        this.sinks = new TupleSinkNodeList();
+        this.sinks = new LeftTupleSinkNodeList();
     }
 
-    public void addTupleSink(final TupleSink sink) {
-        this.sinks.add( (TupleSinkNode) sink );
+    public void addTupleSink(final LeftTupleSink sink) {
+        this.sinks.add( (LeftTupleSinkNode) sink );
     }
 
-    public void removeTupleSink(final TupleSink sink) {
-        this.sinks.remove( (TupleSinkNode) sink );
+    public void removeTupleSink(final LeftTupleSink sink) {
+        this.sinks.remove( (LeftTupleSinkNode) sink );
     }
 
-    public void propagateAssertTuple(final ReteTuple tuple,
-                                     final InternalFactHandle handle,
+    public void propagateAssertTuple(final LeftTuple leftTuple,
+                                     final RightTuple rightTuple,
                                      final PropagationContext context,
                                      final InternalWorkingMemory workingMemory) {
 
-        for ( TupleSinkNode sink = this.sinks.getFirst(); sink != null; sink = sink.getNextTupleSinkNode() ) {
-            sink.assertTuple( new ReteTuple( tuple,
-                                             handle ),
+        for ( LeftTupleSinkNode sink = this.sinks.getFirst(); sink != null; sink = sink.getNextLeftTupleSinkNode() ) {
+            sink.assertTuple( new LeftTuple( leftTuple,
+                                             rightTuple ),
                               context,
                               workingMemory );
         }
     }
 
-    public void propagateAssertTuple(final ReteTuple tuple,
+    public void propagateAssertTuple(final LeftTuple tuple,
                                      final PropagationContext context,
                                      final InternalWorkingMemory workingMemory) {
-        for ( TupleSinkNode sink = this.sinks.getFirst(); sink != null; sink = sink.getNextTupleSinkNode() ) {
-            sink.assertTuple( new ReteTuple( tuple ),
+        for ( LeftTupleSinkNode sink = this.sinks.getFirst(); sink != null; sink = sink.getNextLeftTupleSinkNode() ) {
+            sink.assertTuple( new LeftTuple( tuple ),
                               context,
                               workingMemory );
         }
     }
 
-    public void propagateRetractTuple(final ReteTuple tuple,
-                                      final InternalFactHandle handle,
+    public void propagateRetractTuple(final LeftTuple leftTuple,
+                                      final RightTuple rightTuple,
                                       final PropagationContext context,
                                       final InternalWorkingMemory workingMemory) {
-        for ( TupleSinkNode sink = this.sinks.getFirst(); sink != null; sink = sink.getNextTupleSinkNode() ) {
-            sink.retractTuple( new ReteTuple( tuple,
-                                              handle ),
+        for ( LeftTupleSinkNode sink = this.sinks.getFirst(); sink != null; sink = sink.getNextLeftTupleSinkNode() ) {
+            sink.retractTuple( new LeftTuple( leftTuple,
+                                              rightTuple ),
                                context,
                                workingMemory );
         }
     }
 
-    public void propagateRetractTuple(final ReteTuple tuple,
+    public void propagateRetractTuple(final LeftTuple tuple,
                                       final PropagationContext context,
                                       final InternalWorkingMemory workingMemory) {
-        for ( TupleSinkNode sink = this.sinks.getFirst(); sink != null; sink = sink.getNextTupleSinkNode() ) {
-            sink.retractTuple( new ReteTuple( tuple ),
+        for ( LeftTupleSinkNode sink = this.sinks.getFirst(); sink != null; sink = sink.getNextLeftTupleSinkNode() ) {
+            sink.retractTuple( new LeftTuple( tuple ),
                                context,
                                workingMemory );
         }
     }
 
-    public void createAndPropagateAssertTuple(final InternalFactHandle handle,
+    public void createAndPropagateAssertTuple(final RightTuple rightTuple,
                                               final PropagationContext context,
                                               final InternalWorkingMemory workingMemory) {
-        for ( TupleSinkNode sink = this.sinks.getFirst(); sink != null; sink = sink.getNextTupleSinkNode() ) {
-            sink.assertTuple( new ReteTuple( handle ),
+        for ( LeftTupleSinkNode sink = this.sinks.getFirst(); sink != null; sink = sink.getNextLeftTupleSinkNode() ) {
+            sink.assertTuple( new LeftTuple( rightTuple ),
                               context,
                               workingMemory );
         }
     }
 
-    public void createAndPropagateRetractTuple(final InternalFactHandle handle,
+    public void createAndPropagateRetractTuple(final RightTuple rightTuple,
                                                final PropagationContext context,
                                                final InternalWorkingMemory workingMemory) {
-        for ( TupleSinkNode sink = this.sinks.getFirst(); sink != null; sink = sink.getNextTupleSinkNode() ) {
-            sink.retractTuple( new ReteTuple( handle ),
+        for ( LeftTupleSinkNode sink = this.sinks.getFirst(); sink != null; sink = sink.getNextLeftTupleSinkNode() ) {
+            sink.retractTuple( new LeftTuple( rightTuple ),
                                context,
                                workingMemory );
         }
     }
 
-    public TupleSink[] getSinks() {
-        final TupleSink[] sinkArray = new TupleSink[this.sinks.size()];
+    public LeftTupleSink[] getSinks() {
+        final LeftTupleSink[] sinkArray = new LeftTupleSink[this.sinks.size()];
 
         int i = 0;
-        for ( TupleSinkNode sink = this.sinks.getFirst(); sink != null; sink = sink.getNextTupleSinkNode() ) {
+        for ( LeftTupleSinkNode sink = this.sinks.getFirst(); sink != null; sink = sink.getNextLeftTupleSinkNode() ) {
             sinkArray[i++] = sink;
         }
 

Copied: labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/EmptyLeftTupleSinkAdapter.java (from rev 17522, labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/EmptyTupleSinkAdapter.java)
===================================================================
--- labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/EmptyLeftTupleSinkAdapter.java	                        (rev 0)
+++ labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/EmptyLeftTupleSinkAdapter.java	2008-01-04 01:54:45 UTC (rev 17533)
@@ -0,0 +1,58 @@
+package org.drools.reteoo;
+
+import org.drools.common.InternalWorkingMemory;
+import org.drools.spi.PropagationContext;
+
+public class EmptyLeftTupleSinkAdapter
+    implements
+    LeftTupleSinkPropagator {
+
+    private static final EmptyLeftTupleSinkAdapter instance = new EmptyLeftTupleSinkAdapter();
+
+    public static final EmptyLeftTupleSinkAdapter getInstance() {
+        return instance;
+    }
+
+    private EmptyLeftTupleSinkAdapter() {
+    }
+
+    public void propagateAssertTuple(final LeftTuple leftTuple,
+                                     final RightTuple rightTuple,
+                                     final PropagationContext context,
+                                     final InternalWorkingMemory workingMemory) {
+    }
+
+    public void propagateAssertTuple(final LeftTuple tuple,
+                                     final PropagationContext context,
+                                     final InternalWorkingMemory workingMemory) {
+    }
+
+    public void propagateRetractTuple(final LeftTuple leftTuple,
+                                      final RightTuple rightTuple,
+                                      final PropagationContext context,
+                                      final InternalWorkingMemory workingMemory) {
+    }
+
+    public void propagateRetractTuple(final LeftTuple tuple,
+                                      final PropagationContext context,
+                                      final InternalWorkingMemory workingMemory) {
+    }
+
+    public void createAndPropagateAssertTuple(final RightTuple rightTuple,
+                                              final PropagationContext context,
+                                              final InternalWorkingMemory workingMemory) {
+    }
+
+    public void createAndPropagateRetractTuple(final RightTuple rightTuple,
+                                               final PropagationContext context,
+                                               final InternalWorkingMemory workingMemory) {
+    }
+
+    public LeftTupleSink[] getSinks() {
+        return new LeftTupleSink[]{};
+    }
+
+    public int size() {
+        return 0;
+    }
+}

Deleted: labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/EmptyObjectSinkAdapter.java
===================================================================
--- labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/EmptyObjectSinkAdapter.java	2008-01-04 00:57:26 UTC (rev 17532)
+++ labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/EmptyObjectSinkAdapter.java	2008-01-04 01:54:45 UTC (rev 17533)
@@ -1,44 +0,0 @@
-package org.drools.reteoo;
-
-import org.drools.common.InternalFactHandle;
-import org.drools.common.InternalWorkingMemory;
-import org.drools.spi.PropagationContext;
-
-public class EmptyObjectSinkAdapter
-    implements
-    ObjectSinkPropagator {
-
-    private static final long serialVersionUID = -631743913176779720L;
-
-    private static final EmptyObjectSinkAdapter instance = new EmptyObjectSinkAdapter();
-    
-    private static final ObjectSink[] SINK_LIST = new ObjectSink[0];
-
-    public static EmptyObjectSinkAdapter getInstance() {
-        return instance;
-    }
-
-    private EmptyObjectSinkAdapter() {
-    }
-
-    public void propagateAssertObject(final InternalFactHandle handle,
-                                      final PropagationContext context,
-                                      final InternalWorkingMemory workingMemory) {
-
-    }
-
-    public void propagateRetractObject(final InternalFactHandle handle,
-                                       final PropagationContext context,
-                                       final InternalWorkingMemory workingMemory,
-                                       final boolean useHash) {
-    }
-
-    public ObjectSink[] getSinks() {
-        return SINK_LIST;
-    }
-    
-    public int size() {
-        return 0;
-    }
-
-}

Copied: labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/EmptyRightTupleSinkAdapter.java (from rev 17522, labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/EmptyObjectSinkAdapter.java)
===================================================================
--- labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/EmptyRightTupleSinkAdapter.java	                        (rev 0)
+++ labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/EmptyRightTupleSinkAdapter.java	2008-01-04 01:54:45 UTC (rev 17533)
@@ -0,0 +1,43 @@
+package org.drools.reteoo;
+
+import org.drools.common.InternalWorkingMemory;
+import org.drools.spi.PropagationContext;
+
+public class EmptyRightTupleSinkAdapter
+    implements
+    RightTupletSinkPropagator {
+
+    private static final long serialVersionUID = -631743913176779720L;
+
+    private static final EmptyRightTupleSinkAdapter instance = new EmptyRightTupleSinkAdapter();
+    
+    private static final RightTupleSink[] SINK_LIST = new RightTupleSink[0];
+
+    public static EmptyRightTupleSinkAdapter getInstance() {
+        return instance;
+    }
+
+    private EmptyRightTupleSinkAdapter() {
+    }
+
+    public void propagateAssertRightTuple(final RightTuple rightTuple,
+                                      final PropagationContext context,
+                                      final InternalWorkingMemory workingMemory) {
+
+    }
+
+    public void propagateRetractRightTuple(final RightTuple rightTuple,
+                                       final PropagationContext context,
+                                       final InternalWorkingMemory workingMemory,
+                                       final boolean useHash) {
+    }
+
+    public RightTupleSink[] getSinks() {
+        return SINK_LIST;
+    }
+    
+    public int size() {
+        return 0;
+    }
+
+}

Deleted: labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/EmptyTupleSinkAdapter.java
===================================================================
--- labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/EmptyTupleSinkAdapter.java	2008-01-04 00:57:26 UTC (rev 17532)
+++ labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/EmptyTupleSinkAdapter.java	2008-01-04 01:54:45 UTC (rev 17533)
@@ -1,59 +0,0 @@
-package org.drools.reteoo;
-
-import org.drools.common.InternalFactHandle;
-import org.drools.common.InternalWorkingMemory;
-import org.drools.spi.PropagationContext;
-
-public class EmptyTupleSinkAdapter
-    implements
-    TupleSinkPropagator {
-
-    private static final EmptyTupleSinkAdapter instance = new EmptyTupleSinkAdapter();
-
-    public static final EmptyTupleSinkAdapter getInstance() {
-        return instance;
-    }
-
-    private EmptyTupleSinkAdapter() {
-    }
-
-    public void propagateAssertTuple(final ReteTuple tuple,
-                                     final InternalFactHandle handle,
-                                     final PropagationContext context,
-                                     final InternalWorkingMemory workingMemory) {
-    }
-
-    public void propagateAssertTuple(final ReteTuple tuple,
-                                     final PropagationContext context,
-                                     final InternalWorkingMemory workingMemory) {
-    }
-
-    public void propagateRetractTuple(final ReteTuple tuple,
-                                      final InternalFactHandle handle,
-                                      final PropagationContext context,
-                                      final InternalWorkingMemory workingMemory) {
-    }
-
-    public void propagateRetractTuple(final ReteTuple tuple,
-                                      final PropagationContext context,
-                                      final InternalWorkingMemory workingMemory) {
-    }
-
-    public void createAndPropagateAssertTuple(final InternalFactHandle handle,
-                                              final PropagationContext context,
-                                              final InternalWorkingMemory workingMemory) {
-    }
-
-    public void createAndPropagateRetractTuple(final InternalFactHandle handle,
-                                               final PropagationContext context,
-                                               final InternalWorkingMemory workingMemory) {
-    }
-
-    public TupleSink[] getSinks() {
-        return new TupleSink[]{};
-    }
-
-    public int size() {
-        return 0;
-    }
-}

Modified: labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/EvalConditionNode.java
===================================================================
--- labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/EvalConditionNode.java	2008-01-04 00:57:26 UTC (rev 17532)
+++ labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/EvalConditionNode.java	2008-01-04 01:54:45 UTC (rev 17533)
@@ -37,14 +37,14 @@
  * 
  * @see EvalConditionNode
  * @see Eval
- * @see ReteTuple
+ * @see LeftTuple
  * 
  * @author <a href="mailto:mark.proctor at jboss.com">Mark Proctor</a>
  * @author <a href="mailto:bob at werken.com">Bob McWhirter</a>
  */
-public class EvalConditionNode extends TupleSource
+public class EvalConditionNode extends LeftTupleSource
     implements
-    TupleSinkNode,
+    LeftTupleSinkNode,
     NodeMemory {
     // ------------------------------------------------------------
     // Instance members
@@ -59,12 +59,12 @@
     private final EvalCondition condition;
 
     /** The source of incoming <code>Tuples</code>. */
-    private final TupleSource   tupleSource;
+    private final LeftTupleSource   tupleSource;
     
     protected boolean          tupleMemoryEnabled;        
 
-    private TupleSinkNode       previousTupleSinkNode;
-    private TupleSinkNode       nextTupleSinkNode;
+    private LeftTupleSinkNode       previousTupleSinkNode;
+    private LeftTupleSinkNode       nextTupleSinkNode;
 
     // ------------------------------------------------------------
     // Constructors
@@ -80,7 +80,7 @@
      * @param eval
      */
     public EvalConditionNode(final int id,
-                             final TupleSource tupleSource,
+                             final LeftTupleSource tupleSource,
                              final EvalCondition eval,
                              final BuildContext context) {
         super( id );
@@ -138,7 +138,7 @@
      * @throws AssertionException
      *             If an error occurs while asserting.
      */
-    public void assertTuple(final ReteTuple tuple,
+    public void assertTuple(final LeftTuple tuple,
                             final PropagationContext context,
                             final InternalWorkingMemory workingMemory) {
 
@@ -157,13 +157,13 @@
         }
     }
 
-    public void retractTuple(final ReteTuple tuple,
+    public void retractTuple(final LeftTuple tuple,
                              final PropagationContext context,
                              final InternalWorkingMemory workingMemory) {
         final TupleHashTable memory = (TupleHashTable) workingMemory.getNodeMemory( this );
 
         // can we improve that?
-        final ReteTuple memTuple = memory.remove( tuple );
+        final LeftTuple memTuple = memory.remove( tuple );
         if ( memTuple != null ) {
             this.sink.propagateRetractTuple( memTuple,
                                              context,
@@ -205,14 +205,14 @@
     /* (non-Javadoc)
      * @see org.drools.reteoo.BaseNode#updateNewNode(org.drools.reteoo.WorkingMemoryImpl, org.drools.spi.PropagationContext)
      */
-    public void updateSink(final TupleSink sink,
+    public void updateSink(final LeftTupleSink sink,
                            final PropagationContext context,
                            final InternalWorkingMemory workingMemory) {
 
         final TupleHashTable memory = (TupleHashTable) workingMemory.getNodeMemory( this );
 
         final Iterator it = memory.iterator();
-        for ( ReteTuple tuple = (ReteTuple) it.next(); tuple != null; tuple = (ReteTuple) it.next() ) {
+        for ( LeftTuple tuple = (LeftTuple) it.next(); tuple != null; tuple = (LeftTuple) it.next() ) {
             sink.assertTuple( tuple,
                               context,
                               workingMemory );
@@ -222,7 +222,7 @@
     public void remove(final BaseNode node,
                        final InternalWorkingMemory[] workingMemories) {
         if ( !node.isInUse() ) {
-            removeTupleSink( (TupleSink) node );
+            removeTupleSink( (LeftTupleSink) node );
         }
         removeShare();
         if ( !this.isInUse() ) {
@@ -248,7 +248,7 @@
      * @return
      *      The next TupleSinkNode
      */
-    public TupleSinkNode getNextTupleSinkNode() {
+    public LeftTupleSinkNode getNextLeftTupleSinkNode() {
         return this.nextTupleSinkNode;
     }
 
@@ -257,7 +257,7 @@
      * @param next
      *      The next TupleSinkNode
      */
-    public void setNextTupleSinkNode(final TupleSinkNode next) {
+    public void setNextLeftTupleSinkNode(final LeftTupleSinkNode next) {
         this.nextTupleSinkNode = next;
     }
 
@@ -266,7 +266,7 @@
      * @return
      *      The previous TupleSinkNode
      */
-    public TupleSinkNode getPreviousTupleSinkNode() {
+    public LeftTupleSinkNode getPreviousRightTupleSinkNode() {
         return this.previousTupleSinkNode;
     }
 
@@ -275,7 +275,7 @@
      * @param previous
      *      The previous TupleSinkNode
      */
-    public void setPreviousTupleSinkNode(final TupleSinkNode previous) {
+    public void setPreviousLeftTupleSinkNode(final LeftTupleSinkNode previous) {
         this.previousTupleSinkNode = previous;
     }
 

Modified: labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/ExistsNode.java
===================================================================
--- labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/ExistsNode.java	2008-01-04 00:57:26 UTC (rev 17532)
+++ labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/ExistsNode.java	2008-01-04 01:54:45 UTC (rev 17533)
@@ -63,8 +63,8 @@
      *            The constraints to be applied to the right objects
      */
     public ExistsNode(final int id,
-                      final TupleSource leftInput,
-                      final ObjectSource rightInput,
+                      final LeftTupleSource leftInput,
+                      final RightTupleSource rightInput,
                       final BetaConstraints joinNodeBinder,
                       final BuildContext context) {
         super( id,
@@ -86,16 +86,16 @@
      * @param workingMemory
      *            The working memory session.
      */
-    public void assertTuple(final ReteTuple leftTuple,
+    public void assertTuple(final LeftTuple leftTuple,
                             final PropagationContext context,
                             final InternalWorkingMemory workingMemory) {
         final BetaMemory memory = (BetaMemory) workingMemory.getNodeMemory( this );
         
         if ( this.tupleMemoryEnabled ) {
-            memory.getTupleMemory().add( leftTuple );
+            memory.getLeftTupleMemory().add( leftTuple );
         }
 
-        final Iterator it = memory.getFactHandleMemory().iterator( leftTuple );
+        final Iterator it = memory.getRightTupleMemory().iterator( leftTuple );
         this.constraints.updateFromTuple( workingMemory,
                                           leftTuple );
         for ( FactEntry entry = (FactEntry) it.next(); entry != null; entry = (FactEntry) it.next() ) {            
@@ -118,30 +118,30 @@
      * matches any left ReteTuple's that had no matches before, propagate 
      * tuple as an assertion.
      * 
-     * @param handle
+     * @param rightTuple
      *            The <code>FactHandleImpl</code> being asserted.
      * @param context
      *            The <code>PropagationContext</code>
      * @param workingMemory
      *            The working memory session.
      */
-    public void assertObject(final InternalFactHandle handle,
+    public void assertRightTuple(final RightTuple rightTuple,
                              final PropagationContext context,
                              final InternalWorkingMemory workingMemory) {
         final BetaMemory memory = (BetaMemory) workingMemory.getNodeMemory( this );
-        memory.getFactHandleMemory().add( handle );
+        memory.getRightTupleMemory().add( rightTuple );
         
         if ( !this.tupleMemoryEnabled ) {
             // do nothing here, as we know there are no left tuples at this stage in sequential mode.
             return;
         }          
 
-        final Iterator it = memory.getTupleMemory().iterator( handle );
-        this.constraints.updateFromFactHandle( workingMemory,
-                                               handle );
-        for ( ReteTuple tuple = (ReteTuple) it.next(); tuple != null; tuple = (ReteTuple) it.next() ) {
+        final Iterator it = memory.getLeftTupleMemory().iterator( rightTuple );
+        this.constraints.updateFromRightTuple( workingMemory,
+                                               rightTuple );
+        for ( LeftTuple tuple = (LeftTuple) it.next(); tuple != null; tuple = (LeftTuple) it.next() ) {
             if ( this.constraints.isAllowedCachedRight( tuple ) && tuple.getMatch() == null) {
-                    tuple.setMatch( handle );
+                    tuple.setMatch( rightTuple );
                     this.sink.propagateAssertTuple( tuple,
                                                      context,
                                                      workingMemory );                                 
@@ -154,32 +154,32 @@
      * <code>ReteTuple</code> matches and those tuples now have no
      * other match, retract tuple
      * 
-     * @param handle
+     * @param rightTuple
      *            the <codeFactHandleImpl</code> being retracted
      * @param context
      *            The <code>PropagationContext</code>
      * @param workingMemory
      *            The working memory session.
      */
-    public void retractObject(final InternalFactHandle handle,
+    public void retractRightTuple(final RightTuple rightTuple,
                               final PropagationContext context,
                               final InternalWorkingMemory workingMemory) {
         final BetaMemory memory = (BetaMemory) workingMemory.getNodeMemory( this );
-        if ( !memory.getFactHandleMemory().remove( handle ) ) {
+        if ( !memory.getRightTupleMemory().remove( rightTuple ) ) {
             return;
         }
 
-        final Iterator it = memory.getTupleMemory().iterator( handle );
-        this.constraints.updateFromFactHandle( workingMemory,
-                                               handle );
-        for ( ReteTuple tuple = (ReteTuple) it.next(); tuple != null; tuple = (ReteTuple) it.next() ) {
+        final Iterator it = memory.getLeftTupleMemory().iterator( rightTuple );
+        this.constraints.updateFromRightTuple( workingMemory,
+                                               rightTuple );
+        for ( LeftTuple tuple = (LeftTuple) it.next(); tuple != null; tuple = (LeftTuple) it.next() ) {
             if ( this.constraints.isAllowedCachedRight( tuple ) ) {
-                if ( tuple.getMatch() == handle ) {
+                if ( tuple.getMatch() == rightTuple ) {
                     // reset the match                    
                     tuple.setMatch( null );
                     
                     // find next match, remember it and break.
-                    final Iterator tupleIt = memory.getFactHandleMemory().iterator( tuple );
+                    final Iterator tupleIt = memory.getRightTupleMemory().iterator( tuple );
                     this.constraints.updateFromTuple( workingMemory, tuple );
                     
                     for ( FactEntry entry = (FactEntry) tupleIt.next(); entry != null; entry = (FactEntry) tupleIt.next() ) {
@@ -213,13 +213,13 @@
      * @param workingMemory
      *            The working memory session.
      */
-    public void retractTuple(final ReteTuple leftTuple,
+    public void retractTuple(final LeftTuple leftTuple,
                              final PropagationContext context,
                              final InternalWorkingMemory workingMemory) {
         final BetaMemory memory = (BetaMemory) workingMemory.getNodeMemory( this );
 
         // Must use the tuple in memory as it has the tuple matches count
-        final ReteTuple tuple = memory.getTupleMemory().remove( leftTuple );
+        final LeftTuple tuple = memory.getLeftTupleMemory().remove( leftTuple );
         if ( tuple == null ) {
             return;
         }
@@ -235,15 +235,15 @@
      * Updates the given sink propagating all previously propagated tuples to it
      * 
      */
-    public void updateSink(final TupleSink sink,
+    public void updateSink(final LeftTupleSink sink,
                            final PropagationContext context,
                            final InternalWorkingMemory workingMemory) {
         final BetaMemory memory = (BetaMemory) workingMemory.getNodeMemory( this );
 
-        final Iterator tupleIter = memory.getTupleMemory().iterator();
-        for ( ReteTuple tuple = (ReteTuple) tupleIter.next(); tuple != null; tuple = (ReteTuple) tupleIter.next() ) {
+        final Iterator tupleIter = memory.getLeftTupleMemory().iterator();
+        for ( LeftTuple tuple = (LeftTuple) tupleIter.next(); tuple != null; tuple = (LeftTuple) tupleIter.next() ) {
             if ( tuple.getMatch() != null ) {
-                sink.assertTuple( new ReteTuple( tuple ),
+                sink.assertTuple( new LeftTuple( tuple ),
                                   context,
                                   workingMemory );
             }
@@ -251,7 +251,7 @@
     }
 
     public String toString() {
-        ObjectSource source = this.rightInput;
+        RightTupleSource source = this.rightInput;
         while ( source.getClass() != ObjectTypeNode.class ) {
             source = source.objectSource;
         }

Deleted: labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/FactHandleMemory.java
===================================================================
--- labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/FactHandleMemory.java	2008-01-04 00:57:26 UTC (rev 17532)
+++ labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/FactHandleMemory.java	2008-01-04 01:54:45 UTC (rev 17533)
@@ -1,27 +0,0 @@
-package org.drools.reteoo;
-
-import org.drools.common.InternalFactHandle;
-import org.drools.util.Entry;
-import org.drools.util.Iterator;
-
-public interface FactHandleMemory {
-    public Iterator iterator();
-
-    public Iterator iterator(ReteTuple tuple);
-
-    public boolean add(InternalFactHandle handle,
-                       boolean checkExists);
-
-    public boolean add(InternalFactHandle handle);
-
-    public boolean remove(InternalFactHandle handle);
-
-    public boolean contains(InternalFactHandle handle);
-
-    public boolean isIndexed();
-
-    public int size();
-
-//    public Entry[] getTable();
-
-}

Modified: labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/FromNode.java
===================================================================
--- labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/FromNode.java	2008-01-04 00:57:26 UTC (rev 17532)
+++ labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/FromNode.java	2008-01-04 01:54:45 UTC (rev 17533)
@@ -16,9 +16,9 @@
 import org.drools.util.LinkedListEntry;
 import org.drools.util.TupleHashTable;
 
-public class FromNode extends TupleSource
+public class FromNode extends LeftTupleSource
     implements
-    TupleSinkNode,
+    LeftTupleSinkNode,
     NodeMemory {
     /**
      * 
@@ -26,18 +26,18 @@
     private static final long          serialVersionUID = 400L;
 
     private DataProvider               dataProvider;
-    private TupleSource                tupleSource;
+    private LeftTupleSource                tupleSource;
     private AlphaNodeFieldConstraint[] alphaConstraints;
     private BetaConstraints            betaConstraints;
 
-    private TupleSinkNode              previousTupleSinkNode;
-    private TupleSinkNode              nextTupleSinkNode;
+    private LeftTupleSinkNode              previousTupleSinkNode;
+    private LeftTupleSinkNode              nextTupleSinkNode;
     
     protected boolean                 tupleMemoryEnabled;      
 
     public FromNode(final int id,
                     final DataProvider dataProvider,
-                    final TupleSource tupleSource,
+                    final LeftTupleSource tupleSource,
                     final AlphaNodeFieldConstraint[] constraints,
                     final BetaConstraints binder) {
         super( id );
@@ -51,12 +51,12 @@
     /**
      * @inheritDoc 
      */
-    public void assertTuple(final ReteTuple leftTuple,
+    public void assertTuple(final LeftTuple leftTuple,
                             final PropagationContext context,
                             final InternalWorkingMemory workingMemory) {
         final BetaMemory memory = (BetaMemory) workingMemory.getNodeMemory( this );
 
-        memory.getTupleMemory().add( leftTuple );
+        memory.getLeftTupleMemory().add( leftTuple );
         final LinkedList list = new LinkedList();
         this.betaConstraints.updateFromTuple( workingMemory,
                                               leftTuple );
@@ -99,12 +99,12 @@
 
     }
 
-    public void retractTuple(final ReteTuple leftTuple,
+    public void retractTuple(final LeftTuple leftTuple,
                              final PropagationContext context,
                              final InternalWorkingMemory workingMemory) {
 
         final BetaMemory memory = (BetaMemory) workingMemory.getNodeMemory( this );
-        final ReteTuple tuple = memory.getTupleMemory().remove( leftTuple );
+        final LeftTuple tuple = memory.getLeftTupleMemory().remove( leftTuple );
 
         final LinkedList list = (LinkedList) memory.getCreatedHandles().remove( tuple );
         // if tuple was propagated
@@ -143,7 +143,7 @@
                        final InternalWorkingMemory[] workingMemories) {
 
         if ( !node.isInUse() ) {
-            removeTupleSink( (TupleSink) node );
+            removeTupleSink( (LeftTupleSink) node );
         }
         removeShare();
 
@@ -156,14 +156,14 @@
                                  workingMemories );
     }
 
-    public void updateSink(final TupleSink sink,
+    public void updateSink(final LeftTupleSink sink,
                            final PropagationContext context,
                            final InternalWorkingMemory workingMemory) {
 
         final BetaMemory memory = (BetaMemory) workingMemory.getNodeMemory( this );
 
-        final Iterator tupleIter = memory.getTupleMemory().iterator();
-        for ( ReteTuple tuple = (ReteTuple) tupleIter.next(); tuple != null; tuple = (ReteTuple) tupleIter.next() ) {
+        final Iterator tupleIter = memory.getLeftTupleMemory().iterator();
+        for ( LeftTuple tuple = (LeftTuple) tupleIter.next(); tuple != null; tuple = (LeftTuple) tupleIter.next() ) {
             final LinkedList list = (LinkedList) memory.getCreatedHandles().remove( tuple );
             if ( list == null ) {
                 continue;
@@ -197,7 +197,7 @@
      * @return
      *      The next TupleSinkNode
      */
-    public TupleSinkNode getNextTupleSinkNode() {
+    public LeftTupleSinkNode getNextLeftTupleSinkNode() {
         return this.nextTupleSinkNode;
     }
 
@@ -206,7 +206,7 @@
      * @param next
      *      The next TupleSinkNode
      */
-    public void setNextTupleSinkNode(final TupleSinkNode next) {
+    public void setNextLeftTupleSinkNode(final LeftTupleSinkNode next) {
         this.nextTupleSinkNode = next;
     }
 
@@ -215,7 +215,7 @@
      * @return
      *      The previous TupleSinkNode
      */
-    public TupleSinkNode getPreviousTupleSinkNode() {
+    public LeftTupleSinkNode getPreviousRightTupleSinkNode() {
         return this.previousTupleSinkNode;
     }
 
@@ -224,7 +224,7 @@
      * @param previous
      *      The previous TupleSinkNode
      */
-    public void setPreviousTupleSinkNode(final TupleSinkNode previous) {
+    public void setPreviousLeftTupleSinkNode(final LeftTupleSinkNode previous) {
         this.previousTupleSinkNode = previous;
     }
 

Modified: labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/JoinNode.java
===================================================================
--- labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/JoinNode.java	2008-01-04 00:57:26 UTC (rev 17532)
+++ labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/JoinNode.java	2008-01-04 01:54:45 UTC (rev 17533)
@@ -21,7 +21,6 @@
 import org.drools.common.InternalWorkingMemory;
 import org.drools.reteoo.builder.BuildContext;
 import org.drools.spi.PropagationContext;
-import org.drools.util.FactEntry;
 import org.drools.util.Iterator;
 
 /**
@@ -43,7 +42,7 @@
  * @see BetaNode
  * @see ObjectMatches
  * @see TupleMatch
- * @see TupleSink
+ * @see LeftTupleSink
  * 
  * @author <a href="mailto:mark.proctor at jboss.com">Mark Proctor</a>
  * @author <a href="mailto:bob at werken.com">Bob McWhirter</a>
@@ -60,8 +59,8 @@
     private static final long serialVersionUID = 400L;
 
     public JoinNode(final int id,
-                    final TupleSource leftInput,
-                    final ObjectSource rightInput,
+                    final LeftTupleSource leftInput,
+                    final RightTupleSource rightInput,
                     final BetaConstraints binder,
                     final BuildContext context) {
         super( id,
@@ -77,9 +76,9 @@
      * binder, any successful bindings results in joined tuples being created
      * and propaged. there is a joined tuple per TupleSink.
      * 
-     * @see ReteTuple
+     * @see LeftTuple
      * @see ObjectMatches
-     * @see TupleSink
+     * @see LeftTupleSink
      * @see TupleMatch
      * 
      * @param tuple
@@ -89,23 +88,23 @@
      * @param workingMemory
      *            The working memory seesion.
      */
-    public void assertTuple(final ReteTuple leftTuple,
+    public void assertTuple(final LeftTuple leftTuple,
                             final PropagationContext context,
                             final InternalWorkingMemory workingMemory) {
         final BetaMemory memory = (BetaMemory) workingMemory.getNodeMemory( this );
         
         if ( this.tupleMemoryEnabled ) {
-            memory.getTupleMemory().add( leftTuple );
+            memory.getLeftTupleMemory().add( leftTuple );
         }
 
-        final Iterator it = memory.getFactHandleMemory().iterator( leftTuple );
+        final Iterator it = memory.getRightTupleMemory().iterator( leftTuple );
         this.constraints.updateFromTuple( workingMemory,
                                           leftTuple );
-        for ( FactEntry entry = (FactEntry) it.next(); entry != null; entry = (FactEntry) it.next() ) {
-            final InternalFactHandle handle = entry.getFactHandle();
-            if ( this.constraints.isAllowedCachedLeft( handle ) ) {
+        
+        for ( RightTuple entry = (RightTuple) it.next(); entry != null; entry = (RightTuple) it.next() ) {
+            if ( this.constraints.isAllowedCachedLeft( entry.getHandle() ) ) {
                 this.sink.propagateAssertTuple( leftTuple,
-                                                handle,
+                                                entry,
                                                 context,
                                                 workingMemory );
             }
@@ -118,36 +117,38 @@
      * binder, any successful bindings results in joined tuples being created
      * and propaged. there is a joined tuple per TupleSink.
      * 
-     * @see ReteTuple
+     * @see LeftTuple
      * @see ObjectMatches
-     * @see TupleSink
+     * @see LeftTupleSink
      * @see TupleMatch
      * 
-     * @param handle
+     * @param rightTuple
      *            The <code>FactHandleImpl</code> being asserted.
      * @param context
      *            The <code>PropagationContext</code>
      * @param workingMemory
      *            The working memory seesion.
      */
-    public void assertObject(final InternalFactHandle handle,
+    public void assertRightTuple(final RightTuple rightTuple,
                              final PropagationContext context,
                              final InternalWorkingMemory workingMemory) {
         final BetaMemory memory = (BetaMemory) workingMemory.getNodeMemory( this );
 
-        memory.getFactHandleMemory().add( handle );
+        //new RightTuple()
+        
+        memory.getRightTupleMemory().add( rightTuple );
         if ( ! this.tupleMemoryEnabled ) {
             // do nothing here, as we know there are no left tuples at this stage in sequential mode.
             return;
         }
 
-        final Iterator it = memory.getTupleMemory().iterator( handle );
-        this.constraints.updateFromFactHandle( workingMemory,
-                                               handle );
-        for ( ReteTuple tuple = (ReteTuple) it.next(); tuple != null; tuple = (ReteTuple) it.next() ) {
-            if ( this.constraints.isAllowedCachedRight( tuple ) ) {
-                this.sink.propagateAssertTuple( tuple,
-                                                handle,
+        final Iterator it = memory.getLeftTupleMemory().iterator( rightTuple );
+        this.constraints.updateFromRightTuple( workingMemory,
+                                               rightTuple );
+        for ( LeftTuple leftTuple = (LeftTuple) it.next(); leftTuple != null; leftTuple = (LeftTuple) it.next() ) {
+            if ( this.constraints.isAllowedCachedRight( leftTuple ) ) {
+                this.sink.propagateAssertTuple( leftTuple,
+                                                rightTuple,
                                                 context,
                                                 workingMemory );
             }
@@ -158,28 +159,28 @@
      * Retract a FactHandleImpl. Iterates the referenced TupleMatches stored in
      * the handle's ObjectMatches retracting joined tuples.
      * 
-     * @param handle
+     * @param rightTuple
      *            the <codeFactHandleImpl</code> being retracted
      * @param context
      *            The <code>PropagationContext</code>
      * @param workingMemory
      *            The working memory seesion.
      */
-    public void retractObject(final InternalFactHandle handle,
+    public void retractRightTuple(final RightTuple rightTuple,
                               final PropagationContext context,
                               final InternalWorkingMemory workingMemory) {
         final BetaMemory memory = (BetaMemory) workingMemory.getNodeMemory( this );
-        if ( !memory.getFactHandleMemory().remove( handle ) ) {
+        if ( !memory.getRightTupleMemory().remove( rightTuple ) ) {
             return;
         }
 
-        final Iterator it = memory.getTupleMemory().iterator( handle );
-        this.constraints.updateFromFactHandle( workingMemory,
-                                               handle );
-        for ( ReteTuple tuple = (ReteTuple) it.next(); tuple != null; tuple = (ReteTuple) it.next() ) {
+        final Iterator it = memory.getLeftTupleMemory().iterator( rightTuple );
+        this.constraints.updateFromRightTuple( workingMemory,
+                                               rightTuple );
+        for ( LeftTuple tuple = (LeftTuple) it.next(); tuple != null; tuple = (LeftTuple) it.next() ) {
             if ( this.constraints.isAllowedCachedRight( tuple ) ) {
                 this.sink.propagateRetractTuple( tuple,
-                                                 handle,
+                                                 rightTuple,
                                                  context,
                                                  workingMemory );
             }
@@ -198,23 +199,22 @@
      * @param workingMemory
      *            The working memory seesion.
      */
-    public void retractTuple(final ReteTuple leftTuple,
+    public void retractTuple(final LeftTuple leftTuple,
                              final PropagationContext context,
                              final InternalWorkingMemory workingMemory) {
         final BetaMemory memory = (BetaMemory) workingMemory.getNodeMemory( this );
-        final ReteTuple tuple = memory.getTupleMemory().remove( leftTuple );
+        final LeftTuple tuple = memory.getLeftTupleMemory().remove( leftTuple );
         if ( tuple == null ) {
             return;
         }
 
-        final Iterator it = memory.getFactHandleMemory().iterator( leftTuple );
+        final Iterator it = memory.getRightTupleMemory().iterator( leftTuple );
         this.constraints.updateFromTuple( workingMemory,
                                           leftTuple );
-        for ( FactEntry entry = (FactEntry) it.next(); entry != null; entry = (FactEntry) it.next() ) {
-            final InternalFactHandle handle = entry.getFactHandle();
-            if ( this.constraints.isAllowedCachedLeft( handle ) ) {
+        for ( RightTuple rightTuple = (RightTuple) it.next(); rightTuple != null; rightTuple = (RightTuple) it.next() ) {
+            if ( this.constraints.isAllowedCachedLeft( rightTuple.getHandle() ) ) {
                 this.sink.propagateRetractTuple( leftTuple,
-                                                 handle,
+                                                 rightTuple,
                                                  context,
                                                  workingMemory );
             }
@@ -224,22 +224,21 @@
     /* (non-Javadoc)
      * @see org.drools.reteoo.BaseNode#updateNewNode(org.drools.reteoo.WorkingMemoryImpl, org.drools.spi.PropagationContext)
      */
-    public void updateSink(final TupleSink sink,
+    public void updateSink(final LeftTupleSink sink,
                            final PropagationContext context,
                            final InternalWorkingMemory workingMemory) {
 
         final BetaMemory memory = (BetaMemory) workingMemory.getNodeMemory( this );
 
-        final Iterator tupleIter = memory.getTupleMemory().iterator();
-        for ( ReteTuple tuple = (ReteTuple) tupleIter.next(); tuple != null; tuple = (ReteTuple) tupleIter.next() ) {
-            final Iterator objectIter = memory.getFactHandleMemory().iterator( tuple );
+        final Iterator tupleIter = memory.getLeftTupleMemory().iterator();
+        for ( LeftTuple tuple = (LeftTuple) tupleIter.next(); tuple != null; tuple = (LeftTuple) tupleIter.next() ) {
+            final Iterator objectIter = memory.getRightTupleMemory().iterator( tuple );
             this.constraints.updateFromTuple( workingMemory,
                                               tuple );
-            for ( FactEntry entry = (FactEntry) objectIter.next(); entry != null; entry = (FactEntry) objectIter.next() ) {
-                final InternalFactHandle handle = entry.getFactHandle();
-                if ( this.constraints.isAllowedCachedLeft( handle ) ) {
-                    sink.assertTuple( new ReteTuple( tuple,
-                                                     handle ),
+            for ( RightTuple rightTuple = (RightTuple) objectIter.next(); rightTuple != null; rightTuple = (RightTuple) objectIter.next() ) {
+                if ( this.constraints.isAllowedCachedLeft( rightTuple.getHandle() ) ) {
+                    sink.assertTuple( new LeftTuple( tuple,
+                                                     rightTuple ),
                                       context,
                                       workingMemory );
                 }
@@ -248,7 +247,7 @@
     }
 
     public String toString() {
-        ObjectSource source = this.rightInput;
+        RightTupleSource source = this.rightInput;
         while ( !(source instanceof ObjectTypeNode) ) {
             source = source.objectSource;
         }

Modified: labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/LeftInputAdapterNode.java
===================================================================
--- labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/LeftInputAdapterNode.java	2008-01-04 00:57:26 UTC (rev 17532)
+++ labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/LeftInputAdapterNode.java	2008-01-04 01:54:45 UTC (rev 17533)
@@ -24,7 +24,6 @@
 import org.drools.common.PropagationContextImpl;
 import org.drools.reteoo.builder.BuildContext;
 import org.drools.spi.PropagationContext;
-import org.drools.util.FactEntry;
 import org.drools.util.FactHashTable;
 import org.drools.util.Iterator;
 
@@ -38,21 +37,21 @@
  * @author <a href="mailto:bob at werken.com">Bob McWhirter</a>
  *
  */
-public class LeftInputAdapterNode extends TupleSource
+public class LeftInputAdapterNode extends LeftTupleSource
     implements
-    ObjectSinkNode,
+    RightTupleSinkNode,
     NodeMemory {
 
     /**
      * 
      */
     private static final long  serialVersionUID = 400L;
-    private final ObjectSource objectSource;
+    private final RightTupleSource objectSource;
 
-    private ObjectSinkNode     previousObjectSinkNode;
-    private ObjectSinkNode     nextObjectSinkNode;
+    private RightTupleSinkNode     previousRightTupleSinkNode;
+    private RightTupleSinkNode     nextRightTupleSinkNode;
     
-    private boolean           objectMemoryEnabled;    
+    private boolean           rightTupleMemoryEnabled;    
 
     /**
      * Constructus a LeftInputAdapterNode with a unique id that receives <code>FactHandle</code> from a 
@@ -67,12 +66,12 @@
      *      a predicate is used in the first pattern, for instance
      */
     public LeftInputAdapterNode(final int id,
-                                final ObjectSource source,
+                                final RightTupleSource source,
                                 final BuildContext context) {
         super( id );
         this.objectSource = source;
         //this.constraints = constraints;
-        setObjectMemoryEnabled( false );
+        setRightTupleMemoryEnabled( false );
     }
 
     /* (non-Javadoc)
@@ -101,29 +100,29 @@
      * Takes the asserted <code>FactHandleImpl</code> received from the <code>ObjectSource</code> and puts it
      * in a new <code>ReteTuple</code> before propagating to the <code>TupleSinks</code>
      * 
-     * @param handle
+     * @param rightTuple
      *            The asserted <code>FactHandle/code>.
      * @param context
      *             The <code>PropagationContext</code> of the <code>WorkingMemory<code> action.           
      * @param workingMemory
      *            the <code>WorkingMemory</code> session.
      */
-    public void assertObject(final InternalFactHandle handle,
+    public void assertRightTuple(final RightTuple rightTuple,
                              final PropagationContext context,
                              final InternalWorkingMemory workingMemory) {
 
         if ( !workingMemory.isSequential() ) {
-            this.sink.createAndPropagateAssertTuple( handle,
+            this.sink.createAndPropagateAssertTuple( rightTuple,
                                                      context,
                                                      workingMemory );
 
-            if ( this.objectMemoryEnabled ) {
+            if ( this.rightTupleMemoryEnabled ) {
                 final FactHashTable memory = (FactHashTable) workingMemory.getNodeMemory( this );
-                memory.add( handle,
+                memory.add( rightTuple,
                             false );
             }
         } else {
-            workingMemory.addLIANodePropagation( new LIANodePropagation(this, handle, context) );
+            //workingMemory.addLIANodePropagation( new LIANodePropagation(this, rightTuple, context) );
         }
     }
 
@@ -131,44 +130,43 @@
      * Retract an existing <code>FactHandleImpl</code> by placing it in a new <code>ReteTuple</code> before 
      * proagating to the <code>TupleSinks</code>
      * 
-     * @param handle
+     * @param rightTuple
      *            The <code>FactHandle/code> to retract.
      * @param context
      *             The <code>PropagationContext</code> of the <code>WorkingMemory<code> action.           
      * @param workingMemory
      *            the <code>WorkingMemory</code> session.
      */
-    public void retractObject(final InternalFactHandle handle,
+    public void retractRightTuple(final RightTuple rightTuple,
                               final PropagationContext context,
                               final InternalWorkingMemory workingMemory) {
         boolean propagate = true;
-        if ( this.objectMemoryEnabled ) {
+        if ( this.rightTupleMemoryEnabled ) {
             final FactHashTable memory = (FactHashTable) workingMemory.getNodeMemory( this );
-            propagate = memory.remove( handle );
+            propagate = memory.remove( rightTuple );
         }
 
         if ( propagate ) {
-            this.sink.createAndPropagateRetractTuple( handle,
+            this.sink.createAndPropagateRetractTuple( rightTuple,
                                                       context,
                                                       workingMemory );
         }
     }
 
-    public void updateSink(final TupleSink sink,
+    public void updateSink(final LeftTupleSink sink,
                            final PropagationContext context,
                            final InternalWorkingMemory workingMemory) {
-        if ( this.objectMemoryEnabled ) {
+        if ( this.rightTupleMemoryEnabled ) {
             // We have memory so iterate over all entries
             final FactHashTable memory = (FactHashTable) workingMemory.getNodeMemory( this );
             final Iterator it = memory.iterator();
-            for ( FactEntry entry = (FactEntry) it.next(); entry != null; entry = (FactEntry) it.next() ) {
-                final InternalFactHandle handle = entry.getFactHandle();
-                sink.assertTuple( new ReteTuple( handle ),
+            for ( RightTuple rightTuple = (RightTuple) it.next(); rightTuple != null; rightTuple = (RightTuple) it.next() ) {
+                sink.assertTuple( new LeftTuple( rightTuple ),
                                   context,
                                   workingMemory );
             }
         } else {
-            final ObjectSinkAdapter adapter = new ObjectSinkAdapter( sink );
+            final RightTupleSinkAdapter adapter = new RightTupleSinkAdapter( sink );
             this.objectSource.updateSink( adapter,
                                           context,
                                           workingMemory );
@@ -178,7 +176,7 @@
     public void remove(final BaseNode node,
                        final InternalWorkingMemory[] workingMemories) {
         if ( !node.isInUse() ) {
-            removeTupleSink( (TupleSink) node );
+            removeTupleSink( (LeftTupleSink) node );
         }
         removeShare();
         if ( !this.isInUse() ) {
@@ -190,12 +188,12 @@
                                   workingMemories );
     }    
     
-    public boolean isObjectMemoryEnabled() {
-        return this.objectMemoryEnabled;
+    public boolean isRightTupleMemoryEnabled() {
+        return this.rightTupleMemoryEnabled;
     }
 
-    public void setObjectMemoryEnabled(boolean objectMemoryEnabled) {
-        this.objectMemoryEnabled = objectMemoryEnabled;
+    public void setRightTupleMemoryEnabled(boolean objectMemoryEnabled) {
+        this.rightTupleMemoryEnabled = objectMemoryEnabled;
     }    
 
     /**
@@ -203,8 +201,8 @@
      * @return
      *      The next ObjectSinkNode
      */
-    public ObjectSinkNode getNextObjectSinkNode() {
-        return this.nextObjectSinkNode;
+    public RightTupleSinkNode getNextRightTupleSinkNode() {
+        return this.nextRightTupleSinkNode;
     }
 
     /**
@@ -212,8 +210,8 @@
      * @param next
      *      The next ObjectSinkNode
      */
-    public void setNextObjectSinkNode(final ObjectSinkNode next) {
-        this.nextObjectSinkNode = next;
+    public void setNextRightTupleSinkNode(final RightTupleSinkNode next) {
+        this.nextRightTupleSinkNode = next;
     }
 
     /**
@@ -221,8 +219,8 @@
      * @return
      *      The previous ObjectSinkNode
      */
-    public ObjectSinkNode getPreviousObjectSinkNode() {
-        return this.previousObjectSinkNode;
+    public RightTupleSinkNode getPreviousRightTupleSinkNode() {
+        return this.previousRightTupleSinkNode;
     }
 
     /**
@@ -230,8 +228,8 @@
      * @param previous
      *      The previous ObjectSinkNode
      */
-    public void setPreviousObjectSinkNode(final ObjectSinkNode previous) {
-        this.previousObjectSinkNode = previous;
+    public void setPreviousRightTupleSinkNode(final RightTupleSinkNode previous) {
+        this.previousRightTupleSinkNode = previous;
     }
 
     public int hashCode() {
@@ -262,19 +260,19 @@
      * @author mproctor
      *
      */
-    private static class ObjectSinkAdapter
+    private static class RightTupleSinkAdapter
         implements
-        ObjectSink {
-        private TupleSink sink;
+        RightTupleSink {
+        private LeftTupleSink sink;
 
-        public ObjectSinkAdapter(final TupleSink sink) {
+        public RightTupleSinkAdapter(final LeftTupleSink sink) {
             this.sink = sink;
         }
 
-        public void assertObject(final InternalFactHandle handle,
+        public void assertRightTuple(final RightTuple rightTuple,
                                  final PropagationContext context,
                                  final InternalWorkingMemory workingMemory) {
-            final ReteTuple tuple = new ReteTuple( handle );
+            final LeftTuple tuple = new LeftTuple( rightTuple );
             this.sink.assertTuple( tuple,
                                    context,
                                    workingMemory );
@@ -286,17 +284,17 @@
             throw new UnsupportedOperationException( "ObjectSinkAdapter onlys supports assertObject method calls" );
         }
 
-        public void retractObject(final InternalFactHandle handle,
+        public void retractRightTuple(final RightTuple rightTuple,
                                   final PropagationContext context,
                                   final InternalWorkingMemory workingMemory) {
             throw new UnsupportedOperationException( "ObjectSinkAdapter onlys supports assertObject method calls" );
         }
         
-        public boolean isObjectMemoryEnabled() {
+        public boolean isRightTupleMemoryEnabled() {
             throw new UnsupportedOperationException("ObjectSinkAdapters have no Object memory");
         }
 
-        public void setObjectMemoryEnabled(boolean objectMemoryEnabled) {
+        public void setRightTupleMemoryEnabled(boolean objectMemoryEnabled) {
             throw new UnsupportedOperationException("ObjectSinkAdapters have no Object memory");
         }        
     }

Copied: labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/LeftTuple.java (from rev 17523, labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/ReteTuple.java)
===================================================================
--- labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/LeftTuple.java	                        (rev 0)
+++ labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/LeftTuple.java	2008-01-04 01:54:45 UTC (rev 17533)
@@ -0,0 +1,288 @@
+package org.drools.reteoo;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.drools.base.ShadowProxy;
+import org.drools.common.InternalFactHandle;
+import org.drools.rule.Declaration;
+import org.drools.spi.Activation;
+import org.drools.spi.Tuple;
+import org.drools.util.Entry;
+
+public class LeftTuple
+    implements
+    Tuple,
+    Entry {
+    private static final long        serialVersionUID = 400L;
+
+    private int                      index;
+
+    private final InternalFactHandle handle;
+
+    private LeftTuple                parent;       
+
+    private Activation               activation;
+
+    private long                     recency;
+
+    private int                      hashCode;
+    
+    private RightTuple               match;
+
+    
+    // left and right tuples in parent
+    private LeftTuple               leftParent;  
+    private LeftTuple               leftParentLeft;
+    private LeftTuple               leftParentright;
+    
+    private RightTuple              rightParent;    
+    private RightTuple              rightParentLeft;
+    private RightTuple              rightParentright;
+    
+    // node memory
+    private Entry                    next;    
+    private Entry                    previous;
+    
+    // children
+    private LeftTuple                children;    
+
+    // ------------------------------------------------------------
+    // Constructors
+    // ------------------------------------------------------------
+    public LeftTuple(final RightTuple rightTuple) {
+        this.handle = rightTuple.getHandle();
+        this.recency = this.handle.getRecency();
+        int h = handle.hashCode();
+        h += ~(h << 9);
+        h ^= (h >>> 14);
+        h += (h << 4);
+        h ^= (h >>> 10);
+        this.hashCode = h;
+    }
+
+    public LeftTuple(final LeftTuple tuple) {
+        this.index = tuple.index;
+        this.parent = tuple.parent;
+        this.recency = tuple.recency;
+        this.handle = tuple.handle;
+        this.hashCode = tuple.hashCode();
+    }
+
+    public LeftTuple(final LeftTuple parentTuple,
+                     final RightTuple rightTuple) {
+        this.handle = rightTuple.getHandle();
+        this.index = parentTuple.index + 1;
+        this.parent = parentTuple;
+        this.recency = parentTuple.recency + this.handle.getRecency();
+        this.hashCode = parentTuple.hashCode ^ (handle.hashCode() * 31);
+    }        
+
+    public LeftTuple getLeftParent() {
+		return leftParent;
+	}
+
+	public void setLeftParent(LeftTuple leftParent) {
+		this.leftParent = leftParent;
+	}
+
+	public LeftTuple getLeftParentLeft() {
+		return leftParentLeft;
+	}
+
+	public void setLeftParentLeft(LeftTuple leftParentLeft) {
+		this.leftParentLeft = leftParentLeft;
+	}
+
+	public LeftTuple getLeftParentright() {
+		return leftParentright;
+	}
+
+	public void setLeftParentright(LeftTuple leftParentright) {
+		this.leftParentright = leftParentright;
+	}
+
+	public RightTuple getRightParent() {
+		return rightParent;
+	}
+
+	public void setRightParent(RightTuple rightParent) {
+		this.rightParent = rightParent;
+	}
+
+	public RightTuple getRightParentLeft() {
+		return rightParentLeft;
+	}
+
+	public void setRightParentLeft(RightTuple rightParentLeft) {
+		this.rightParentLeft = rightParentLeft;
+	}
+
+	public RightTuple getRightParentright() {
+		return rightParentright;
+	}
+
+	public void setRightParentright(RightTuple rightParentright) {
+		this.rightParentright = rightParentright;
+	}
+
+	public InternalFactHandle get(final int index) {
+        LeftTuple entry = this;
+        while ( entry.index != index ) {
+            entry = entry.parent;
+        }
+        return entry.handle;
+    }        
+
+    public Entry getPrevious() {
+		return previous;
+	}
+
+	public void setPrevious(Entry previous) {
+		this.previous = previous;
+	}
+
+	public void setNext(final Entry next) {
+        this.next = next;
+    }
+
+    public Entry getNext() {
+        return this.next;
+    }
+
+    public InternalFactHandle getLastHandle() {
+        return this.handle;
+    }
+
+    public InternalFactHandle get(final Declaration declaration) {
+        return get( declaration.getPattern().getOffset() );
+    }
+
+    public Activation getActivation() {
+        return this.activation;
+    }
+
+    /**
+     * Returns the fact handles in reverse order
+     */
+    public InternalFactHandle[] getFactHandles() {
+        final List list = new ArrayList();
+        LeftTuple entry = this;
+        while ( entry != null ) {
+            list.add( entry.handle );
+            entry = entry.parent;
+        }
+
+        return (InternalFactHandle[]) list.toArray( new InternalFactHandle[list.size()] );
+    }
+
+    public long getRecency() {
+        return this.recency;
+    }
+        
+
+    public RightTuple getMatch() {
+        return match;
+    }
+
+    public void setMatch(RightTuple match) {
+        this.match = match;
+    }
+
+    public void setActivation(final Activation activation) {
+        this.activation = activation;
+    }
+
+    public int hashCode() {
+        return this.hashCode;
+    }
+
+    public String toString() {
+        final StringBuffer buffer = new StringBuffer();
+
+        LeftTuple entry = this;
+        while ( entry != null ) {
+            //buffer.append( entry.handle );
+            buffer.append( entry.handle + "\n" );
+            entry = entry.parent;
+        }
+        return buffer.toString();
+    }
+
+    /**
+     * We use this equals method to avoid the cast
+     * @param tuple
+     * @return
+     */
+    public boolean equals(final LeftTuple other) {
+        // we know the object is never null and always of the  type ReteTuple
+        if ( other == this ) {
+            return true;
+        }
+
+        // A ReteTuple is  only the same if it has the same hashCode, factId and parent
+        if ( (other == null) || (this.hashCode != other.hashCode) ) {
+            return false;
+        }
+
+        if ( this.handle != other.handle ) {
+            return false;
+        }
+
+        if ( this.parent == null ) {
+            return (other.parent == null);
+        } else {
+            return this.parent.equals( other.parent );
+        }
+    }
+
+    public boolean equals(final Object object) {
+        // we know the object is never null and always of the  type ReteTuple    
+        return equals( (LeftTuple) object );
+    }
+
+    public int size() {
+        return this.index + 1;
+    }
+
+    /**
+     * Returns the ReteTuple that contains the "elements"
+     * first elements in this tuple.
+     * 
+     * Use carefully as no cloning is made during this process.
+     * 
+     * This method is used by TupleStartEqualsConstraint when
+     * joining a subnetwork tuple into the main network tuple;
+     * 
+     * @param elements the number of elements to return, starting from
+     * the begining of the tuple
+     * 
+     * @return a ReteTuple containing the "elements" first elements
+     * of this tuple or null if "elements" is greater than size; 
+     */
+    public LeftTuple getSubTuple(final int elements) {
+        LeftTuple entry = this;
+        if ( elements < this.size() ) {
+            final int lastindex = elements - 1;
+
+            while ( entry.index != lastindex ) {
+                entry = entry.parent;
+            }
+        }
+        return entry;
+    }
+    
+    public Object[] toObjectArray() {        
+        Object[] objects = new Object[ this.index + 1 ];
+        LeftTuple entry = this;       
+        while ( entry != null ) {
+            Object object = entry.getLastHandle().getObject();
+            if ( object instanceof ShadowProxy ) {
+                object = ((ShadowProxy)object).getShadowedObject();
+            }
+            objects[entry.index] = object;
+            entry = entry.parent;
+        }   
+        return objects;
+    }
+}

Copied: labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/LeftTupleMemory.java (from rev 17522, labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/TupleMemory.java)
===================================================================
--- labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/LeftTupleMemory.java	                        (rev 0)
+++ labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/LeftTupleMemory.java	2008-01-04 01:54:45 UTC (rev 17533)
@@ -0,0 +1,26 @@
+package org.drools.reteoo;
+
+import org.drools.common.InternalFactHandle;
+import org.drools.util.Entry;
+import org.drools.util.Iterator;
+
+public interface LeftTupleMemory {
+    public Iterator iterator();
+
+    public Iterator iterator(RightTuple rightTuple);
+
+    public void add(LeftTuple tuple);
+
+    public LeftTuple remove(LeftTuple tuple);
+
+    public boolean contains(LeftTuple tuple);
+
+    public boolean isIndexed();
+
+    public int size();
+
+    public Entry[] getTable();
+    
+    public Entry[] toArray();
+
+}

Copied: labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/LeftTupleSink.java (from rev 17522, labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/TupleSink.java)
===================================================================
--- labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/LeftTupleSink.java	                        (rev 0)
+++ labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/LeftTupleSink.java	2008-01-04 01:54:45 UTC (rev 17533)
@@ -0,0 +1,59 @@
+package org.drools.reteoo;
+
+/*
+ * Copyright 2005 JBoss Inc
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import java.io.Serializable;
+
+import org.drools.common.InternalWorkingMemory;
+import org.drools.spi.PropagationContext;
+
+/**
+ * Receiver of propagated <code>ReteTuple</code>s from a
+ * <code>TupleSource</code>.
+ * 
+ * @see LeftTupleSource
+ * 
+ * @author <a href="mailto:mark.proctor at jboss.com">Mark Proctor</a>
+ * @author <a href="mailto:bob at werken.com">Bob McWhirter</a>
+ */
+public interface LeftTupleSink
+    extends
+    Serializable,
+    Sink {
+
+    /**
+     * Assert a new <code>ReteTuple</code>.
+     * 
+     * @param tuple
+     *            The <code>ReteTuple</code> to propagate.
+     * @param context
+     *             The <code>PropagationContext</code> of the <code>WorkingMemory<code> action            
+     * @param workingMemory
+     *            the <code>WorkingMemory</code> session.
+     */
+    void assertTuple(LeftTuple tuple,
+                     PropagationContext context,
+                     InternalWorkingMemory workingMemory);
+
+    void retractTuple(LeftTuple tuple,
+                      PropagationContext context,
+                      InternalWorkingMemory workingMemory);
+    
+    public boolean isTupleMemoryEnabled();
+
+    public void setTupleMemoryEnabled(boolean tupleMemoryEnabled);       
+}

Copied: labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/LeftTupleSinkNode.java (from rev 17522, labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/TupleSinkNode.java)
===================================================================
--- labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/LeftTupleSinkNode.java	                        (rev 0)
+++ labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/LeftTupleSinkNode.java	2008-01-04 01:54:45 UTC (rev 17533)
@@ -0,0 +1,59 @@
+package org.drools.reteoo;
+
+/*
+ * Copyright 2005 JBoss Inc
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * Items placed in a <code>LinkedList<code> must implement this interface .
+ * 
+ * @see LeftTupleSinkNodeList
+ * 
+ * @author <a href="mailto:mark.proctor at jboss.com">Mark Proctor</a>
+ * @author <a href="mailto:bob at werken.com">Bob McWhirter</a>
+ */
+public interface LeftTupleSinkNode
+    extends
+    LeftTupleSink {
+
+    /**
+     * Returns the next node
+     * @return
+     *      The next LinkedListNode
+     */
+    public LeftTupleSinkNode getNextLeftTupleSinkNode();
+
+    /**
+     * Sets the next node 
+     * @param next
+     *      The next LinkedListNode
+     */
+    public void setNextLeftTupleSinkNode(LeftTupleSinkNode next);
+
+    /**
+     * Returns the previous node
+     * @return
+     *      The previous LinkedListNode
+     */
+    public LeftTupleSinkNode getPreviousLeftTupleSinkNode();
+
+    /**
+     * Sets the previous node 
+     * @param previous
+     *      The previous LinkedListNode
+     */
+    public void setPreviousLeftTupleSinkNode(LeftTupleSinkNode previous);
+
+}

Copied: labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/LeftTupleSinkNodeList.java (from rev 17522, labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/TupleSinkNodeList.java)
===================================================================
--- labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/LeftTupleSinkNodeList.java	                        (rev 0)
+++ labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/LeftTupleSinkNodeList.java	2008-01-04 01:54:45 UTC (rev 17533)
@@ -0,0 +1,229 @@
+package org.drools.reteoo;
+
+import java.io.Serializable;
+import java.util.Iterator;
+import java.util.NoSuchElementException;
+
+/*
+ * Copyright 2005 JBoss Inc
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * This is a simple linked linked implementation. Each node must implement </code>LinkedListNode<code> so that it references
+ * the node before and after it. This way a node can be removed without having to scan the list to find it. This class
+ * does not provide an Iterator implementation as its designed for efficiency and not genericity. There are a number of 
+ * ways to iterate the list.
+ * <p>
+ * Simple iterator:
+ * <pre>
+ * for ( LinkedListNode node = list.getFirst(); node != null; node =  node.getNext() ) {
+ * }
+ * </pre>
+ * 
+ * Iterator that pops the first entry:
+ * <pre>
+ * for ( LinkedListNode node = list.removeFirst(); node != null; node = list.removeFirst() ) {
+ * }
+ * </pre>
+ *
+ *
+ * @author <a href="mailto:mark.proctor at jboss.com">Mark Proctor</a>
+ * @author <a href="mailto:bob at werken.com">Bob McWhirter</a>
+ *
+ */
+public class LeftTupleSinkNodeList
+    implements
+    Serializable {
+    private static final long serialVersionUID = 400L;
+
+    private LeftTupleSinkNode     firstNode;
+    private LeftTupleSinkNode     lastNode;
+
+    private int               size;
+
+    /**
+     * Construct an empty <code>LinkedList</code>
+     */
+    public LeftTupleSinkNodeList() {
+
+    }
+
+    /**
+     * Add a <code>TupleSinkNode</code> to the list. If the <code>LinkedList</code> is empty then the first and 
+     * last nodes are set to the added node.
+     * 
+     * @param node
+     *      The <code>TupleSinkNode</code> to be added
+     */
+    public void add(final LeftTupleSinkNode node) {
+        if ( this.firstNode == null ) {
+            this.firstNode = node;
+            this.lastNode = node;;
+        } else {
+            this.lastNode.setNextLeftTupleSinkNode( node );
+            node.setPreviousLeftTupleSinkNode( this.lastNode );
+            this.lastNode = node;
+        }
+        this.size++;
+    }
+
+    /**
+     * Removes a <code>TupleSinkNode</code> from the list. This works by attach the previous reference to the child reference.
+     * When the node to be removed is the first node it calls <code>removeFirst()</code>. When the node to be removed is the last node
+     * it calls <code>removeLast()</code>.
+     * 
+     * @param node
+     *      The <code>TupleSinkNode</code> to be removed.
+     */
+    public void remove(final LeftTupleSinkNode node) {
+        if ( (this.firstNode != node) && (this.lastNode != node) ) {
+            node.getPreviousLeftTupleSinkNode().setNextLeftTupleSinkNode( node.getNextLeftTupleSinkNode() );
+            node.getNextLeftTupleSinkNode().setPreviousLeftTupleSinkNode( node.getPreviousLeftTupleSinkNode() );
+            this.size--;
+            node.setPreviousLeftTupleSinkNode( null );
+            node.setNextLeftTupleSinkNode( null );
+
+        } else {
+            if ( this.firstNode == node ) {
+                removeFirst();
+            } else if ( this.lastNode == node ) {
+                removeLast();
+            }
+        }
+    }
+
+    /**
+     * Return the first node in the list
+     * @return
+     *      The first <code>TupleSinkNode</code>.
+     */
+    public final LeftTupleSinkNode getFirst() {
+        return this.firstNode;
+    }
+
+    /**
+     * Return the last node in the list
+     * @return
+     *      The last <code>TupleSinkNode</code>.
+     */
+    public final LeftTupleSinkNode getLast() {
+        return this.lastNode;
+    }
+
+    /**
+     * Remove the first node from the list. The next node then becomes the first node. If this is the last 
+     * node then both first and last node references are set to null.
+     * 
+     * @return
+     *      The first <code>TupleSinkNode</code>.
+     */
+    public LeftTupleSinkNode removeFirst() {
+        if ( this.firstNode == null ) {
+            return null;
+        }
+        final LeftTupleSinkNode node = this.firstNode;
+        this.firstNode = node.getNextLeftTupleSinkNode();
+        node.setNextLeftTupleSinkNode( null );
+        if ( this.firstNode != null ) {
+            this.firstNode.setPreviousLeftTupleSinkNode( null );
+        } else {
+            this.lastNode = null;
+        }
+        this.size--;
+        return node;
+    }
+
+    /**
+     * Remove the last node from the list. The previous node then becomes the last node. If this is the last 
+     * node then both first and last node references are set to null.
+     * 
+     * @return
+     *      The first <code>TupleSinkNode</code>.
+     */
+    public LeftTupleSinkNode removeLast() {
+        if ( this.lastNode == null ) {
+            return null;
+        }
+        final LeftTupleSinkNode node = this.lastNode;
+        this.lastNode = node.getPreviousLeftTupleSinkNode();
+        node.setPreviousLeftTupleSinkNode( null );
+        if ( this.lastNode != null ) {
+            this.lastNode.setNextLeftTupleSinkNode( null );
+        } else {
+            this.firstNode = this.lastNode;
+        }
+        this.size--;
+        return node;
+    }
+
+    /**
+     * @return
+     *      boolean value indicating the empty status of the list
+     */
+    public final boolean isEmpty() {
+        return (this.firstNode == null);
+    }
+
+    /**
+     * Iterates the list removing all the nodes until there are no more nodes to remove. 
+     */
+    public void clear() {
+        while ( removeFirst() != null ) {
+        }
+    }
+
+    /**
+     * @return
+     *     return size of the list as an int
+     */
+    public final int size() {
+        return this.size;
+    }
+
+    /**
+     * Returns a list iterator
+     * @return
+     */
+    public Iterator iterator() {
+        return new Iterator() {
+            private LeftTupleSinkNode currentNode = null;
+            private LeftTupleSinkNode nextNode    = getFirst();
+
+            public boolean hasNext() {
+                return (this.nextNode != null);
+            }
+
+            public Object next() {
+                this.currentNode = this.nextNode;
+                if ( this.currentNode != null ) {
+                    this.nextNode = this.currentNode.getNextLeftTupleSinkNode();
+                } else {
+                    throw new NoSuchElementException( "No more elements to return" );
+                }
+                return this.currentNode;
+            }
+
+            public void remove() {
+                if ( this.currentNode != null ) {
+                    LeftTupleSinkNodeList.this.remove( this.currentNode );
+                    this.currentNode = null;
+                } else {
+                    throw new IllegalStateException( "No item to remove. Call next() before calling remove()." );
+                }
+            }
+        };
+    }
+
+}

Copied: labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/LeftTupleSinkPropagator.java (from rev 17522, labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/TupleSinkPropagator.java)
===================================================================
--- labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/LeftTupleSinkPropagator.java	                        (rev 0)
+++ labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/LeftTupleSinkPropagator.java	2008-01-04 01:54:45 UTC (rev 17533)
@@ -0,0 +1,58 @@
+package org.drools.reteoo;
+
+import java.io.Serializable;
+
+import org.drools.common.InternalWorkingMemory;
+import org.drools.spi.PropagationContext;
+
+public interface LeftTupleSinkPropagator
+    extends
+    Serializable {
+    public void propagateAssertTuple(LeftTuple leftTuple,
+                                     RightTuple rightTuple,
+                                     PropagationContext context,
+                                     InternalWorkingMemory workingMemory);
+
+    public void propagateAssertTuple(LeftTuple tuple,
+                                     PropagationContext context,
+                                     InternalWorkingMemory workingMemory);
+
+    public void propagateRetractTuple(LeftTuple leftTuple,
+                                      RightTuple rightTuple,
+                                      PropagationContext context,
+                                      InternalWorkingMemory workingMemory);
+
+    public void propagateRetractTuple(LeftTuple tuple,
+                                      PropagationContext context,
+                                      InternalWorkingMemory workingMemory);
+
+    public void createAndPropagateAssertTuple(RightTuple rightTuple,
+                                              PropagationContext context,
+                                              InternalWorkingMemory workingMemory);
+
+    public void createAndPropagateRetractTuple(RightTuple rightTuple,
+                                               PropagationContext context,
+                                               InternalWorkingMemory workingMemory);
+
+    public LeftTupleSink[] getSinks();
+
+    //    public void propagateNewTupleSink(TupleMatch tupleMatch,
+    //                                      PropagationContext context,
+    //                                      InternalWorkingMemory workingMemory);
+    //
+    //    public void propagateNewTupleSink(InternalFactHandle handle,
+    //                                      LinkedList list,
+    //                                      PropagationContext context,
+    //                                      InternalWorkingMemory workingMemory);
+    //
+    //    public void propagateNewTupleSink(ReteTuple tuple,
+    //                                      PropagationContext context,
+    //                                      InternalWorkingMemory workingMemory);
+    //
+    //    public List getPropagatedTuples(final Map memory,
+    //                                    final InternalWorkingMemory workingMemory,
+    //                                    final TupleSink sink);
+
+    public int size();
+
+}

Copied: labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/LeftTupleSource.java (from rev 17522, labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/TupleSource.java)
===================================================================
--- labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/LeftTupleSource.java	                        (rev 0)
+++ labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/LeftTupleSource.java	2008-01-04 01:54:45 UTC (rev 17533)
@@ -0,0 +1,116 @@
+package org.drools.reteoo;
+
+/*
+ * Copyright 2005 JBoss Inc
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import java.io.Serializable;
+
+import org.drools.common.BaseNode;
+import org.drools.common.InternalWorkingMemory;
+import org.drools.spi.PropagationContext;
+
+/**
+ * A source of <code>ReteTuple</code> s for a <code>TupleSink</code>.
+ * 
+ * <p>
+ * Nodes that propagate <code>Tuples</code> extend this class.
+ * </p>
+ * 
+ * @see LeftTupleSource
+ * @see LeftTuple
+ * 
+ * @author <a href="mailto:mark.proctor at jboss.com">Mark Proctor</a>
+ * @author <a href="mailto:bob at werken.com">Bob McWhirter</a>
+ */
+public abstract class LeftTupleSource extends BaseNode
+    implements
+    Serializable {
+    // ------------------------------------------------------------
+    // Instance members
+    // ------------------------------------------------------------
+
+    /** The destination for <code>Tuples</code>. */
+    protected LeftTupleSinkPropagator sink;
+
+    // ------------------------------------------------------------
+    // Constructors
+    // ------------------------------------------------------------
+
+    /**
+     * Single parameter constructor that specifies the unique id of the node.
+     * 
+     * @param id
+     */
+    LeftTupleSource(final int id) {
+        super( id );
+        this.sink = EmptyLeftTupleSinkAdapter.getInstance();
+    }
+
+    // ------------------------------------------------------------
+    // Instance methods
+    // ------------------------------------------------------------
+
+    /**
+     * Adds the <code>TupleSink</code> so that it may receive
+     * <code>Tuples</code> propagated from this <code>TupleSource</code>.
+     * 
+     * @param tupleSink
+     *            The <code>TupleSink</code> to receive propagated
+     *            <code>Tuples</code>.
+     */
+    protected void addTupleSink(final LeftTupleSink tupleSink) {
+        if ( this.sink == EmptyLeftTupleSinkAdapter.getInstance() ) {
+            this.sink = new SingleLeftTupleSinkAdapter( tupleSink );
+        } else if ( this.sink instanceof SingleLeftTupleSinkAdapter ) {
+            final CompositeTupleSinkAdapter sinkAdapter = new CompositeTupleSinkAdapter();
+            sinkAdapter.addTupleSink( this.sink.getSinks()[0] );
+            sinkAdapter.addTupleSink( tupleSink );
+            this.sink = sinkAdapter;
+        } else {
+            ((CompositeTupleSinkAdapter) this.sink).addTupleSink( tupleSink );
+        }
+    }
+
+    /**
+     * Removes the <code>TupleSink</code>
+     * 
+     * @param tupleSink
+     *            The <code>TupleSink</code> to remove
+     */
+    protected void removeTupleSink(final LeftTupleSink tupleSink) {
+        if ( this.sink == EmptyLeftTupleSinkAdapter.getInstance() ) {
+            throw new IllegalArgumentException( "Cannot remove a sink, when the list of sinks is null" );
+        }
+
+        if ( this.sink instanceof SingleLeftTupleSinkAdapter ) {
+            this.sink = EmptyLeftTupleSinkAdapter.getInstance();
+        } else {
+            final CompositeTupleSinkAdapter sinkAdapter = (CompositeTupleSinkAdapter) this.sink;
+            sinkAdapter.removeTupleSink( tupleSink );
+            if ( sinkAdapter.size() == 1 ) {
+                this.sink = new SingleLeftTupleSinkAdapter( sinkAdapter.getSinks()[0] );
+            }
+        }
+    }
+
+    public LeftTupleSinkPropagator getSinkPropagator() {
+        return this.sink;
+    }
+
+    public abstract void updateSink(LeftTupleSink sink,
+                                    PropagationContext context,
+                                    InternalWorkingMemory workingMemory);    
+}

Modified: labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/MemoryVisitor.java
===================================================================
--- labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/MemoryVisitor.java	2008-01-04 00:57:26 UTC (rev 17532)
+++ labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/MemoryVisitor.java	2008-01-04 01:54:45 UTC (rev 17533)
@@ -50,10 +50,10 @@
 
         this.indent++;
         try {
-            final Field field = ObjectSource.class.getDeclaredField( "sink" );
+            final Field field = RightTupleSource.class.getDeclaredField( "sink" );
             field.setAccessible( true );
-            final ObjectSinkPropagator sink = (ObjectSinkPropagator) field.get( node );
-            final ObjectSink[] sinks = sink.getSinks();
+            final RightTupletSinkPropagator sink = (RightTupletSinkPropagator) field.get( node );
+            final RightTupleSink[] sinks = sink.getSinks();
             for ( int i = 0, length = sinks.length; i < length; i++ ) {
                 visit( sinks[i] );
             }
@@ -71,10 +71,10 @@
 
         this.indent++;
         try {
-            final Field field = ObjectSource.class.getDeclaredField( "sink" );
+            final Field field = RightTupleSource.class.getDeclaredField( "sink" );
             field.setAccessible( true );
-            final ObjectSinkPropagator sink = (ObjectSinkPropagator) field.get( node );
-            final ObjectSink[] sinks = sink.getSinks();
+            final RightTupletSinkPropagator sink = (RightTupletSinkPropagator) field.get( node );
+            final RightTupleSink[] sinks = sink.getSinks();
             for ( int i = 0, length = sinks.length; i < length; i++ ) {
                 visit( sinks[i] );
             }
@@ -89,10 +89,10 @@
 
         this.indent++;
         try {
-            final Field field = TupleSource.class.getDeclaredField( "sink" );
+            final Field field = LeftTupleSource.class.getDeclaredField( "sink" );
             field.setAccessible( true );
-            final TupleSinkPropagator sink = (TupleSinkPropagator) field.get( node );
-            final TupleSink[] sinks = sink.getSinks();
+            final LeftTupleSinkPropagator sink = (LeftTupleSinkPropagator) field.get( node );
+            final LeftTupleSink[] sinks = sink.getSinks();
             for ( int i = 0, length = sinks.length; i < length; i++ ) {
                 visit( sinks[i] );
             }
@@ -107,18 +107,18 @@
 
         try {
             final BetaMemory memory = (BetaMemory) this.workingMemory.getNodeMemory( node );
-            checkObjectHashTable( memory.getFactHandleMemory() );
-            checkTupleMemory( memory.getTupleMemory() );
+            checkObjectHashTable( memory.getRightTupleMemory() );
+            checkTupleMemory( memory.getLeftTupleMemory() );
         } catch ( final Exception e ) {
             e.printStackTrace();
         }
 
         this.indent++;
         try {
-            final Field field = TupleSource.class.getDeclaredField( "sink" );
+            final Field field = LeftTupleSource.class.getDeclaredField( "sink" );
             field.setAccessible( true );
-            final TupleSinkPropagator sink = (TupleSinkPropagator) field.get( node );
-            final TupleSink[] sinks = sink.getSinks();
+            final LeftTupleSinkPropagator sink = (LeftTupleSinkPropagator) field.get( node );
+            final LeftTupleSink[] sinks = sink.getSinks();
             for ( int i = 0, length = sinks.length; i < length; i++ ) {
                 visit( sinks[i] );
             }
@@ -132,18 +132,18 @@
         System.out.println( indent() + node );
         try {
             final BetaMemory memory = (BetaMemory) this.workingMemory.getNodeMemory( node );
-            checkObjectHashTable( memory.getFactHandleMemory() );
-            checkTupleMemory( memory.getTupleMemory() );
+            checkObjectHashTable( memory.getRightTupleMemory() );
+            checkTupleMemory( memory.getLeftTupleMemory() );
         } catch ( final Exception e ) {
             e.printStackTrace();
         }
 
         this.indent++;
         try {
-            final Field field = TupleSource.class.getDeclaredField( "sink" );
+            final Field field = LeftTupleSource.class.getDeclaredField( "sink" );
             field.setAccessible( true );
-            final TupleSinkPropagator sink = (TupleSinkPropagator) field.get( node );
-            final TupleSink[] sinks = sink.getSinks();
+            final LeftTupleSinkPropagator sink = (LeftTupleSinkPropagator) field.get( node );
+            final LeftTupleSink[] sinks = sink.getSinks();
             for ( int i = 0, length = sinks.length; i < length; i++ ) {
                 visit( sinks[i] );
             }
@@ -174,7 +174,7 @@
     //        }
     //    }
 
-    private void checkObjectHashTable(final FactHandleMemory memory) {
+    private void checkObjectHashTable(final RightTupleMemory memory) {
         if ( memory instanceof FactHashTable ) {
             checkFactHashTable( (FactHashTable) memory );
         } else if ( memory instanceof FactHandleIndexHashTable ) {
@@ -243,7 +243,7 @@
         }
     }
 
-    private void checkTupleMemory(final TupleMemory memory) {
+    private void checkTupleMemory(final LeftTupleMemory memory) {
         final Entry[] entries = memory.getTable();
         int count = 0;
         for ( int i = 0, length = entries.length; i < length; i++ ) {

Modified: labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/NotNode.java
===================================================================
--- labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/NotNode.java	2008-01-04 00:57:26 UTC (rev 17532)
+++ labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/NotNode.java	2008-01-04 01:54:45 UTC (rev 17533)
@@ -22,7 +22,6 @@
 import org.drools.common.InternalWorkingMemory;
 import org.drools.reteoo.builder.BuildContext;
 import org.drools.spi.PropagationContext;
-import org.drools.util.FactEntry;
 import org.drools.util.Iterator;
 
 /**
@@ -61,8 +60,8 @@
      *            The right input <code>TupleSource</code>.
      */
     public NotNode(final int id,
-                   final TupleSource leftInput,
-                   final ObjectSource rightInput,
+                   final LeftTupleSource leftInput,
+                   final RightTupleSource rightInput,
                    final BetaConstraints joinNodeBinder,
                    final BuildContext context) {
         super( id,
@@ -84,23 +83,22 @@
      * @param workingMemory
      *            The working memory seesion.
      */
-    public void assertTuple(final ReteTuple leftTuple,
+    public void assertTuple(final LeftTuple leftTuple,
                             final PropagationContext context,
                             final InternalWorkingMemory workingMemory) {
         final BetaMemory memory = (BetaMemory) workingMemory.getNodeMemory( this );
         
         if ( this.tupleMemoryEnabled ) {
-            memory.getTupleMemory().add( leftTuple );
+            memory.getLeftTupleMemory().add( leftTuple );
         }
 
-        final Iterator it = memory.getFactHandleMemory().iterator( leftTuple );
+        final Iterator it = memory.getRightTupleMemory().iterator( leftTuple );
         this.constraints.updateFromTuple( workingMemory,
                                           leftTuple );
         
-        for ( FactEntry entry = (FactEntry) it.next(); entry != null; entry = (FactEntry) it.next() ) {
-            final InternalFactHandle handle = entry.getFactHandle();
-            if ( this.constraints.isAllowedCachedLeft( handle ) ) {
-                leftTuple.setMatch( handle );
+        for ( RightTuple rightTuple = (RightTuple) it.next(); rightTuple != null; rightTuple = (RightTuple) it.next() ) {
+            if ( this.constraints.isAllowedCachedLeft( rightTuple.getHandle() ) ) {
+                leftTuple.setMatch( rightTuple );
                 break;
             }
         }
@@ -117,30 +115,30 @@
      * matches any left ReteTuple's that already has propagations then those
      * propagations are retracted.
      * 
-     * @param handle
+     * @param rightTuple
      *            The <code>FactHandleImpl</code> being asserted.
      * @param context
      *            The <code>PropagationContext</code>
      * @param workingMemory
      *            The working memory seesion.
      */
-    public void assertObject(final InternalFactHandle handle,
+    public void assertRightTuple(final RightTuple rightTuple,
                              final PropagationContext context,
                              final InternalWorkingMemory workingMemory) {
         final BetaMemory memory = (BetaMemory) workingMemory.getNodeMemory( this );
-        memory.getFactHandleMemory().add( handle );
+        memory.getRightTupleMemory().add( rightTuple );
         
         if ( !this.tupleMemoryEnabled ) {
             // do nothing here, as we know there are no left tuples at this stage in sequential mode.
             return;
         }        
 
-        final Iterator it = memory.getTupleMemory().iterator( handle );
-        this.constraints.updateFromFactHandle( workingMemory,
-                                               handle );
-        for ( ReteTuple tuple = (ReteTuple) it.next(); tuple != null; tuple = (ReteTuple) it.next() ) {
+        final Iterator it = memory.getLeftTupleMemory().iterator( rightTuple );
+        this.constraints.updateFromRightTuple( workingMemory,
+                                               rightTuple );
+        for ( LeftTuple tuple = (LeftTuple) it.next(); tuple != null; tuple = (LeftTuple) it.next() ) {
             if ( this.constraints.isAllowedCachedRight( tuple ) &&  tuple.getMatch() == null) {
-                    tuple.setMatch( handle );
+                    tuple.setMatch( rightTuple );
                     this.sink.propagateRetractTuple( tuple,
                                                      context,
                                                      workingMemory );                    
@@ -153,7 +151,7 @@
      * <code>ReteTuple</code> matches then those matches copied are propagated
      * as new joins.
      * 
-     * @param handle
+     * @param rightTuple
      *            the <codeFactHandleImpl</code> being retracted
      * @param context
      *            The <code>PropagationContext</code>
@@ -161,32 +159,31 @@
      *            The working memory seesion.
      * @throws AssertionException
      */
-    public void retractObject(final InternalFactHandle handle,
+    public void retractRightTuple(final RightTuple rightTuple,
                               final PropagationContext context,
                               final InternalWorkingMemory workingMemory) {
         final BetaMemory memory = (BetaMemory) workingMemory.getNodeMemory( this );
-        if ( !memory.getFactHandleMemory().remove( handle ) ) {
+        if ( !memory.getRightTupleMemory().remove( rightTuple ) ) {
             return;
         }
 
-        final Iterator it = memory.getTupleMemory().iterator( handle );
-        this.constraints.updateFromFactHandle( workingMemory,
-                                               handle );
-        for ( ReteTuple tuple = (ReteTuple) it.next(); tuple != null; tuple = (ReteTuple) it.next() ) {
+        final Iterator it = memory.getLeftTupleMemory().iterator( rightTuple );
+        this.constraints.updateFromRightTuple( workingMemory,
+                                               rightTuple );
+        for ( LeftTuple tuple = (LeftTuple) it.next(); tuple != null; tuple = (LeftTuple) it.next() ) {
             if ( this.constraints.isAllowedCachedRight( tuple ) ) {
                 
-                if ( tuple.getMatch() == handle ) {
+                if ( tuple.getMatch() == rightTuple ) {
                     // reset the match                    
                     tuple.setMatch( null );
                     
                     // find next match, remember it and break.
-                    final Iterator tupleIt = memory.getFactHandleMemory().iterator( tuple );
+                    final Iterator tupleIt = memory.getRightTupleMemory().iterator( tuple );
                     this.constraints.updateFromTuple( workingMemory, tuple );
                     
-                    for ( FactEntry entry = (FactEntry) tupleIt.next(); entry != null; entry = (FactEntry) tupleIt.next() ) {
-                        final InternalFactHandle rightHandle = entry.getFactHandle();
-                        if ( this.constraints.isAllowedCachedLeft( rightHandle ) ) {
-                            tuple.setMatch( rightHandle );
+                    for ( RightTuple nextRightTuple = (RightTuple) tupleIt.next(); nextRightTuple != null; nextRightTuple = (RightTuple) tupleIt.next() ) {
+                        if ( this.constraints.isAllowedCachedLeft( nextRightTuple.getHandle() ) ) {
+                            tuple.setMatch( nextRightTuple );
                             break;
                         }
                     }
@@ -213,13 +210,13 @@
      * @param workingMemory
      *            The working memory seesion.
      */
-    public void retractTuple(final ReteTuple leftTuple,
+    public void retractTuple(final LeftTuple leftTuple,
                              final PropagationContext context,
                              final InternalWorkingMemory workingMemory) {
         final BetaMemory memory = (BetaMemory) workingMemory.getNodeMemory( this );
 
         // Must use the tuple in memory as it has the tuple matches count
-        final ReteTuple tuple = memory.getTupleMemory().remove( leftTuple );
+        final LeftTuple tuple = memory.getLeftTupleMemory().remove( leftTuple );
         if ( tuple == null ) {
             return;
         }
@@ -234,15 +231,15 @@
     /* (non-Javadoc)
      * @see org.drools.reteoo.BaseNode#updateNewNode(org.drools.reteoo.WorkingMemoryImpl, org.drools.spi.PropagationContext)
      */
-    public void updateSink(final TupleSink sink,
+    public void updateSink(final LeftTupleSink sink,
                            final PropagationContext context,
                            final InternalWorkingMemory workingMemory) {
         final BetaMemory memory = (BetaMemory) workingMemory.getNodeMemory( this );
 
-        final Iterator tupleIter = memory.getTupleMemory().iterator();
-        for ( ReteTuple tuple = (ReteTuple) tupleIter.next(); tuple != null; tuple = (ReteTuple) tupleIter.next() ) {
+        final Iterator tupleIter = memory.getLeftTupleMemory().iterator();
+        for ( LeftTuple tuple = (LeftTuple) tupleIter.next(); tuple != null; tuple = (LeftTuple) tupleIter.next() ) {
             if ( tuple.getMatch() == null ) {
-                sink.assertTuple( new ReteTuple( tuple ),
+                sink.assertTuple( new LeftTuple( tuple ),
                                   context,
                                   workingMemory );
             }
@@ -250,7 +247,7 @@
     }
 
     public String toString() {
-        ObjectSource source = this.rightInput;
+        RightTupleSource source = this.rightInput;
         while ( !(source instanceof ObjectTypeNode) ) {
             source = source.objectSource;
         }

Deleted: labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/ObjectSink.java
===================================================================
--- labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/ObjectSink.java	2008-01-04 00:57:26 UTC (rev 17532)
+++ labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/ObjectSink.java	2008-01-04 01:54:45 UTC (rev 17533)
@@ -1,68 +0,0 @@
-package org.drools.reteoo;
-
-/*
- * Copyright 2005 JBoss Inc
- * 
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * 
- *      http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import org.drools.common.InternalFactHandle;
-import org.drools.common.InternalWorkingMemory;
-import org.drools.spi.PropagationContext;
-
-/**
- * Receiver of propagated <code>FactHandleImpl</code>s from a
- * <code>ObjectSource</code>.
- * 
- * @see ObectSource
- * 
- * @author <a href="mailto:mark.proctor at jboss.com">Mark Proctor</a>
- * @author <a href="mailto:bob at werken.com">Bob McWhirter</a>
- *
- */
-public interface ObjectSink
-    extends
-    Sink {
-
-    /**
-     * Assert a new <code>FactHandleImpl</code>.
-     * 
-     * @param handle
-     *            The asserted <code>FactHandle/code>.
-     * @param context
-     *             The <code>PropagationContext</code> of the <code>WorkingMemory<code> action.           
-     * @param workingMemory
-     *            the <code>WorkingMemory</code> session.
-     */
-    void assertObject(InternalFactHandle handle,
-                      PropagationContext context,
-                      InternalWorkingMemory workingMemory);
-
-    /**
-     * Retract an existing <code>FactHandleImpl</code>.
-     * 
-     * @param handle
-     *            The <code>FactHandle/code> to retract.
-     * @param context
-     *             The <code>PropagationContext</code> of the <code>WorkingMemory<code> action.           
-     * @param workingMemory
-     *            the <code>WorkingMemory</code> session.
-     */
-    void retractObject(InternalFactHandle handle,
-                       PropagationContext context,
-                       InternalWorkingMemory workingMemory);
-
-    public boolean isObjectMemoryEnabled();
-
-    public void setObjectMemoryEnabled(boolean objectMemoryOn);
-}

Deleted: labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/ObjectSinkNode.java
===================================================================
--- labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/ObjectSinkNode.java	2008-01-04 00:57:26 UTC (rev 17532)
+++ labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/ObjectSinkNode.java	2008-01-04 01:54:45 UTC (rev 17533)
@@ -1,59 +0,0 @@
-package org.drools.reteoo;
-
-/*
- * Copyright 2005 JBoss Inc
- * 
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * 
- *      http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * Items placed in a <code>LinkedList<code> must implement this interface .
- * 
- * @see TupleSinkNodeList
- * 
- * @author <a href="mailto:mark.proctor at jboss.com">Mark Proctor</a>
- * @author <a href="mailto:bob at werken.com">Bob McWhirter</a>
- */
-public interface ObjectSinkNode
-    extends
-    ObjectSink {
-
-    /**
-     * Returns the next node
-     * @return
-     *      The next LinkedListNode
-     */
-    public ObjectSinkNode getNextObjectSinkNode();
-
-    /**
-     * Sets the next node 
-     * @param next
-     *      The next LinkedListNode
-     */
-    public void setNextObjectSinkNode(ObjectSinkNode next);
-
-    /**
-     * Returns the previous node
-     * @return
-     *      The previous LinkedListNode
-     */
-    public ObjectSinkNode getPreviousObjectSinkNode();
-
-    /**
-     * Sets the previous node 
-     * @param previous
-     *      The previous LinkedListNode
-     */
-    public void setPreviousObjectSinkNode(ObjectSinkNode previous);
-
-}

Deleted: labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/ObjectSinkNodeList.java
===================================================================
--- labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/ObjectSinkNodeList.java	2008-01-04 00:57:26 UTC (rev 17532)
+++ labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/ObjectSinkNodeList.java	2008-01-04 01:54:45 UTC (rev 17533)
@@ -1,229 +0,0 @@
-package org.drools.reteoo;
-
-import java.io.Serializable;
-import java.util.Iterator;
-import java.util.NoSuchElementException;
-
-/*
- * Copyright 2005 JBoss Inc
- * 
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * 
- *      http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * This is a simple linked linked implementation. Each node must implement </code>LinkedListNode<code> so that it references
- * the node before and after it. This way a node can be removed without having to scan the list to find it. This class
- * does not provide an Iterator implementation as its designed for efficiency and not genericity. There are a number of 
- * ways to iterate the list.
- * <p>
- * Simple iterator:
- * <pre>
- * for ( LinkedListNode node = list.getFirst(); node != null; node =  node.getNext() ) {
- * }
- * </pre>
- * 
- * Iterator that pops the first entry:
- * <pre>
- * for ( LinkedListNode node = list.removeFirst(); node != null; node = list.removeFirst() ) {
- * }
- * </pre>
- *
- *
- * @author <a href="mailto:mark.proctor at jboss.com">Mark Proctor</a>
- * @author <a href="mailto:bob at werken.com">Bob McWhirter</a>
- *
- */
-public class ObjectSinkNodeList
-    implements
-    Serializable {
-    private static final long serialVersionUID = 400L;
-
-    private ObjectSinkNode    firstNode;
-    private ObjectSinkNode    lastNode;
-
-    private int               size;
-
-    /**
-     * Construct an empty <code>LinkedList</code>
-     */
-    public ObjectSinkNodeList() {
-
-    }
-
-    /**
-     * Add a <code>ObjectSinkNode</code> to the list. If the <code>LinkedList</code> is empty then the first and 
-     * last nodes are set to the added node.
-     * 
-     * @param node
-     *      The <code>ObjectSinkNode</code> to be added
-     */
-    public void add(final ObjectSinkNode node) {
-        if ( this.firstNode == null ) {
-            this.firstNode = node;
-            this.lastNode = node;;
-        } else {
-            this.lastNode.setNextObjectSinkNode( node );
-            node.setPreviousObjectSinkNode( this.lastNode );
-            this.lastNode = node;
-        }
-        this.size++;
-    }
-
-    /**
-     * Removes a <code>ObjectSinkNode</code> from the list. This works by attach the previous reference to the child reference.
-     * When the node to be removed is the first node it calls <code>removeFirst()</code>. When the node to be removed is the last node
-     * it calls <code>removeLast()</code>.
-     * 
-     * @param node
-     *      The <code>ObjectSinkNode</code> to be removed.
-     */
-    public void remove(final ObjectSinkNode node) {
-        if ( (this.firstNode != node) && (this.lastNode != node) ) {
-            node.getPreviousObjectSinkNode().setNextObjectSinkNode( node.getNextObjectSinkNode() );
-            node.getNextObjectSinkNode().setPreviousObjectSinkNode( node.getPreviousObjectSinkNode() );
-            this.size--;
-            node.setPreviousObjectSinkNode( null );
-            node.setNextObjectSinkNode( null );
-
-        } else {
-            if ( this.firstNode == node ) {
-                removeFirst();
-            } else if ( this.lastNode == node ) {
-                removeLast();
-            }
-        }
-    }
-
-    /**
-     * Return the first node in the list
-     * @return
-     *      The first <code>ObjectSinkNode</code>.
-     */
-    public final ObjectSinkNode getFirst() {
-        return this.firstNode;
-    }
-
-    /**
-     * Return the last node in the list
-     * @return
-     *      The last <code>ObjectSinkNode</code>.
-     */
-    public final ObjectSinkNode getLast() {
-        return this.lastNode;
-    }
-
-    /**
-     * Remove the first node from the list. The next node then becomes the first node. If this is the last 
-     * node then both first and last node references are set to null.
-     * 
-     * @return
-     *      The first <code>ObjectSinkNode</code>.
-     */
-    public ObjectSinkNode removeFirst() {
-        if ( this.firstNode == null ) {
-            return null;
-        }
-        final ObjectSinkNode node = this.firstNode;
-        this.firstNode = node.getNextObjectSinkNode();
-        node.setNextObjectSinkNode( null );
-        if ( this.firstNode != null ) {
-            this.firstNode.setPreviousObjectSinkNode( null );
-        } else {
-            this.lastNode = null;
-        }
-        this.size--;
-        return node;
-    }
-
-    /**
-     * Remove the last node from the list. The previous node then becomes the last node. If this is the last 
-     * node then both first and last node references are set to null.
-     * 
-     * @return
-     *      The first <code>ObjectSinkNode</code>.
-     */
-    public ObjectSinkNode removeLast() {
-        if ( this.lastNode == null ) {
-            return null;
-        }
-        final ObjectSinkNode node = this.lastNode;
-        this.lastNode = node.getPreviousObjectSinkNode();
-        node.setPreviousObjectSinkNode( null );
-        if ( this.lastNode != null ) {
-            this.lastNode.setNextObjectSinkNode( null );
-        } else {
-            this.firstNode = this.lastNode;
-        }
-        this.size--;
-        return node;
-    }
-
-    /**
-     * @return
-     *      boolean value indicating the empty status of the list
-     */
-    public final boolean isEmpty() {
-        return (this.firstNode == null);
-    }
-
-    /**
-     * Iterates the list removing all the nodes until there are no more nodes to remove. 
-     */
-    public void clear() {
-        while ( removeFirst() != null ) {
-        }
-    }
-
-    /**
-     * @return
-     *     return size of the list as an int
-     */
-    public final int size() {
-        return this.size;
-    }
-
-    /**
-     * Returns a list iterator
-     * @return
-     */
-    public Iterator iterator() {
-        return new Iterator() {
-            private ObjectSinkNode currentNode = null;
-            private ObjectSinkNode nextNode    = getFirst();
-
-            public boolean hasNext() {
-                return (this.nextNode != null);
-            }
-
-            public Object next() {
-                this.currentNode = this.nextNode;
-                if ( this.currentNode != null ) {
-                    this.nextNode = this.currentNode.getNextObjectSinkNode();
-                } else {
-                    throw new NoSuchElementException( "No more elements to return" );
-                }
-                return this.currentNode;
-            }
-
-            public void remove() {
-                if ( this.currentNode != null ) {
-                    ObjectSinkNodeList.this.remove( this.currentNode );
-                    this.currentNode = null;
-                } else {
-                    throw new IllegalStateException( "No item to remove. Call next() before calling remove()." );
-                }
-            }
-        };
-    }
-
-}

Deleted: labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/ObjectSinkPropagator.java
===================================================================
--- labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/ObjectSinkPropagator.java	2008-01-04 00:57:26 UTC (rev 17532)
+++ labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/ObjectSinkPropagator.java	2008-01-04 01:54:45 UTC (rev 17533)
@@ -1,24 +0,0 @@
-package org.drools.reteoo;
-
-import java.io.Serializable;
-
-import org.drools.common.InternalFactHandle;
-import org.drools.common.InternalWorkingMemory;
-import org.drools.spi.PropagationContext;
-
-public interface ObjectSinkPropagator
-    extends
-    Serializable {
-    public void propagateAssertObject(InternalFactHandle handle,
-                                      PropagationContext context,
-                                      InternalWorkingMemory workingMemory);
-
-    public void propagateRetractObject(InternalFactHandle handle,
-                                       PropagationContext context,
-                                       InternalWorkingMemory workingMemory,
-                                       boolean useHash);
-
-    public ObjectSink[] getSinks();
-    
-    public int size();
-}

Deleted: labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/ObjectSource.java
===================================================================
--- labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/ObjectSource.java	2008-01-04 00:57:26 UTC (rev 17532)
+++ labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/ObjectSource.java	2008-01-04 01:54:45 UTC (rev 17533)
@@ -1,137 +0,0 @@
-package org.drools.reteoo;
-
-/*
- * Copyright 2005 JBoss Inc
- * 
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * 
- *      http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import java.io.Serializable;
-
-import org.drools.common.BaseNode;
-import org.drools.common.DefaultFactHandle;
-import org.drools.common.InternalWorkingMemory;
-import org.drools.spi.PropagationContext;
-
-/**
- * A source of <code>FactHandle</code>s for an <code>ObjectSink</code>.
- * 
- * <p>
- * Nodes that propagate <code>FactHandleImpl</code> extend this class.
- * </p>
- * 
- * @see ObjectSource
- * @see DefaultFactHandle
- * 
- * @author <a href="mailto:mark.proctor at jboss.com">Mark Proctor</a>
- * @author <a href="mailto:bob at werken.com">Bob McWhirter</a>
- */
-public abstract class ObjectSource extends BaseNode
-    implements
-    Serializable {
-    // ------------------------------------------------------------
-    // Instance members
-    // ------------------------------------------------------------
-
-    /** The destination for <code>FactHandleImpl</code>. */
-    protected ObjectSinkPropagator sink;
-
-    protected ObjectSource         objectSource;
-
-    private int                    alphaNodeHashingThreshold;
-
-    // ------------------------------------------------------------
-    // Constructors
-    // ------------------------------------------------------------
-
-    /**
-     * Single parameter constructor that specifies the unique id of the node.
-     * 
-     * @param id
-     */
-    ObjectSource(final int id) {
-        this( id,
-              null,
-              3 );
-    }
-
-    /**
-     * Single parameter constructor that specifies the unique id of the node.
-     * 
-     * @param id
-     */
-    ObjectSource(final int id,
-                 final ObjectSource objectSource,
-                 final int alphaNodeHashingThreshold) {
-        super( id );
-        this.objectSource = objectSource;
-        this.alphaNodeHashingThreshold = alphaNodeHashingThreshold;
-        this.sink = EmptyObjectSinkAdapter.getInstance();
-    }
-
-    // ------------------------------------------------------------
-    // Instance methods
-    // ------------------------------------------------------------
-
-    /**
-     * Adds the <code>ObjectSink</code> so that it may receive
-     * <code>FactHandleImpl</code> propagated from this
-     * <code>ObjectSource</code>.
-     * 
-     * @param objectSink
-     *            The <code>ObjectSink</code> to receive propagated
-     *            <code>FactHandleImpl</code>.
-     */
-    protected void addObjectSink(final ObjectSink objectSink) {
-        if ( this.sink == EmptyObjectSinkAdapter.getInstance() ) {
-            this.sink = new SingleObjectSinkAdapter( objectSink );
-        } else if ( this.sink instanceof SingleObjectSinkAdapter ) {
-            final CompositeObjectSinkAdapter sinkAdapter = new CompositeObjectSinkAdapter( this.alphaNodeHashingThreshold );
-            sinkAdapter.addObjectSink( this.sink.getSinks()[0] );
-            sinkAdapter.addObjectSink( objectSink );
-            this.sink = sinkAdapter;
-        } else {
-            ((CompositeObjectSinkAdapter) this.sink).addObjectSink( objectSink );
-        }
-    }
-
-    /**
-     * Removes the <code>ObjectSink</code>
-     * 
-     * @param objectSink
-     *            The <code>ObjectSink</code> to remove
-     */
-    protected void removeObjectSink(final ObjectSink objectSink) {
-        if ( this.sink == EmptyObjectSinkAdapter.getInstance() ) {
-            throw new IllegalArgumentException( "Cannot remove a sink, when the list of sinks is null" );
-        }
-
-        if ( this.sink instanceof SingleObjectSinkAdapter ) {
-            this.sink = EmptyObjectSinkAdapter.getInstance();
-        } else {
-            final CompositeObjectSinkAdapter sinkAdapter = (CompositeObjectSinkAdapter) this.sink;
-            sinkAdapter.removeObjectSink( objectSink );
-            if ( sinkAdapter.size() == 1 ) {
-                this.sink = new SingleObjectSinkAdapter( sinkAdapter.getSinks()[0] );
-            }
-        }
-    }
-
-    public abstract void updateSink(ObjectSink sink,
-                                    PropagationContext context,
-                                    InternalWorkingMemory workingMemory);
-
-    public ObjectSinkPropagator getSinkPropagator() {
-        return this.sink;
-    }
-}

Modified: labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/ObjectTypeNode.java
===================================================================
--- labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/ObjectTypeNode.java	2008-01-04 00:57:26 UTC (rev 17532)
+++ labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/ObjectTypeNode.java	2008-01-04 01:54:45 UTC (rev 17533)
@@ -20,7 +20,6 @@
 
 import org.drools.RuleBaseConfiguration;
 import org.drools.common.BaseNode;
-import org.drools.common.InternalFactHandle;
 import org.drools.common.InternalWorkingMemory;
 import org.drools.common.NodeMemory;
 import org.drools.common.PropagationContextImpl;
@@ -30,7 +29,6 @@
 import org.drools.spi.Constraint;
 import org.drools.spi.ObjectType;
 import org.drools.spi.PropagationContext;
-import org.drools.util.FactEntry;
 import org.drools.util.FactHashTable;
 import org.drools.util.Iterator;
 
@@ -53,9 +51,9 @@
  * @author <a href="mailto:mark.proctor at jboss.com">Mark Proctor</a>
  * @author <a href="mailto:bob at werken.com">Bob McWhirter</a>
  */
-public class ObjectTypeNode extends ObjectSource
+public class ObjectTypeNode extends RightTupleSource
     implements
-    ObjectSink,
+    RightTupleSink,
     Serializable,
     NodeMemory
 
@@ -98,7 +96,7 @@
                context.getRuleBase().getConfiguration().getAlphaNodeHashingThreshold() );
         this.rete = (Rete) this.objectSource;
         this.objectType = objectType;
-        setObjectMemoryEnabled( context.isObjectTypeNodeMemoryEnabled() );
+        setRightTupleMemoryEnabled( context.isObjectTypeNodeMemoryEnabled() );
         this.entryPoint = context.getCurrentEntryPoint() == null ? EntryPoint.DEFAULT : context.getCurrentEntryPoint();
     }
 
@@ -133,16 +131,16 @@
      * <code>FactHandleImpl</code> should be remembered in the node memory, so that later runtime rule attachmnents
      * can have the matched facts propagated to them.
      * 
-     * @param handle
+     * @param rightTuple
      *            The fact handle.
      * @param object
      *            The object to assert.
      * @param workingMemory
      *            The working memory session.
      */
-    public void assertObject(final InternalFactHandle handle,
-                             final PropagationContext context,
-                             final InternalWorkingMemory workingMemory) {
+    public void assertRightTuple(final RightTuple rightTuple,
+                                 final PropagationContext context,
+                                 final InternalWorkingMemory workingMemory) {
         if ( context.getType() == PropagationContext.MODIFICATION && this.skipOnModify && context.getDormantActivations() == 0 ) {
             // we do this after the shadowproxy update, just so that its up to date for the future
             return;
@@ -150,52 +148,52 @@
 
         if ( this.objectMemoryEnabled ) {
             final FactHashTable memory = (FactHashTable) workingMemory.getNodeMemory( this );
-            memory.add( handle,
+            memory.add( rightTuple,
                         false );
         }
 
-        this.sink.propagateAssertObject( handle,
-                                         context,
-                                         workingMemory );
+        this.sink.propagateAssertRightTuple( rightTuple,
+                                             context,
+                                             workingMemory );
     }
 
     /**
      * Retract the <code>FactHandleimpl</code> from the <code>Rete</code> network. Also remove the 
      * <code>FactHandleImpl</code> from the node memory.
      * 
-     * @param handle
+     * @param rightTuple
      *            The fact handle.
      * @param object
      *            The object to assert.
      * @param workingMemory
      *            The working memory session.
      */
-    public void retractObject(final InternalFactHandle handle,
-                              final PropagationContext context,
-                              final InternalWorkingMemory workingMemory) {
+    public void retractRightTuple(final RightTuple rightTuple,
+                                  final PropagationContext context,
+                                  final InternalWorkingMemory workingMemory) {
 
         if ( context.getType() == PropagationContext.MODIFICATION && this.skipOnModify && context.getDormantActivations() == 0 ) {
             return;
         }
 
         final FactHashTable memory = (FactHashTable) workingMemory.getNodeMemory( this );
-        memory.remove( handle );
+        memory.remove( rightTuple );
 
-        this.sink.propagateRetractObject( handle,
-                                          context,
-                                          workingMemory,
-                                          true );
+        this.sink.propagateRetractRightTuple( rightTuple,
+                                              context,
+                                              workingMemory,
+                                              true );
     }
 
-    public void updateSink(final ObjectSink sink,
+    public void updateSink(final RightTupleSink sink,
                            final PropagationContext context,
                            final InternalWorkingMemory workingMemory) {
         final FactHashTable memory = (FactHashTable) workingMemory.getNodeMemory( this );
         final Iterator it = memory.iterator();
-        for ( FactEntry entry = (FactEntry) it.next(); entry != null; entry = (FactEntry) it.next() ) {
-            sink.assertObject( entry.getFactHandle(),
-                               context,
-                               workingMemory );
+        for ( RightTuple entry = (RightTuple) it.next(); entry != null; entry = (RightTuple) it.next() ) {
+            sink.assertRightTuple( entry,
+                                   context,
+                                   workingMemory );
         }
     }
 
@@ -228,7 +226,7 @@
     public void remove(final BaseNode node,
                        final InternalWorkingMemory[] workingMemories) {
         if ( !node.isInUse() ) {
-            removeObjectSink( (ObjectSink) node );
+            removeObjectSink( (RightTupleSink) node );
         }
         removeShare();
         if ( !this.isInUse() ) {
@@ -256,11 +254,11 @@
         return new FactHashTable();
     }
 
-    public boolean isObjectMemoryEnabled() {
+    public boolean isRightTupleMemoryEnabled() {
         return this.objectMemoryEnabled;
     }
 
-    public void setObjectMemoryEnabled(boolean objectMemoryEnabled) {
+    public void setRightTupleMemoryEnabled(boolean objectMemoryEnabled) {
         this.objectMemoryEnabled = objectMemoryEnabled;
     }
 
@@ -292,7 +290,7 @@
     /** 
      * @inheritDoc
      */
-    protected void addObjectSink(final ObjectSink objectSink) {
+    protected void addObjectSink(final RightTupleSink objectSink) {
         super.addObjectSink( objectSink );
         this.skipOnModify = canSkipOnModify( this.sink.getSinks() );
     }
@@ -300,7 +298,7 @@
     /**
      * @inheritDoc
      */
-    protected void removeObjectSink(final ObjectSink objectSink) {
+    protected void removeObjectSink(final RightTupleSink objectSink) {
         super.removeObjectSink( objectSink );
         this.skipOnModify = canSkipOnModify( this.sink.getSinks() );
     }
@@ -321,10 +319,10 @@
             } else if ( sinks[i] instanceof BetaNode && ((BetaNode) sinks[i]).getConstraints().length > 0 ) {
                 hasConstraints = this.usesDeclaration( ((BetaNode) sinks[i]).getConstraints() );
             }
-            if ( !hasConstraints && sinks[i] instanceof ObjectSource ) {
-                hasConstraints = this.canSkipOnModify( ((ObjectSource) sinks[i]).getSinkPropagator().getSinks() );
-            } else if ( sinks[i] instanceof TupleSource ) {
-                hasConstraints = this.canSkipOnModify( ((TupleSource) sinks[i]).getSinkPropagator().getSinks() );
+            if ( !hasConstraints && sinks[i] instanceof RightTupleSource ) {
+                hasConstraints = this.canSkipOnModify( ((RightTupleSource) sinks[i]).getSinkPropagator().getSinks() );
+            } else if ( sinks[i] instanceof LeftTupleSource ) {
+                hasConstraints = this.canSkipOnModify( ((LeftTupleSource) sinks[i]).getSinkPropagator().getSinks() );
             }
         }
 

Modified: labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/QueryTerminalNode.java
===================================================================
--- labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/QueryTerminalNode.java	2008-01-04 00:57:26 UTC (rev 17532)
+++ labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/QueryTerminalNode.java	2008-01-04 01:54:45 UTC (rev 17533)
@@ -37,7 +37,7 @@
  */
 public final class QueryTerminalNode extends BaseNode
     implements
-    TupleSinkNode,
+    LeftTupleSinkNode,
     NodeMemory,
     TerminalNode {
     // ------------------------------------------------------------
@@ -51,11 +51,11 @@
     /** The rule to invoke upon match. */
     private final Rule         rule;
     private final GroupElement subrule;
-    private final TupleSource  tupleSource;
+    private final LeftTupleSource  tupleSource;
     private boolean          tupleMemoryEnabled;    
     
-    private TupleSinkNode      previousTupleSinkNode;
-    private TupleSinkNode      nextTupleSinkNode;    
+    private LeftTupleSinkNode      previousTupleSinkNode;
+    private LeftTupleSinkNode      nextTupleSinkNode;    
 
     // ------------------------------------------------------------
     // Constructors
@@ -70,7 +70,7 @@
      *            The rule.
      */
     public QueryTerminalNode(final int id,
-                             final TupleSource source,
+                             final LeftTupleSource source,
                              final Rule rule,
                              final GroupElement subrule) {
         super( id );
@@ -107,7 +107,7 @@
      * @throws AssertionException
      *             If an error occurs while asserting.
      */
-    public void assertTuple(final ReteTuple tuple,
+    public void assertTuple(final LeftTuple tuple,
                             final PropagationContext context,
                             final InternalWorkingMemory workingMemory) {
         final LinkedList list = (LinkedList) workingMemory.getNodeMemory( this );
@@ -118,7 +118,7 @@
         list.add( tuple );
     }
 
-    public void retractTuple(final ReteTuple tuple,
+    public void retractTuple(final LeftTuple tuple,
                              final PropagationContext context,
                              final InternalWorkingMemory workingMemory) {
     }
@@ -191,7 +191,7 @@
      * @return
      *      The previous TupleSinkNode
      */
-    public TupleSinkNode getPreviousTupleSinkNode() {
+    public LeftTupleSinkNode getPreviousRightTupleSinkNode() {
         return this.previousTupleSinkNode;
     }
 
@@ -200,7 +200,7 @@
      * @param previous
      *      The previous TupleSinkNode
      */
-    public void setPreviousTupleSinkNode(final TupleSinkNode previous) {
+    public void setPreviousLeftTupleSinkNode(final LeftTupleSinkNode previous) {
         this.previousTupleSinkNode = previous;
     }    
     
@@ -209,7 +209,7 @@
      * @return
      *      The next TupleSinkNode
      */
-    public TupleSinkNode getNextTupleSinkNode() {
+    public LeftTupleSinkNode getNextLeftTupleSinkNode() {
         return this.nextTupleSinkNode;
     }
 
@@ -218,7 +218,7 @@
      * @param next
      *      The next TupleSinkNode
      */
-    public void setNextTupleSinkNode(final TupleSinkNode next) {
+    public void setNextLeftTupleSinkNode(final LeftTupleSinkNode next) {
         this.nextTupleSinkNode = next;
     }    
 

Modified: labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/Rete.java
===================================================================
--- labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/Rete.java	2008-01-04 00:57:26 UTC (rev 17532)
+++ labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/Rete.java	2008-01-04 01:54:45 UTC (rev 17533)
@@ -25,14 +25,12 @@
 import org.drools.base.ShadowProxy;
 import org.drools.common.BaseNode;
 import org.drools.common.DroolsObjectInputStream;
-import org.drools.common.InternalFactHandle;
 import org.drools.common.InternalRuleBase;
 import org.drools.common.InternalWorkingMemory;
 import org.drools.common.NodeMemory;
 import org.drools.rule.EntryPoint;
 import org.drools.spi.ObjectType;
 import org.drools.spi.PropagationContext;
-import org.drools.util.FactEntry;
 import org.drools.util.FactHashTable;
 import org.drools.util.Iterator;
 import org.drools.util.ObjectHashMap;
@@ -57,10 +55,10 @@
  * @author <a href="mailto:mark.proctor at jboss.com">Mark Proctor</a>
  * @author <a href="mailto:bob at werken.com">Bob McWhirter</a>
  */
-public class Rete extends ObjectSource
+public class Rete extends RightTupleSource
     implements
     Serializable,
-    ObjectSink {
+    RightTupleSink {
     // ------------------------------------------------------------
     // Instance members
     // ------------------------------------------------------------
@@ -101,38 +99,39 @@
      * of matching <code>ObjectTypdeNode</code>s asserting the Fact. If the cache does not
      * exist it first iteraes and builds the cache.
      *
-     * @param handle
+     * @param rightTuple
      *            The FactHandle of the fact to assert
      * @param context
      *            The <code>PropagationContext</code> of the <code>WorkingMemory</code> action
      * @param workingMemory
      *            The working memory session.
      */
-    public void assertObject(final InternalFactHandle handle,
-                             final PropagationContext context,
-                             final InternalWorkingMemory workingMemory) {
+    public void assertRightTuple(final RightTuple rightTuple,
+                                 final PropagationContext context,
+                                 final InternalWorkingMemory workingMemory) {
+        Object object = rightTuple.getHandle().getObject();
 
         ObjectTypeConf objectTypeConf = workingMemory.getObjectTypeConf( context.getEntryPoint(),
-                                                                         handle.getObject() );
+                                                                         object );
 
         // checks if shadow is enabled
         if ( objectTypeConf.isShadowEnabled() ) {
             // need to improve this
-            if ( !(handle.getObject() instanceof ShadowProxy) ) {
+            if ( !(rightTuple.getHandle().getObject() instanceof ShadowProxy) ) {
                 // replaces the actual object by its shadow before propagating
-                handle.setObject( objectTypeConf.getShadow( handle.getObject() ) );
-                handle.setShadowFact( true );
+                rightTuple.getHandle().setObject( objectTypeConf.getShadow( object ) );
+                rightTuple.getHandle().setShadowFact( true );
             } else {
-                ((ShadowProxy) handle.getObject()).updateProxy();
+                ((ShadowProxy) object).updateProxy();
             }
         }
 
         ObjectTypeNode[] cachedNodes = objectTypeConf.getObjectTypeNodes();
 
         for ( int i = 0, length = cachedNodes.length; i < length; i++ ) {
-            cachedNodes[i].assertObject( handle,
-                                         context,
-                                         workingMemory );
+            cachedNodes[i].assertRightTuple( rightTuple,
+                                             context,
+                                             workingMemory );
         }
     }
 
@@ -140,15 +139,15 @@
      * Retract a fact object from this <code>RuleBase</code> and the specified
      * <code>WorkingMemory</code>.
      *
-     * @param handle
+     * @param rightTuple
      *            The handle of the fact to retract.
      * @param workingMemory
      *            The working memory session.
      */
-    public void retractObject(final InternalFactHandle handle,
-                              final PropagationContext context,
-                              final InternalWorkingMemory workingMemory) {
-        final Object object = handle.getObject();
+    public void retractRightTuple(final RightTuple rightTuple,
+                                  final PropagationContext context,
+                                  final InternalWorkingMemory workingMemory) {
+        final Object object = rightTuple.getHandle().getObject();
 
         ObjectTypeConf objectTypeConf = workingMemory.getObjectTypeConf( context.getEntryPoint(),
                                                                          object );
@@ -160,9 +159,9 @@
         }
 
         for ( int i = 0; i < cachedNodes.length; i++ ) {
-            cachedNodes[i].retractObject( handle,
-                                          context,
-                                          workingMemory );
+            cachedNodes[i].retractRightTuple( rightTuple,
+                                              context,
+                                              workingMemory );
         }
     }
 
@@ -175,7 +174,7 @@
      *            <code>Objects</code>. Rete only accepts <code>ObjectTypeNode</code>s
      *            as parameters to this method, though.
      */
-    protected void addObjectSink(final ObjectSink objectSink) {
+    protected void addObjectSink(final RightTupleSink objectSink) {
         final ObjectTypeNode node = (ObjectTypeNode) objectSink;
         ObjectHashMap map = this.entryPoints.get( node.getEntryPoint() );
         if ( map == null ) {
@@ -188,7 +187,7 @@
                  true );
     }
 
-    protected void removeObjectSink(final ObjectSink objectSink) {
+    protected void removeObjectSink(final RightTupleSink objectSink) {
         final ObjectTypeNode node = (ObjectTypeNode) objectSink;
         this.entryPoints.get( node.getEntryPoint() ).remove( node.getObjectType() );
     }
@@ -213,10 +212,11 @@
 
     public Map<ObjectType, ObjectTypeNode> getObjectTypeNodes() {
         Map<ObjectType, ObjectTypeNode> allNodes = new HashMap<ObjectType, ObjectTypeNode>();
-        for( ObjectHashMap map : this.entryPoints.values() ) {
+        for ( ObjectHashMap map : this.entryPoints.values() ) {
             Iterator it = map.iterator();
             for ( ObjectEntry entry = (ObjectEntry) it.next(); entry != null; entry = (ObjectEntry) it.next() ) {
-                allNodes.put( (ObjectType) entry.getKey(), (ObjectTypeNode) entry.getValue() );
+                allNodes.put( (ObjectType) entry.getKey(),
+                              (ObjectTypeNode) entry.getValue() );
             }
         }
         return allNodes;
@@ -247,7 +247,7 @@
         return this.entryPoints.equals( other.entryPoints );
     }
 
-    public void updateSink(final ObjectSink sink,
+    public void updateSink(final RightTupleSink sink,
                            final PropagationContext context,
                            final InternalWorkingMemory workingMemory) {
         // JBRULES-612: the cache MUST be invalidated when a new node type is added to the network, so iterate and reset all caches.
@@ -260,20 +260,20 @@
                 ObjectTypeNode sourceNode = objectTypeConf.getConcreteObjectTypeNode();
                 FactHashTable table = (FactHashTable) workingMemory.getNodeMemory( sourceNode );
                 Iterator factIter = table.iterator();
-                for ( FactEntry factEntry = (FactEntry) factIter.next(); factEntry != null; factEntry = (FactEntry) factIter.next() ) {
-                    sink.assertObject( factEntry.getFactHandle(),
-                                       context,
-                                       workingMemory );
+                for ( RightTuple factEntry = (RightTuple) factIter.next(); factEntry != null; factEntry = (RightTuple) factIter.next() ) {
+                    sink.assertRightTuple( factEntry,
+                                           context,
+                                           workingMemory );
                 }
             }
         }
     }
 
-    public boolean isObjectMemoryEnabled() {
+    public boolean isRightTupleMemoryEnabled() {
         throw new UnsupportedOperationException( "Rete has no Object memory" );
     }
 
-    public void setObjectMemoryEnabled(boolean objectMemoryEnabled) {
+    public void setRightTupleMemoryEnabled(boolean objectMemoryEnabled) {
         throw new UnsupportedOperationException( "ORete has no Object memory" );
     }
 

Deleted: labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/ReteTuple.java
===================================================================
--- labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/ReteTuple.java	2008-01-04 00:57:26 UTC (rev 17532)
+++ labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/ReteTuple.java	2008-01-04 01:54:45 UTC (rev 17533)
@@ -1,217 +0,0 @@
-package org.drools.reteoo;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.drools.base.ShadowProxy;
-import org.drools.common.InternalFactHandle;
-import org.drools.rule.Declaration;
-import org.drools.spi.Activation;
-import org.drools.spi.Tuple;
-import org.drools.util.Entry;
-
-public class ReteTuple
-    implements
-    Tuple,
-    Entry {
-    private static final long        serialVersionUID = 400L;
-
-    private int                      index;
-
-    private final InternalFactHandle handle;
-
-    private ReteTuple                parent;
-
-    private Activation               activation;
-
-    private long                     recency;
-
-    private int                      hashCode;
-    
-    private InternalFactHandle       match;
-
-    private Entry                    next;
-
-    // ------------------------------------------------------------
-    // Constructors
-    // ------------------------------------------------------------
-    public ReteTuple(final InternalFactHandle handle) {
-        this.recency = handle.getRecency();
-        this.handle = handle;
-        int h = handle.hashCode();
-        h += ~(h << 9);
-        h ^= (h >>> 14);
-        h += (h << 4);
-        h ^= (h >>> 10);
-        this.hashCode = h;
-    }
-
-    public ReteTuple(final ReteTuple tuple) {
-        this.index = tuple.index;
-        this.parent = tuple.parent;
-        this.recency = tuple.recency;
-        this.handle = tuple.handle;
-        this.hashCode = tuple.hashCode();
-    }
-
-    public ReteTuple(final ReteTuple parentTuple,
-                     final InternalFactHandle handle) {
-        this.index = parentTuple.index + 1;
-        this.parent = parentTuple;
-        this.recency = parentTuple.recency + handle.getRecency();
-        this.handle = handle;
-        this.hashCode = parentTuple.hashCode ^ (handle.hashCode() * 31);
-    }
-
-    public InternalFactHandle get(final int index) {
-        ReteTuple entry = this;
-        while ( entry.index != index ) {
-            entry = entry.parent;
-        }
-        return entry.handle;
-    }
-
-    public void setNext(final Entry next) {
-        this.next = next;
-    }
-
-    public Entry getNext() {
-        return this.next;
-    }
-
-    public InternalFactHandle getLastHandle() {
-        return this.handle;
-    }
-
-    public InternalFactHandle get(final Declaration declaration) {
-        return get( declaration.getPattern().getOffset() );
-    }
-
-    public Activation getActivation() {
-        return this.activation;
-    }
-
-    /**
-     * Returns the fact handles in reverse order
-     */
-    public InternalFactHandle[] getFactHandles() {
-        final List list = new ArrayList();
-        ReteTuple entry = this;
-        while ( entry != null ) {
-            list.add( entry.handle );
-            entry = entry.parent;
-        }
-
-        return (InternalFactHandle[]) list.toArray( new InternalFactHandle[list.size()] );
-    }
-
-    public long getRecency() {
-        return this.recency;
-    }
-        
-
-    public InternalFactHandle getMatch() {
-        return match;
-    }
-
-    public void setMatch(InternalFactHandle match) {
-        this.match = match;
-    }
-
-    public void setActivation(final Activation activation) {
-        this.activation = activation;
-    }
-
-    public int hashCode() {
-        return this.hashCode;
-    }
-
-    public String toString() {
-        final StringBuffer buffer = new StringBuffer();
-
-        ReteTuple entry = this;
-        while ( entry != null ) {
-            //buffer.append( entry.handle );
-            buffer.append( entry.handle + "\n" );
-            entry = entry.parent;
-        }
-        return buffer.toString();
-    }
-
-    /**
-     * We use this equals method to avoid the cast
-     * @param tuple
-     * @return
-     */
-    public boolean equals(final ReteTuple other) {
-        // we know the object is never null and always of the  type ReteTuple
-        if ( other == this ) {
-            return true;
-        }
-
-        // A ReteTuple is  only the same if it has the same hashCode, factId and parent
-        if ( (other == null) || (this.hashCode != other.hashCode) ) {
-            return false;
-        }
-
-        if ( this.handle != other.handle ) {
-            return false;
-        }
-
-        if ( this.parent == null ) {
-            return (other.parent == null);
-        } else {
-            return this.parent.equals( other.parent );
-        }
-    }
-
-    public boolean equals(final Object object) {
-        // we know the object is never null and always of the  type ReteTuple    
-        return equals( (ReteTuple) object );
-    }
-
-    public int size() {
-        return this.index + 1;
-    }
-
-    /**
-     * Returns the ReteTuple that contains the "elements"
-     * first elements in this tuple.
-     * 
-     * Use carefully as no cloning is made during this process.
-     * 
-     * This method is used by TupleStartEqualsConstraint when
-     * joining a subnetwork tuple into the main network tuple;
-     * 
-     * @param elements the number of elements to return, starting from
-     * the begining of the tuple
-     * 
-     * @return a ReteTuple containing the "elements" first elements
-     * of this tuple or null if "elements" is greater than size; 
-     */
-    public ReteTuple getSubTuple(final int elements) {
-        ReteTuple entry = this;
-        if ( elements < this.size() ) {
-            final int lastindex = elements - 1;
-
-            while ( entry.index != lastindex ) {
-                entry = entry.parent;
-            }
-        }
-        return entry;
-    }
-    
-    public Object[] toObjectArray() {        
-        Object[] objects = new Object[ this.index + 1 ];
-        ReteTuple entry = this;       
-        while ( entry != null ) {
-            Object object = entry.getLastHandle().getObject();
-            if ( object instanceof ShadowProxy ) {
-                object = ((ShadowProxy)object).getShadowedObject();
-            }
-            objects[entry.index] = object;
-            entry = entry.parent;
-        }   
-        return objects;
-    }
-}

Modified: labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/ReteooRuleBase.java
===================================================================
--- labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/ReteooRuleBase.java	2008-01-04 00:57:26 UTC (rev 17532)
+++ labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/ReteooRuleBase.java	2008-01-04 01:54:45 UTC (rev 17533)
@@ -61,10 +61,10 @@
     private static final long serialVersionUID = 400L;
 
     /** The root Rete-OO for this <code>RuleBase</code>. */
-    private transient Rete              rete;
+    private transient Rete    rete;
 
     private ReteooBuilder     reteooBuilder;
-    
+
     // ------------------------------------------------------------
     // Constructors
     // ------------------------------------------------------------
@@ -149,12 +149,12 @@
     public void readExternal(final ObjectInput stream) throws IOException,
                                                       ClassNotFoundException {
         doReadExternal( stream );
-        
+
         // rebuild the Rete network from the pkg information
         this.reteooBuilder = new ReteooBuilder( this );
-        this.rete = new Rete( this );        
-        synchronized ( this.pkgs ) {            
-            for (Package pkg : this.pkgs.values() ) {
+        this.rete = new Rete( this );
+        synchronized ( this.pkgs ) {
+            for ( Package pkg : this.pkgs.values() ) {
                 for ( Rule rule : pkg.getRules() ) {
                     addRule( rule );
                 }
@@ -174,7 +174,7 @@
     public Rete getRete() {
         return this.rete;
     }
-    
+
     public ReteooBuilder getReteooBuilder() {
         return this.reteooBuilder;
     }
@@ -196,9 +196,9 @@
                              final Object object,
                              final PropagationContext context,
                              final InternalWorkingMemory workingMemory) throws FactException {
-        getRete().assertObject( (DefaultFactHandle) handle,
-                                context,
-                                workingMemory );
+        getRete().assertRightTuple( new RightTuple( (InternalFactHandle) handle ),
+                                    context,
+                                    workingMemory );
     }
 
     /**
@@ -215,55 +215,62 @@
     public void retractObject(final FactHandle handle,
                               final PropagationContext context,
                               final ReteooWorkingMemory workingMemory) throws FactException {
-        getRete().retractObject( (InternalFactHandle) handle,
-                                 context,
-                                 workingMemory );
+        getRete().retractRightTuple( new RightTuple( (InternalFactHandle) handle ),
+                                     context,
+                                     workingMemory );
     }
 
-    public synchronized StatefulSession newStatefulSession( final boolean keepReference ) {
-        return newStatefulSession( keepReference, null );
+    public synchronized StatefulSession newStatefulSession(final boolean keepReference) {
+        return newStatefulSession( keepReference,
+                                   null );
     }
-    
-    public synchronized TemporalSession newTemporalSession( final ClockType clockType ) {
-        return (TemporalSession) newStatefulSession( true, clockType);
+
+    public synchronized TemporalSession newTemporalSession(final ClockType clockType) {
+        return (TemporalSession) newStatefulSession( true,
+                                                     clockType );
     }
-    
-    public synchronized TemporalSession newTemporalSession( final boolean keepReference, final ClockType clockType ) {
-        return (TemporalSession) newStatefulSession( keepReference, clockType );
+
+    public synchronized TemporalSession newTemporalSession(final boolean keepReference,
+                                                           final ClockType clockType) {
+        return (TemporalSession) newStatefulSession( keepReference,
+                                                     clockType );
     }
-    
+
     /**
      * @see RuleBase
      */
-    private StatefulSession newStatefulSession( final boolean keepReference, final ClockType clockType ) {
+    private StatefulSession newStatefulSession(final boolean keepReference,
+                                               final ClockType clockType) {
         if ( this.config.isSequential() ) {
             throw new RuntimeException( "Cannot have a stateful rule session, with sequential configuration set to true" );
         }
         ReteooStatefulSession session = null;
 
         synchronized ( this.pkgs ) {
-            ExecutorService executor = ExecutorServiceFactory.createExecutorService(  this.config.getExecutorService() );;
-            if( clockType == null ) {
+            ExecutorService executor = ExecutorServiceFactory.createExecutorService( this.config.getExecutorService() );;
+            if ( clockType == null ) {
                 session = new ReteooStatefulSession( nextWorkingMemoryCounter(),
                                                      this,
                                                      executor );
             } else {
                 session = new ReteooTemporalSession( nextWorkingMemoryCounter(),
-                                                             this,
-                                                             executor,
-                                                             clockType.createInstance() );
+                                                     this,
+                                                     executor,
+                                                     clockType.createInstance() );
             }
 
             executor.setCommandExecutor( new CommandExecutor( session ) );
 
             if ( keepReference ) {
                 super.addStatefulSession( session );
-                for( Iterator it = session.getRuleBaseUpdateListeners().iterator(); it.hasNext(); ) {
-                    addEventListener( (RuleBaseEventListener) it.next() ); 
+                for ( Iterator it = session.getRuleBaseUpdateListeners().iterator(); it.hasNext(); ) {
+                    addEventListener( (RuleBaseEventListener) it.next() );
                 }
             }
 
-            final InitialFactHandle handle = new InitialFactHandle( session.getFactHandleFactory().newFactHandle( new InitialFactHandleDummyObject(), false, session ) );
+            final InitialFactHandle handle = new InitialFactHandle( session.getFactHandleFactory().newFactHandle( new InitialFactHandleDummyObject(),
+                                                                                                                  false,
+                                                                                                                  session ) );
 
             session.queueWorkingMemoryAction( new WorkingMemoryReteAssertAction( handle,
                                                                                  false,
@@ -271,10 +278,10 @@
                                                                                  null,
                                                                                  null ) );
         }
-        
+
         return session;
     }
-    
+
     public StatelessSession newStatelessSession() {
 
         //orders the rules
@@ -301,5 +308,5 @@
         Serializable {
         private static final long serialVersionUID = 400L;
     }
-    
+
 }

Modified: labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/RightInputAdapterNode.java
===================================================================
--- labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/RightInputAdapterNode.java	2008-01-04 00:57:26 UTC (rev 17532)
+++ labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/RightInputAdapterNode.java	2008-01-04 01:54:45 UTC (rev 17533)
@@ -38,19 +38,19 @@
  * @author <a href="mailto:etirelli at redhat.com">Edson Tirelli</a>
  *
  */
-public class RightInputAdapterNode extends ObjectSource
+public class RightInputAdapterNode extends RightTupleSource
     implements
-    TupleSinkNode,
+    LeftTupleSinkNode,
     NodeMemory {
 
     private static final long serialVersionUID = 400L;
 
-    private final TupleSource tupleSource;
+    private final LeftTupleSource tupleSource;
     
     protected boolean          tupleMemoryEnabled;      
 
-    private TupleSinkNode       previousTupleSinkNode;
-    private TupleSinkNode       nextTupleSinkNode;
+    private LeftTupleSinkNode       previousTupleSinkNode;
+    private LeftTupleSinkNode       nextTupleSinkNode;
 
     /**
      * Constructor specifying the unique id of the node in the Rete network, the position of the propagating <code>FactHandleImpl</code> in
@@ -62,7 +62,7 @@
      *      The <code>TupleSource</code> which propagates the received <code>ReteTuple</code>
      */
     public RightInputAdapterNode(final int id,
-                                 final TupleSource source,
+                                 final LeftTupleSource source,
                                  final BuildContext context) {
         super( id );
         this.tupleSource = source;
@@ -87,7 +87,7 @@
      * @param workingMemory
      *            the <code>WorkingMemory</code> session.
      */
-    public void assertTuple(final ReteTuple tuple,
+    public void assertTuple(final LeftTuple tuple,
                             final PropagationContext context,
                             final InternalWorkingMemory workingMemory) {
 
@@ -102,7 +102,7 @@
         }
 
         // propagate it
-        this.sink.propagateAssertObject( handle,
+        this.sink.propagateAssertRightTuple( handle,
                                          context,
                                          workingMemory );
     }
@@ -111,7 +111,7 @@
      * Retracts the corresponding tuple by retrieving and retracting
      * the fact created for it
      */
-    public void retractTuple(final ReteTuple tuple,
+    public void retractTuple(final LeftTuple tuple,
                              final PropagationContext context,
                              final InternalWorkingMemory workingMemory) {
 
@@ -121,7 +121,7 @@
         final InternalFactHandle handle = (InternalFactHandle) memory.remove( tuple );
 
         // propagate a retract for it
-        this.sink.propagateRetractObject( handle,
+        this.sink.propagateRetractRightTuple( handle,
                                           context,
                                           workingMemory,
                                           true );
@@ -149,7 +149,7 @@
         }
     }
 
-    public void updateSink(final ObjectSink sink,
+    public void updateSink(final RightTupleSink sink,
                            final PropagationContext context,
                            final InternalWorkingMemory workingMemory) {
 
@@ -159,7 +159,7 @@
 
         // iterates over all propagated handles and assert them to the new sink
         for ( ObjectEntry entry = (ObjectEntry) it.next(); entry != null; entry = (ObjectEntry) it.next() ) {
-            sink.assertObject( (InternalFactHandle) entry.getValue(),
+            sink.assertRightTuple( (InternalFactHandle) entry.getValue(),
                                context,
                                workingMemory );
         }
@@ -168,7 +168,7 @@
     public void remove(final BaseNode node,
                        final InternalWorkingMemory[] workingMemories) {
         if ( !node.isInUse() ) {
-            removeObjectSink( (ObjectSink) node );
+            removeObjectSink( (RightTupleSink) node );
         }
         removeShare();
         this.tupleSource.remove( this,
@@ -188,7 +188,7 @@
      * @return
      *      The next TupleSinkNode
      */
-    public TupleSinkNode getNextTupleSinkNode() {
+    public LeftTupleSinkNode getNextLeftTupleSinkNode() {
         return this.nextTupleSinkNode;
     }
 
@@ -197,7 +197,7 @@
      * @param next
      *      The next TupleSinkNode
      */
-    public void setNextTupleSinkNode(final TupleSinkNode next) {
+    public void setNextLeftTupleSinkNode(final LeftTupleSinkNode next) {
         this.nextTupleSinkNode = next;
     }
 
@@ -206,7 +206,7 @@
      * @return
      *      The previous TupleSinkNode
      */
-    public TupleSinkNode getPreviousTupleSinkNode() {
+    public LeftTupleSinkNode getPreviousRightTupleSinkNode() {
         return this.previousTupleSinkNode;
     }
 
@@ -215,7 +215,7 @@
      * @param previous
      *      The previous TupleSinkNode
      */
-    public void setPreviousTupleSinkNode(final TupleSinkNode previous) {
+    public void setPreviousLeftTupleSinkNode(final LeftTupleSinkNode previous) {
         this.previousTupleSinkNode = previous;
     }
 

Copied: labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/RightTupleMemory.java (from rev 17522, labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/FactHandleMemory.java)
===================================================================
--- labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/RightTupleMemory.java	                        (rev 0)
+++ labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/RightTupleMemory.java	2008-01-04 01:54:45 UTC (rev 17533)
@@ -0,0 +1,25 @@
+package org.drools.reteoo;
+
+import org.drools.common.InternalFactHandle;
+import org.drools.util.Entry;
+import org.drools.util.Iterator;
+
+public interface RightTupleMemory {
+    public Iterator iterator();
+
+    public Iterator iterator(LeftTuple leftTuple);
+
+    public boolean add(RightTuple rightTuple,
+                       boolean checkExists);
+
+    public boolean add(RightTuple rightTuple);
+
+    public boolean remove(RightTuple rightTuple);
+
+    public boolean contains(RightTuple rightTuple);
+
+    public boolean isIndexed();
+
+    public int size();
+
+}

Copied: labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/RightTupleSink.java (from rev 17522, labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/ObjectSink.java)
===================================================================
--- labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/RightTupleSink.java	                        (rev 0)
+++ labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/RightTupleSink.java	2008-01-04 01:54:45 UTC (rev 17533)
@@ -0,0 +1,67 @@
+package org.drools.reteoo;
+
+/*
+ * Copyright 2005 JBoss Inc
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import org.drools.common.InternalWorkingMemory;
+import org.drools.spi.PropagationContext;
+
+/**
+ * Receiver of propagated <code>FactHandleImpl</code>s from a
+ * <code>ObjectSource</code>.
+ * 
+ * @see ObectSource
+ * 
+ * @author <a href="mailto:mark.proctor at jboss.com">Mark Proctor</a>
+ * @author <a href="mailto:bob at werken.com">Bob McWhirter</a>
+ *
+ */
+public interface RightTupleSink
+    extends
+    Sink {
+
+    /**
+     * Assert a new <code>FactHandleImpl</code>.
+     * 
+     * @param rightTuple
+     *            The asserted <code>FactHandle/code>.
+     * @param context
+     *             The <code>PropagationContext</code> of the <code>WorkingMemory<code> action.           
+     * @param workingMemory
+     *            the <code>WorkingMemory</code> session.
+     */
+    void assertRightTuple(RightTuple rightTuple,
+                      PropagationContext context,
+                      InternalWorkingMemory workingMemory);
+
+    /**
+     * Retract an existing <code>FactHandleImpl</code>.
+     * 
+     * @param rightTuple
+     *            The <code>FactHandle/code> to retract.
+     * @param context
+     *             The <code>PropagationContext</code> of the <code>WorkingMemory<code> action.           
+     * @param workingMemory
+     *            the <code>WorkingMemory</code> session.
+     */
+    void retractRightTuple(RightTuple rightTuple,
+                       PropagationContext context,
+                       InternalWorkingMemory workingMemory);
+
+    public boolean isRightTupleMemoryEnabled();
+
+    public void setRightTupleMemoryEnabled(boolean objectMemoryOn);
+}

Copied: labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/RightTupleSinkNode.java (from rev 17522, labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/ObjectSinkNode.java)
===================================================================
--- labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/RightTupleSinkNode.java	                        (rev 0)
+++ labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/RightTupleSinkNode.java	2008-01-04 01:54:45 UTC (rev 17533)
@@ -0,0 +1,59 @@
+package org.drools.reteoo;
+
+/*
+ * Copyright 2005 JBoss Inc
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * Items placed in a <code>LinkedList<code> must implement this interface .
+ * 
+ * @see LeftTupleSinkNodeList
+ * 
+ * @author <a href="mailto:mark.proctor at jboss.com">Mark Proctor</a>
+ * @author <a href="mailto:bob at werken.com">Bob McWhirter</a>
+ */
+public interface RightTupleSinkNode
+    extends
+    RightTupleSink {
+
+    /**
+     * Returns the next node
+     * @return
+     *      The next LinkedListNode
+     */
+    public RightTupleSinkNode getNextRightTupleSinkNode();
+
+    /**
+     * Sets the next node 
+     * @param next
+     *      The next LinkedListNode
+     */
+    public void setNextRightTupleSinkNode(RightTupleSinkNode next);
+
+    /**
+     * Returns the previous node
+     * @return
+     *      The previous LinkedListNode
+     */
+    public RightTupleSinkNode getPreviousRightTupleSinkNode();
+
+    /**
+     * Sets the previous node 
+     * @param previous
+     *      The previous LinkedListNode
+     */
+    public void setPreviousRightTupleSinkNode(RightTupleSinkNode previous);
+
+}

Copied: labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/RightTupleSinkNodeList.java (from rev 17522, labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/ObjectSinkNodeList.java)
===================================================================
--- labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/RightTupleSinkNodeList.java	                        (rev 0)
+++ labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/RightTupleSinkNodeList.java	2008-01-04 01:54:45 UTC (rev 17533)
@@ -0,0 +1,229 @@
+package org.drools.reteoo;
+
+import java.io.Serializable;
+import java.util.Iterator;
+import java.util.NoSuchElementException;
+
+/*
+ * Copyright 2005 JBoss Inc
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * This is a simple linked linked implementation. Each node must implement </code>LinkedListNode<code> so that it references
+ * the node before and after it. This way a node can be removed without having to scan the list to find it. This class
+ * does not provide an Iterator implementation as its designed for efficiency and not genericity. There are a number of 
+ * ways to iterate the list.
+ * <p>
+ * Simple iterator:
+ * <pre>
+ * for ( LinkedListNode node = list.getFirst(); node != null; node =  node.getNext() ) {
+ * }
+ * </pre>
+ * 
+ * Iterator that pops the first entry:
+ * <pre>
+ * for ( LinkedListNode node = list.removeFirst(); node != null; node = list.removeFirst() ) {
+ * }
+ * </pre>
+ *
+ *
+ * @author <a href="mailto:mark.proctor at jboss.com">Mark Proctor</a>
+ * @author <a href="mailto:bob at werken.com">Bob McWhirter</a>
+ *
+ */
+public class RightTupleSinkNodeList
+    implements
+    Serializable {
+    private static final long serialVersionUID = 400L;
+
+    private RightTupleSinkNode    firstNode;
+    private RightTupleSinkNode    lastNode;
+
+    private int               size;
+
+    /**
+     * Construct an empty <code>LinkedList</code>
+     */
+    public RightTupleSinkNodeList() {
+
+    }
+
+    /**
+     * Add a <code>ObjectSinkNode</code> to the list. If the <code>LinkedList</code> is empty then the first and 
+     * last nodes are set to the added node.
+     * 
+     * @param node
+     *      The <code>ObjectSinkNode</code> to be added
+     */
+    public void add(final RightTupleSinkNode node) {
+        if ( this.firstNode == null ) {
+            this.firstNode = node;
+            this.lastNode = node;;
+        } else {
+            this.lastNode.setNextRightTupleSinkNode( node );
+            node.setPreviousRightTupleSinkNode( this.lastNode );
+            this.lastNode = node;
+        }
+        this.size++;
+    }
+
+    /**
+     * Removes a <code>ObjectSinkNode</code> from the list. This works by attach the previous reference to the child reference.
+     * When the node to be removed is the first node it calls <code>removeFirst()</code>. When the node to be removed is the last node
+     * it calls <code>removeLast()</code>.
+     * 
+     * @param node
+     *      The <code>ObjectSinkNode</code> to be removed.
+     */
+    public void remove(final RightTupleSinkNode node) {
+        if ( (this.firstNode != node) && (this.lastNode != node) ) {
+            node.getPreviousRightTupleSinkNode().setNextRightTupleSinkNode( node.getNextRightTupleSinkNode() );
+            node.getNextRightTupleSinkNode().setPreviousRightTupleSinkNode( node.getPreviousRightTupleSinkNode() );
+            this.size--;
+            node.setPreviousRightTupleSinkNode( null );
+            node.setNextRightTupleSinkNode( null );
+
+        } else {
+            if ( this.firstNode == node ) {
+                removeFirst();
+            } else if ( this.lastNode == node ) {
+                removeLast();
+            }
+        }
+    }
+
+    /**
+     * Return the first node in the list
+     * @return
+     *      The first <code>ObjectSinkNode</code>.
+     */
+    public final RightTupleSinkNode getFirst() {
+        return this.firstNode;
+    }
+
+    /**
+     * Return the last node in the list
+     * @return
+     *      The last <code>ObjectSinkNode</code>.
+     */
+    public final RightTupleSinkNode getLast() {
+        return this.lastNode;
+    }
+
+    /**
+     * Remove the first node from the list. The next node then becomes the first node. If this is the last 
+     * node then both first and last node references are set to null.
+     * 
+     * @return
+     *      The first <code>ObjectSinkNode</code>.
+     */
+    public RightTupleSinkNode removeFirst() {
+        if ( this.firstNode == null ) {
+            return null;
+        }
+        final RightTupleSinkNode node = this.firstNode;
+        this.firstNode = node.getNextRightTupleSinkNode();
+        node.setNextRightTupleSinkNode( null );
+        if ( this.firstNode != null ) {
+            this.firstNode.setPreviousRightTupleSinkNode( null );
+        } else {
+            this.lastNode = null;
+        }
+        this.size--;
+        return node;
+    }
+
+    /**
+     * Remove the last node from the list. The previous node then becomes the last node. If this is the last 
+     * node then both first and last node references are set to null.
+     * 
+     * @return
+     *      The first <code>ObjectSinkNode</code>.
+     */
+    public RightTupleSinkNode removeLast() {
+        if ( this.lastNode == null ) {
+            return null;
+        }
+        final RightTupleSinkNode node = this.lastNode;
+        this.lastNode = node.getPreviousRightTupleSinkNode();
+        node.setPreviousRightTupleSinkNode( null );
+        if ( this.lastNode != null ) {
+            this.lastNode.setNextRightTupleSinkNode( null );
+        } else {
+            this.firstNode = this.lastNode;
+        }
+        this.size--;
+        return node;
+    }
+
+    /**
+     * @return
+     *      boolean value indicating the empty status of the list
+     */
+    public final boolean isEmpty() {
+        return (this.firstNode == null);
+    }
+
+    /**
+     * Iterates the list removing all the nodes until there are no more nodes to remove. 
+     */
+    public void clear() {
+        while ( removeFirst() != null ) {
+        }
+    }
+
+    /**
+     * @return
+     *     return size of the list as an int
+     */
+    public final int size() {
+        return this.size;
+    }
+
+    /**
+     * Returns a list iterator
+     * @return
+     */
+    public Iterator iterator() {
+        return new Iterator() {
+            private RightTupleSinkNode currentNode = null;
+            private RightTupleSinkNode nextNode    = getFirst();
+
+            public boolean hasNext() {
+                return (this.nextNode != null);
+            }
+
+            public Object next() {
+                this.currentNode = this.nextNode;
+                if ( this.currentNode != null ) {
+                    this.nextNode = this.currentNode.getNextRightTupleSinkNode();
+                } else {
+                    throw new NoSuchElementException( "No more elements to return" );
+                }
+                return this.currentNode;
+            }
+
+            public void remove() {
+                if ( this.currentNode != null ) {
+                    RightTupleSinkNodeList.this.remove( this.currentNode );
+                    this.currentNode = null;
+                } else {
+                    throw new IllegalStateException( "No item to remove. Call next() before calling remove()." );
+                }
+            }
+        };
+    }
+
+}

Copied: labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/RightTupleSource.java (from rev 17522, labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/ObjectSource.java)
===================================================================
--- labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/RightTupleSource.java	                        (rev 0)
+++ labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/RightTupleSource.java	2008-01-04 01:54:45 UTC (rev 17533)
@@ -0,0 +1,137 @@
+package org.drools.reteoo;
+
+/*
+ * Copyright 2005 JBoss Inc
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import java.io.Serializable;
+
+import org.drools.common.BaseNode;
+import org.drools.common.DefaultFactHandle;
+import org.drools.common.InternalWorkingMemory;
+import org.drools.spi.PropagationContext;
+
+/**
+ * A source of <code>FactHandle</code>s for an <code>ObjectSink</code>.
+ * 
+ * <p>
+ * Nodes that propagate <code>FactHandleImpl</code> extend this class.
+ * </p>
+ * 
+ * @see RightTupleSource
+ * @see DefaultFactHandle
+ * 
+ * @author <a href="mailto:mark.proctor at jboss.com">Mark Proctor</a>
+ * @author <a href="mailto:bob at werken.com">Bob McWhirter</a>
+ */
+public abstract class RightTupleSource extends BaseNode
+    implements
+    Serializable {
+    // ------------------------------------------------------------
+    // Instance members
+    // ------------------------------------------------------------
+
+    /** The destination for <code>FactHandleImpl</code>. */
+    protected RightTupletSinkPropagator sink;
+
+    protected RightTupleSource         objectSource;
+
+    private int                    alphaNodeHashingThreshold;
+
+    // ------------------------------------------------------------
+    // Constructors
+    // ------------------------------------------------------------
+
+    /**
+     * Single parameter constructor that specifies the unique id of the node.
+     * 
+     * @param id
+     */
+    RightTupleSource(final int id) {
+        this( id,
+              null,
+              3 );
+    }
+
+    /**
+     * Single parameter constructor that specifies the unique id of the node.
+     * 
+     * @param id
+     */
+    RightTupleSource(final int id,
+                 final RightTupleSource objectSource,
+                 final int alphaNodeHashingThreshold) {
+        super( id );
+        this.objectSource = objectSource;
+        this.alphaNodeHashingThreshold = alphaNodeHashingThreshold;
+        this.sink = EmptyRightTupleSinkAdapter.getInstance();
+    }
+
+    // ------------------------------------------------------------
+    // Instance methods
+    // ------------------------------------------------------------
+
+    /**
+     * Adds the <code>ObjectSink</code> so that it may receive
+     * <code>FactHandleImpl</code> propagated from this
+     * <code>ObjectSource</code>.
+     * 
+     * @param objectSink
+     *            The <code>ObjectSink</code> to receive propagated
+     *            <code>FactHandleImpl</code>.
+     */
+    protected void addObjectSink(final RightTupleSink objectSink) {
+        if ( this.sink == EmptyRightTupleSinkAdapter.getInstance() ) {
+            this.sink = new SingleRightTupletSinkAdapter( objectSink );
+        } else if ( this.sink instanceof SingleRightTupletSinkAdapter ) {
+            final CompositeRightTupleSinkAdapter sinkAdapter = new CompositeRightTupleSinkAdapter( this.alphaNodeHashingThreshold );
+            sinkAdapter.addObjectSink( this.sink.getSinks()[0] );
+            sinkAdapter.addObjectSink( objectSink );
+            this.sink = sinkAdapter;
+        } else {
+            ((CompositeRightTupleSinkAdapter) this.sink).addObjectSink( objectSink );
+        }
+    }
+
+    /**
+     * Removes the <code>ObjectSink</code>
+     * 
+     * @param objectSink
+     *            The <code>ObjectSink</code> to remove
+     */
+    protected void removeObjectSink(final RightTupleSink objectSink) {
+        if ( this.sink == EmptyRightTupleSinkAdapter.getInstance() ) {
+            throw new IllegalArgumentException( "Cannot remove a sink, when the list of sinks is null" );
+        }
+
+        if ( this.sink instanceof SingleRightTupletSinkAdapter ) {
+            this.sink = EmptyRightTupleSinkAdapter.getInstance();
+        } else {
+            final CompositeRightTupleSinkAdapter sinkAdapter = (CompositeRightTupleSinkAdapter) this.sink;
+            sinkAdapter.removeObjectSink( objectSink );
+            if ( sinkAdapter.size() == 1 ) {
+                this.sink = new SingleRightTupletSinkAdapter( sinkAdapter.getSinks()[0] );
+            }
+        }
+    }
+
+    public abstract void updateSink(RightTupleSink sink,
+                                    PropagationContext context,
+                                    InternalWorkingMemory workingMemory);
+
+    public RightTupletSinkPropagator getSinkPropagator() {
+        return this.sink;
+    }
+}

Copied: labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/RightTupletSinkPropagator.java (from rev 17522, labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/ObjectSinkPropagator.java)
===================================================================
--- labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/RightTupletSinkPropagator.java	                        (rev 0)
+++ labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/RightTupletSinkPropagator.java	2008-01-04 01:54:45 UTC (rev 17533)
@@ -0,0 +1,23 @@
+package org.drools.reteoo;
+
+import java.io.Serializable;
+
+import org.drools.common.InternalWorkingMemory;
+import org.drools.spi.PropagationContext;
+
+public interface RightTupletSinkPropagator
+    extends
+    Serializable {
+    public void propagateAssertRightTuple(RightTuple rightTuple,
+                                          PropagationContext context,
+                                          InternalWorkingMemory workingMemory);
+
+    public void propagateRetractRightTuple(RightTuple rightTuple,
+                                           PropagationContext context,
+                                           InternalWorkingMemory workingMemory,
+                                           boolean useHash);
+
+    public RightTupleSink[] getSinks();
+
+    public int size();
+}

Modified: labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/RuleTerminalNode.java
===================================================================
--- labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/RuleTerminalNode.java	2008-01-04 00:57:26 UTC (rev 17532)
+++ labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/RuleTerminalNode.java	2008-01-04 01:54:45 UTC (rev 17533)
@@ -55,7 +55,7 @@
  */
 public final class RuleTerminalNode extends BaseNode
     implements
-    TupleSinkNode,
+    LeftTupleSinkNode,
     NodeMemory,
     TerminalNode {
     // ------------------------------------------------------------
@@ -75,10 +75,10 @@
      * because declarations may have different offsets in each subrule
      */
     private final GroupElement subrule;
-    private final TupleSource  tupleSource;
+    private final LeftTupleSource  tupleSource;
 
-    private TupleSinkNode      previousTupleSinkNode;
-    private TupleSinkNode      nextTupleSinkNode;
+    private LeftTupleSinkNode      previousLeftTupleSinkNode;
+    private LeftTupleSinkNode      nextTupleSinkNode;
 
     protected boolean          tupleMemoryEnabled;
 
@@ -95,7 +95,7 @@
      *            The rule.
      */
     public RuleTerminalNode(final int id,
-                            final TupleSource source,
+                            final LeftTupleSource source,
                             final Rule rule,
                             final GroupElement subrule,
                             final BuildContext buildContext) {
@@ -131,7 +131,7 @@
     // org.drools.impl.TupleSink
     // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 
-    public void assertTuple(final ReteTuple tuple,
+    public void assertTuple(final LeftTuple tuple,
                             final PropagationContext context,
                             final InternalWorkingMemory workingMemory) {
         assertTuple( tuple,
@@ -151,7 +151,7 @@
      * @throws AssertionException
      *             If an error occurs while asserting.
      */
-    public void assertTuple(final ReteTuple tuple,
+    public void assertTuple(final LeftTuple tuple,
                             final PropagationContext context,
                             final InternalWorkingMemory workingMemory,
                             final boolean fireActivationCreated) {
@@ -171,7 +171,7 @@
         }
 
         //we only have to clone the head fact to make sure the graph is not affected during consequence reads after a modify
-        final ReteTuple cloned = new ReteTuple( tuple );
+        final LeftTuple cloned = new LeftTuple( tuple );
 
         final InternalAgenda agenda = (InternalAgenda) workingMemory.getAgenda();
 
@@ -354,11 +354,11 @@
         }
     }
 
-    public void retractTuple(final ReteTuple leftTuple,
+    public void retractTuple(final LeftTuple leftTuple,
                              final PropagationContext context,
                              final InternalWorkingMemory workingMemory) {
         final TerminalNodeMemory memory = (TerminalNodeMemory) workingMemory.getNodeMemory( this );
-        final ReteTuple tuple = memory.getTupleMemory().remove( leftTuple );
+        final LeftTuple tuple = memory.getTupleMemory().remove( leftTuple );
         if ( tuple == null ) {
             // tuple should only be null if it was asserted and reached a no-loop causing it to exit early
             // before being added to the node memory and an activation created and attached
@@ -439,7 +439,7 @@
 
             final TerminalNodeMemory memory = (TerminalNodeMemory) workingMemory.getNodeMemory( this );
             final Iterator it = memory.getTupleMemory().iterator();
-            for ( ReteTuple tuple = (ReteTuple) it.next(); tuple != null; tuple = (ReteTuple) it.next() ) {
+            for ( LeftTuple tuple = (LeftTuple) it.next(); tuple != null; tuple = (LeftTuple) it.next() ) {
                 final Activation activation = tuple.getActivation();
 
                 if ( activation.isActivated() ) {
@@ -484,7 +484,7 @@
      * @return
      *      The next TupleSinkNode
      */
-    public TupleSinkNode getNextTupleSinkNode() {
+    public LeftTupleSinkNode getNextLeftTupleSinkNode() {
         return this.nextTupleSinkNode;
     }
 
@@ -493,7 +493,7 @@
      * @param next
      *      The next TupleSinkNode
      */
-    public void setNextTupleSinkNode(final TupleSinkNode next) {
+    public void setNextLeftTupleSinkNode(final LeftTupleSinkNode next) {
         this.nextTupleSinkNode = next;
     }
 
@@ -502,8 +502,8 @@
      * @return
      *      The previous TupleSinkNode
      */
-    public TupleSinkNode getPreviousTupleSinkNode() {
-        return this.previousTupleSinkNode;
+    public LeftTupleSinkNode getPreviousLeftTupleSinkNode() {
+        return this.previousLeftTupleSinkNode;
     }
 
     /**
@@ -511,8 +511,8 @@
      * @param previous
      *      The previous TupleSinkNode
      */
-    public void setPreviousTupleSinkNode(final TupleSinkNode previous) {
-        this.previousTupleSinkNode = previous;
+    public void setPreviousLeftTupleSinkNode(final LeftTupleSinkNode previous) {
+        this.previousLeftTupleSinkNode = previous;
     }
 
     public int hashCode() {

Copied: labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/SingleLeftTupleSinkAdapter.java (from rev 17522, labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/SingleTupleSinkAdapter.java)
===================================================================
--- labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/SingleLeftTupleSinkAdapter.java	                        (rev 0)
+++ labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/SingleLeftTupleSinkAdapter.java	2008-01-04 01:54:45 UTC (rev 17533)
@@ -0,0 +1,74 @@
+package org.drools.reteoo;
+
+import org.drools.common.InternalWorkingMemory;
+import org.drools.spi.PropagationContext;
+
+public class SingleLeftTupleSinkAdapter
+    implements
+    LeftTupleSinkPropagator {
+    private LeftTupleSink sink;
+
+    public SingleLeftTupleSinkAdapter(final LeftTupleSink sink) {
+        this.sink = sink;
+    }
+
+    public void propagateAssertTuple(final LeftTuple leftTuple,
+                                     final RightTuple rightTuple,
+                                     final PropagationContext context,
+                                     final InternalWorkingMemory workingMemory) {
+        this.sink.assertTuple( new LeftTuple( leftTuple,
+                                              rightTuple ),
+                               context,
+                               workingMemory );
+    }
+
+    public void propagateAssertTuple(final LeftTuple tuple,
+                                     final PropagationContext context,
+                                     final InternalWorkingMemory workingMemory) {
+        this.sink.assertTuple( new LeftTuple( tuple ),
+                               context,
+                               workingMemory );
+    }
+
+    public void propagateRetractTuple(final LeftTuple leftTuple,
+                                      final RightTuple rightTuple,
+                                      final PropagationContext context,
+                                      final InternalWorkingMemory workingMemory) {
+        this.sink.retractTuple( new LeftTuple( leftTuple,
+                                               rightTuple ),
+                                context,
+                                workingMemory );
+    }
+
+    public void propagateRetractTuple(final LeftTuple tuple,
+                                      final PropagationContext context,
+                                      final InternalWorkingMemory workingMemory) {
+        this.sink.retractTuple( new LeftTuple( tuple ),
+                                context,
+                                workingMemory );
+    }
+
+    public void createAndPropagateAssertTuple(final RightTuple rightTuple,
+                                              final PropagationContext context,
+                                              final InternalWorkingMemory workingMemory) {
+        this.sink.assertTuple( new LeftTuple( rightTuple ),
+                               context,
+                               workingMemory );
+    }
+
+    public void createAndPropagateRetractTuple(final RightTuple rightTuple,
+                                               final PropagationContext context,
+                                               final InternalWorkingMemory workingMemory) {
+        this.sink.retractTuple( new LeftTuple( rightTuple ),
+                                context,
+                                workingMemory );
+    }
+
+    public LeftTupleSink[] getSinks() {
+        return new LeftTupleSink[]{this.sink};
+    }
+
+    public int size() {
+        return (this.sink != null) ? 1 : 0;
+    }
+}

Deleted: labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/SingleObjectSinkAdapter.java
===================================================================
--- labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/SingleObjectSinkAdapter.java	2008-01-04 00:57:26 UTC (rev 17532)
+++ labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/SingleObjectSinkAdapter.java	2008-01-04 01:54:45 UTC (rev 17533)
@@ -1,46 +0,0 @@
-package org.drools.reteoo;
-
-import org.drools.common.InternalFactHandle;
-import org.drools.common.InternalWorkingMemory;
-import org.drools.spi.PropagationContext;
-
-public class SingleObjectSinkAdapter
-    implements
-    ObjectSinkPropagator {
-
-    private static final long serialVersionUID = 873985743021L;
-    
-    private ObjectSink sink;
-
-    public SingleObjectSinkAdapter(final ObjectSink sink) {
-        this.sink = sink;
-    }
-
-    public void propagateAssertObject(final InternalFactHandle handle,
-                                      final PropagationContext context,
-                                      final InternalWorkingMemory workingMemory) {
-        this.sink.assertObject( handle,
-                                context,
-                                workingMemory );
-
-    }
-
-    public void propagateRetractObject(final InternalFactHandle handle,
-                                       final PropagationContext context,
-                                       final InternalWorkingMemory workingMemory,
-                                       final boolean useHash) {
-        this.sink.retractObject( handle,
-                                 context,
-                                 workingMemory );
-
-    }
-
-    public ObjectSink[] getSinks() {
-        return new ObjectSink[]{this.sink};
-    }
-    
-    public int size() {
-        return 1;
-    }
-
-}

Copied: labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/SingleRightTupletSinkAdapter.java (from rev 17522, labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/SingleObjectSinkAdapter.java)
===================================================================
--- labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/SingleRightTupletSinkAdapter.java	                        (rev 0)
+++ labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/SingleRightTupletSinkAdapter.java	2008-01-04 01:54:45 UTC (rev 17533)
@@ -0,0 +1,45 @@
+package org.drools.reteoo;
+
+import org.drools.common.InternalWorkingMemory;
+import org.drools.spi.PropagationContext;
+
+public class SingleRightTupletSinkAdapter
+    implements
+    RightTupletSinkPropagator {
+
+    private static final long serialVersionUID = 873985743021L;
+
+    private RightTupleSink    sink;
+
+    public SingleRightTupletSinkAdapter(final RightTupleSink sink) {
+        this.sink = sink;
+    }
+
+    public void propagateAssertRightTuple(final RightTuple rightTuple,
+                                          final PropagationContext context,
+                                          final InternalWorkingMemory workingMemory) {
+        this.sink.assertRightTuple( new RightTuple( rightTuple ),
+                                    context,
+                                    workingMemory );
+
+    }
+
+    public void propagateRetractRightTuple(final RightTuple rightTuple,
+                                           final PropagationContext context,
+                                           final InternalWorkingMemory workingMemory,
+                                           final boolean useHash) {
+        this.sink.retractRightTuple( new RightTuple( rightTuple ),
+                                     context,
+                                     workingMemory );
+
+    }
+
+    public RightTupleSink[] getSinks() {
+        return new RightTupleSink[]{this.sink};
+    }
+
+    public int size() {
+        return 1;
+    }
+
+}

Deleted: labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/SingleTupleSinkAdapter.java
===================================================================
--- labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/SingleTupleSinkAdapter.java	2008-01-04 00:57:26 UTC (rev 17532)
+++ labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/SingleTupleSinkAdapter.java	2008-01-04 01:54:45 UTC (rev 17533)
@@ -1,75 +0,0 @@
-package org.drools.reteoo;
-
-import org.drools.common.InternalFactHandle;
-import org.drools.common.InternalWorkingMemory;
-import org.drools.spi.PropagationContext;
-
-public class SingleTupleSinkAdapter
-    implements
-    TupleSinkPropagator {
-    private TupleSink sink;
-
-    public SingleTupleSinkAdapter(final TupleSink sink) {
-        this.sink = sink;
-    }
-
-    public void propagateAssertTuple(final ReteTuple tuple,
-                                     final InternalFactHandle handle,
-                                     final PropagationContext context,
-                                     final InternalWorkingMemory workingMemory) {
-        this.sink.assertTuple( new ReteTuple( tuple,
-                                              handle ),
-                               context,
-                               workingMemory );
-    }
-
-    public void propagateAssertTuple(final ReteTuple tuple,
-                                     final PropagationContext context,
-                                     final InternalWorkingMemory workingMemory) {
-        this.sink.assertTuple( new ReteTuple( tuple ),
-                               context,
-                               workingMemory );
-    }
-
-    public void propagateRetractTuple(final ReteTuple tuple,
-                                      final InternalFactHandle handle,
-                                      final PropagationContext context,
-                                      final InternalWorkingMemory workingMemory) {
-        this.sink.retractTuple( new ReteTuple( tuple,
-                                               handle ),
-                                context,
-                                workingMemory );
-    }
-
-    public void propagateRetractTuple(final ReteTuple tuple,
-                                      final PropagationContext context,
-                                      final InternalWorkingMemory workingMemory) {
-        this.sink.retractTuple( new ReteTuple( tuple ),
-                                context,
-                                workingMemory );
-    }
-
-    public void createAndPropagateAssertTuple(final InternalFactHandle handle,
-                                              final PropagationContext context,
-                                              final InternalWorkingMemory workingMemory) {
-        this.sink.assertTuple( new ReteTuple( handle ),
-                               context,
-                               workingMemory );
-    }
-
-    public void createAndPropagateRetractTuple(final InternalFactHandle handle,
-                                               final PropagationContext context,
-                                               final InternalWorkingMemory workingMemory) {
-        this.sink.retractTuple( new ReteTuple( handle ),
-                                context,
-                                workingMemory );
-    }
-
-    public TupleSink[] getSinks() {
-        return new TupleSink[]{this.sink};
-    }
-
-    public int size() {
-        return (this.sink != null) ? 1 : 0;
-    }
-}

Deleted: labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/TupleMemory.java
===================================================================
--- labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/TupleMemory.java	2008-01-04 00:57:26 UTC (rev 17532)
+++ labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/TupleMemory.java	2008-01-04 01:54:45 UTC (rev 17533)
@@ -1,26 +0,0 @@
-package org.drools.reteoo;
-
-import org.drools.common.InternalFactHandle;
-import org.drools.util.Entry;
-import org.drools.util.Iterator;
-
-public interface TupleMemory {
-    public Iterator iterator();
-
-    public Iterator iterator(InternalFactHandle handle);
-
-    public void add(ReteTuple tuple);
-
-    public ReteTuple remove(ReteTuple tuple);
-
-    public boolean contains(ReteTuple tuple);
-
-    public boolean isIndexed();
-
-    public int size();
-
-    public Entry[] getTable();
-    
-    public Entry[] toArray();
-
-}

Deleted: labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/TupleSink.java
===================================================================
--- labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/TupleSink.java	2008-01-04 00:57:26 UTC (rev 17532)
+++ labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/TupleSink.java	2008-01-04 01:54:45 UTC (rev 17533)
@@ -1,59 +0,0 @@
-package org.drools.reteoo;
-
-/*
- * Copyright 2005 JBoss Inc
- * 
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * 
- *      http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import java.io.Serializable;
-
-import org.drools.common.InternalWorkingMemory;
-import org.drools.spi.PropagationContext;
-
-/**
- * Receiver of propagated <code>ReteTuple</code>s from a
- * <code>TupleSource</code>.
- * 
- * @see TupleSource
- * 
- * @author <a href="mailto:mark.proctor at jboss.com">Mark Proctor</a>
- * @author <a href="mailto:bob at werken.com">Bob McWhirter</a>
- */
-public interface TupleSink
-    extends
-    Serializable,
-    Sink {
-
-    /**
-     * Assert a new <code>ReteTuple</code>.
-     * 
-     * @param tuple
-     *            The <code>ReteTuple</code> to propagate.
-     * @param context
-     *             The <code>PropagationContext</code> of the <code>WorkingMemory<code> action            
-     * @param workingMemory
-     *            the <code>WorkingMemory</code> session.
-     */
-    void assertTuple(ReteTuple tuple,
-                     PropagationContext context,
-                     InternalWorkingMemory workingMemory);
-
-    void retractTuple(ReteTuple tuple,
-                      PropagationContext context,
-                      InternalWorkingMemory workingMemory);
-    
-    public boolean isTupleMemoryEnabled();
-
-    public void setTupleMemoryEnabled(boolean tupleMemoryEnabled);       
-}

Deleted: labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/TupleSinkNode.java
===================================================================
--- labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/TupleSinkNode.java	2008-01-04 00:57:26 UTC (rev 17532)
+++ labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/TupleSinkNode.java	2008-01-04 01:54:45 UTC (rev 17533)
@@ -1,59 +0,0 @@
-package org.drools.reteoo;
-
-/*
- * Copyright 2005 JBoss Inc
- * 
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * 
- *      http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * Items placed in a <code>LinkedList<code> must implement this interface .
- * 
- * @see TupleSinkNodeList
- * 
- * @author <a href="mailto:mark.proctor at jboss.com">Mark Proctor</a>
- * @author <a href="mailto:bob at werken.com">Bob McWhirter</a>
- */
-public interface TupleSinkNode
-    extends
-    TupleSink {
-
-    /**
-     * Returns the next node
-     * @return
-     *      The next LinkedListNode
-     */
-    public TupleSinkNode getNextTupleSinkNode();
-
-    /**
-     * Sets the next node 
-     * @param next
-     *      The next LinkedListNode
-     */
-    public void setNextTupleSinkNode(TupleSinkNode next);
-
-    /**
-     * Returns the previous node
-     * @return
-     *      The previous LinkedListNode
-     */
-    public TupleSinkNode getPreviousTupleSinkNode();
-
-    /**
-     * Sets the previous node 
-     * @param previous
-     *      The previous LinkedListNode
-     */
-    public void setPreviousTupleSinkNode(TupleSinkNode previous);
-
-}

Deleted: labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/TupleSinkNodeList.java
===================================================================
--- labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/TupleSinkNodeList.java	2008-01-04 00:57:26 UTC (rev 17532)
+++ labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/TupleSinkNodeList.java	2008-01-04 01:54:45 UTC (rev 17533)
@@ -1,229 +0,0 @@
-package org.drools.reteoo;
-
-import java.io.Serializable;
-import java.util.Iterator;
-import java.util.NoSuchElementException;
-
-/*
- * Copyright 2005 JBoss Inc
- * 
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * 
- *      http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * This is a simple linked linked implementation. Each node must implement </code>LinkedListNode<code> so that it references
- * the node before and after it. This way a node can be removed without having to scan the list to find it. This class
- * does not provide an Iterator implementation as its designed for efficiency and not genericity. There are a number of 
- * ways to iterate the list.
- * <p>
- * Simple iterator:
- * <pre>
- * for ( LinkedListNode node = list.getFirst(); node != null; node =  node.getNext() ) {
- * }
- * </pre>
- * 
- * Iterator that pops the first entry:
- * <pre>
- * for ( LinkedListNode node = list.removeFirst(); node != null; node = list.removeFirst() ) {
- * }
- * </pre>
- *
- *
- * @author <a href="mailto:mark.proctor at jboss.com">Mark Proctor</a>
- * @author <a href="mailto:bob at werken.com">Bob McWhirter</a>
- *
- */
-public class TupleSinkNodeList
-    implements
-    Serializable {
-    private static final long serialVersionUID = 400L;
-
-    private TupleSinkNode     firstNode;
-    private TupleSinkNode     lastNode;
-
-    private int               size;
-
-    /**
-     * Construct an empty <code>LinkedList</code>
-     */
-    public TupleSinkNodeList() {
-
-    }
-
-    /**
-     * Add a <code>TupleSinkNode</code> to the list. If the <code>LinkedList</code> is empty then the first and 
-     * last nodes are set to the added node.
-     * 
-     * @param node
-     *      The <code>TupleSinkNode</code> to be added
-     */
-    public void add(final TupleSinkNode node) {
-        if ( this.firstNode == null ) {
-            this.firstNode = node;
-            this.lastNode = node;;
-        } else {
-            this.lastNode.setNextTupleSinkNode( node );
-            node.setPreviousTupleSinkNode( this.lastNode );
-            this.lastNode = node;
-        }
-        this.size++;
-    }
-
-    /**
-     * Removes a <code>TupleSinkNode</code> from the list. This works by attach the previous reference to the child reference.
-     * When the node to be removed is the first node it calls <code>removeFirst()</code>. When the node to be removed is the last node
-     * it calls <code>removeLast()</code>.
-     * 
-     * @param node
-     *      The <code>TupleSinkNode</code> to be removed.
-     */
-    public void remove(final TupleSinkNode node) {
-        if ( (this.firstNode != node) && (this.lastNode != node) ) {
-            node.getPreviousTupleSinkNode().setNextTupleSinkNode( node.getNextTupleSinkNode() );
-            node.getNextTupleSinkNode().setPreviousTupleSinkNode( node.getPreviousTupleSinkNode() );
-            this.size--;
-            node.setPreviousTupleSinkNode( null );
-            node.setNextTupleSinkNode( null );
-
-        } else {
-            if ( this.firstNode == node ) {
-                removeFirst();
-            } else if ( this.lastNode == node ) {
-                removeLast();
-            }
-        }
-    }
-
-    /**
-     * Return the first node in the list
-     * @return
-     *      The first <code>TupleSinkNode</code>.
-     */
-    public final TupleSinkNode getFirst() {
-        return this.firstNode;
-    }
-
-    /**
-     * Return the last node in the list
-     * @return
-     *      The last <code>TupleSinkNode</code>.
-     */
-    public final TupleSinkNode getLast() {
-        return this.lastNode;
-    }
-
-    /**
-     * Remove the first node from the list. The next node then becomes the first node. If this is the last 
-     * node then both first and last node references are set to null.
-     * 
-     * @return
-     *      The first <code>TupleSinkNode</code>.
-     */
-    public TupleSinkNode removeFirst() {
-        if ( this.firstNode == null ) {
-            return null;
-        }
-        final TupleSinkNode node = this.firstNode;
-        this.firstNode = node.getNextTupleSinkNode();
-        node.setNextTupleSinkNode( null );
-        if ( this.firstNode != null ) {
-            this.firstNode.setPreviousTupleSinkNode( null );
-        } else {
-            this.lastNode = null;
-        }
-        this.size--;
-        return node;
-    }
-
-    /**
-     * Remove the last node from the list. The previous node then becomes the last node. If this is the last 
-     * node then both first and last node references are set to null.
-     * 
-     * @return
-     *      The first <code>TupleSinkNode</code>.
-     */
-    public TupleSinkNode removeLast() {
-        if ( this.lastNode == null ) {
-            return null;
-        }
-        final TupleSinkNode node = this.lastNode;
-        this.lastNode = node.getPreviousTupleSinkNode();
-        node.setPreviousTupleSinkNode( null );
-        if ( this.lastNode != null ) {
-            this.lastNode.setNextTupleSinkNode( null );
-        } else {
-            this.firstNode = this.lastNode;
-        }
-        this.size--;
-        return node;
-    }
-
-    /**
-     * @return
-     *      boolean value indicating the empty status of the list
-     */
-    public final boolean isEmpty() {
-        return (this.firstNode == null);
-    }
-
-    /**
-     * Iterates the list removing all the nodes until there are no more nodes to remove. 
-     */
-    public void clear() {
-        while ( removeFirst() != null ) {
-        }
-    }
-
-    /**
-     * @return
-     *     return size of the list as an int
-     */
-    public final int size() {
-        return this.size;
-    }
-
-    /**
-     * Returns a list iterator
-     * @return
-     */
-    public Iterator iterator() {
-        return new Iterator() {
-            private TupleSinkNode currentNode = null;
-            private TupleSinkNode nextNode    = getFirst();
-
-            public boolean hasNext() {
-                return (this.nextNode != null);
-            }
-
-            public Object next() {
-                this.currentNode = this.nextNode;
-                if ( this.currentNode != null ) {
-                    this.nextNode = this.currentNode.getNextTupleSinkNode();
-                } else {
-                    throw new NoSuchElementException( "No more elements to return" );
-                }
-                return this.currentNode;
-            }
-
-            public void remove() {
-                if ( this.currentNode != null ) {
-                    TupleSinkNodeList.this.remove( this.currentNode );
-                    this.currentNode = null;
-                } else {
-                    throw new IllegalStateException( "No item to remove. Call next() before calling remove()." );
-                }
-            }
-        };
-    }
-
-}

Deleted: labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/TupleSinkPropagator.java
===================================================================
--- labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/TupleSinkPropagator.java	2008-01-04 00:57:26 UTC (rev 17532)
+++ labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/TupleSinkPropagator.java	2008-01-04 01:54:45 UTC (rev 17533)
@@ -1,59 +0,0 @@
-package org.drools.reteoo;
-
-import java.io.Serializable;
-
-import org.drools.common.InternalFactHandle;
-import org.drools.common.InternalWorkingMemory;
-import org.drools.spi.PropagationContext;
-
-public interface TupleSinkPropagator
-    extends
-    Serializable {
-    public void propagateAssertTuple(ReteTuple tuple,
-                                     InternalFactHandle handle,
-                                     PropagationContext context,
-                                     InternalWorkingMemory workingMemory);
-
-    public void propagateAssertTuple(ReteTuple tuple,
-                                     PropagationContext context,
-                                     InternalWorkingMemory workingMemory);
-
-    public void propagateRetractTuple(ReteTuple tuple,
-                                      InternalFactHandle handle,
-                                      PropagationContext context,
-                                      InternalWorkingMemory workingMemory);
-
-    public void propagateRetractTuple(ReteTuple tuple,
-                                      PropagationContext context,
-                                      InternalWorkingMemory workingMemory);
-
-    public void createAndPropagateAssertTuple(InternalFactHandle handle,
-                                              PropagationContext context,
-                                              InternalWorkingMemory workingMemory);
-
-    public void createAndPropagateRetractTuple(InternalFactHandle handle,
-                                               PropagationContext context,
-                                               InternalWorkingMemory workingMemory);
-
-    public TupleSink[] getSinks();
-
-    //    public void propagateNewTupleSink(TupleMatch tupleMatch,
-    //                                      PropagationContext context,
-    //                                      InternalWorkingMemory workingMemory);
-    //
-    //    public void propagateNewTupleSink(InternalFactHandle handle,
-    //                                      LinkedList list,
-    //                                      PropagationContext context,
-    //                                      InternalWorkingMemory workingMemory);
-    //
-    //    public void propagateNewTupleSink(ReteTuple tuple,
-    //                                      PropagationContext context,
-    //                                      InternalWorkingMemory workingMemory);
-    //
-    //    public List getPropagatedTuples(final Map memory,
-    //                                    final InternalWorkingMemory workingMemory,
-    //                                    final TupleSink sink);
-
-    public int size();
-
-}

Deleted: labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/TupleSource.java
===================================================================
--- labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/TupleSource.java	2008-01-04 00:57:26 UTC (rev 17532)
+++ labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/TupleSource.java	2008-01-04 01:54:45 UTC (rev 17533)
@@ -1,116 +0,0 @@
-package org.drools.reteoo;
-
-/*
- * Copyright 2005 JBoss Inc
- * 
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * 
- *      http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import java.io.Serializable;
-
-import org.drools.common.BaseNode;
-import org.drools.common.InternalWorkingMemory;
-import org.drools.spi.PropagationContext;
-
-/**
- * A source of <code>ReteTuple</code> s for a <code>TupleSink</code>.
- * 
- * <p>
- * Nodes that propagate <code>Tuples</code> extend this class.
- * </p>
- * 
- * @see TupleSource
- * @see ReteTuple
- * 
- * @author <a href="mailto:mark.proctor at jboss.com">Mark Proctor</a>
- * @author <a href="mailto:bob at werken.com">Bob McWhirter</a>
- */
-public abstract class TupleSource extends BaseNode
-    implements
-    Serializable {
-    // ------------------------------------------------------------
-    // Instance members
-    // ------------------------------------------------------------
-
-    /** The destination for <code>Tuples</code>. */
-    protected TupleSinkPropagator sink;
-
-    // ------------------------------------------------------------
-    // Constructors
-    // ------------------------------------------------------------
-
-    /**
-     * Single parameter constructor that specifies the unique id of the node.
-     * 
-     * @param id
-     */
-    TupleSource(final int id) {
-        super( id );
-        this.sink = EmptyTupleSinkAdapter.getInstance();
-    }
-
-    // ------------------------------------------------------------
-    // Instance methods
-    // ------------------------------------------------------------
-
-    /**
-     * Adds the <code>TupleSink</code> so that it may receive
-     * <code>Tuples</code> propagated from this <code>TupleSource</code>.
-     * 
-     * @param tupleSink
-     *            The <code>TupleSink</code> to receive propagated
-     *            <code>Tuples</code>.
-     */
-    protected void addTupleSink(final TupleSink tupleSink) {
-        if ( this.sink == EmptyTupleSinkAdapter.getInstance() ) {
-            this.sink = new SingleTupleSinkAdapter( tupleSink );
-        } else if ( this.sink instanceof SingleTupleSinkAdapter ) {
-            final CompositeTupleSinkAdapter sinkAdapter = new CompositeTupleSinkAdapter();
-            sinkAdapter.addTupleSink( this.sink.getSinks()[0] );
-            sinkAdapter.addTupleSink( tupleSink );
-            this.sink = sinkAdapter;
-        } else {
-            ((CompositeTupleSinkAdapter) this.sink).addTupleSink( tupleSink );
-        }
-    }
-
-    /**
-     * Removes the <code>TupleSink</code>
-     * 
-     * @param tupleSink
-     *            The <code>TupleSink</code> to remove
-     */
-    protected void removeTupleSink(final TupleSink tupleSink) {
-        if ( this.sink == EmptyTupleSinkAdapter.getInstance() ) {
-            throw new IllegalArgumentException( "Cannot remove a sink, when the list of sinks is null" );
-        }
-
-        if ( this.sink instanceof SingleTupleSinkAdapter ) {
-            this.sink = EmptyTupleSinkAdapter.getInstance();
-        } else {
-            final CompositeTupleSinkAdapter sinkAdapter = (CompositeTupleSinkAdapter) this.sink;
-            sinkAdapter.removeTupleSink( tupleSink );
-            if ( sinkAdapter.size() == 1 ) {
-                this.sink = new SingleTupleSinkAdapter( sinkAdapter.getSinks()[0] );
-            }
-        }
-    }
-
-    public TupleSinkPropagator getSinkPropagator() {
-        return this.sink;
-    }
-
-    public abstract void updateSink(TupleSink sink,
-                                    PropagationContext context,
-                                    InternalWorkingMemory workingMemory);    
-}

Modified: labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/builder/AccumulateBuilder.java
===================================================================
--- labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/builder/AccumulateBuilder.java	2008-01-04 00:57:26 UTC (rev 17532)
+++ labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/builder/AccumulateBuilder.java	2008-01-04 01:54:45 UTC (rev 17533)
@@ -22,9 +22,9 @@
 import org.drools.common.BetaConstraints;
 import org.drools.common.TupleStartEqualsConstraint;
 import org.drools.reteoo.AccumulateNode;
-import org.drools.reteoo.ObjectSource;
+import org.drools.reteoo.RightTupleSource;
 import org.drools.reteoo.RightInputAdapterNode;
-import org.drools.reteoo.TupleSource;
+import org.drools.reteoo.LeftTupleSource;
 import org.drools.rule.Accumulate;
 import org.drools.rule.RuleConditionElement;
 import org.drools.spi.AlphaNodeFieldConstraint;
@@ -55,7 +55,7 @@
         final ReteooComponentBuilder builder = utils.getBuilderFor( source );
 
         // save tuple source and current pattern offset for later if needed
-        final TupleSource tupleSource = context.getTupleSource();
+        final LeftTupleSource tupleSource = context.getTupleSource();
         final int currentPatternIndex = context.getCurrentPatternOffset();
         
         // builds the source pattern
@@ -67,7 +67,7 @@
         if ( context.getObjectSource() == null ) {
 
             // attach right input adapter node to convert tuple source into an object source
-            context.setObjectSource( (ObjectSource) utils.attachNode( context,
+            context.setObjectSource( (RightTupleSource) utils.attachNode( context,
                                                                       new RightInputAdapterNode( context.getNextId(),
                                                                                                  context.getTupleSource(),
                                                                                                  context ) ) );
@@ -90,7 +90,7 @@
                                                                              context.getBetaconstraints(),
                                                                              false );
 
-        context.setTupleSource( (TupleSource) utils.attachNode( context,
+        context.setTupleSource( (LeftTupleSource) utils.attachNode( context,
                                                                 new AccumulateNode( context.getNextId(),
                                                                                     context.getTupleSource(),
                                                                                     context.getObjectSource(),

Modified: labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/builder/BuildContext.java
===================================================================
--- labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/builder/BuildContext.java	2008-01-04 00:57:26 UTC (rev 17532)
+++ labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/builder/BuildContext.java	2008-01-04 01:54:45 UTC (rev 17533)
@@ -25,10 +25,10 @@
 import org.drools.common.BetaConstraints;
 import org.drools.common.InternalRuleBase;
 import org.drools.common.InternalWorkingMemory;
-import org.drools.reteoo.ObjectSource;
+import org.drools.reteoo.RightTupleSource;
 import org.drools.reteoo.ReteooBuilder;
 import org.drools.reteoo.ReteooRuleBase;
-import org.drools.reteoo.TupleSource;
+import org.drools.reteoo.LeftTupleSource;
 import org.drools.rule.EntryPoint;
 import org.drools.rule.RuleConditionElement;
 
@@ -40,10 +40,10 @@
 public class BuildContext {
 
     // tuple source to attach next node to
-    private TupleSource               tupleSource;
+    private LeftTupleSource               tupleSource;
 
     // object source to attach next node to
-    private ObjectSource              objectSource;
+    private RightTupleSource              objectSource;
 
     // object type cache to check for cross products
     private LinkedList                objectType;
@@ -131,14 +131,14 @@
     /**
      * @return the objectSource
      */
-    public ObjectSource getObjectSource() {
+    public RightTupleSource getObjectSource() {
         return this.objectSource;
     }
 
     /**
      * @param objectSource the objectSource to set
      */
-    public void setObjectSource(final ObjectSource objectSource) {
+    public void setObjectSource(final RightTupleSource objectSource) {
         this.objectSource = objectSource;
     }
 
@@ -165,14 +165,14 @@
     /**
      * @return the tupleSource
      */
-    public TupleSource getTupleSource() {
+    public LeftTupleSource getTupleSource() {
         return this.tupleSource;
     }
 
     /**
      * @param tupleSource the tupleSource to set
      */
-    public void setTupleSource(final TupleSource tupleSource) {
+    public void setTupleSource(final LeftTupleSource tupleSource) {
         this.tupleSource = tupleSource;
     }
 

Modified: labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/builder/BuildUtils.java
===================================================================
--- labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/builder/BuildUtils.java	2008-01-04 00:57:26 UTC (rev 17532)
+++ labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/builder/BuildUtils.java	2008-01-04 01:54:45 UTC (rev 17533)
@@ -31,11 +31,11 @@
 import org.drools.common.QuadroupleBetaConstraints;
 import org.drools.common.SingleBetaConstraints;
 import org.drools.common.TripleBetaConstraints;
-import org.drools.reteoo.ObjectSink;
-import org.drools.reteoo.ObjectSource;
+import org.drools.reteoo.RightTupleSink;
+import org.drools.reteoo.RightTupleSource;
 import org.drools.reteoo.ObjectTypeNode;
-import org.drools.reteoo.TupleSink;
-import org.drools.reteoo.TupleSource;
+import org.drools.reteoo.LeftTupleSink;
+import org.drools.reteoo.LeftTupleSource;
 import org.drools.rule.Declaration;
 import org.drools.rule.InvalidPatternException;
 import org.drools.rule.RuleConditionElement;
@@ -99,16 +99,16 @@
                 }
             }
         } else if( isSharingEnabledForNode( context, candidate ) ) {
-            if ( (context.getTupleSource() != null) && ( candidate instanceof TupleSink ) ) {
-                TupleSink[] sinks = context.getTupleSource().getSinkPropagator().getSinks(); 
+            if ( (context.getTupleSource() != null) && ( candidate instanceof LeftTupleSink ) ) {
+                LeftTupleSink[] sinks = context.getTupleSource().getSinkPropagator().getSinks(); 
                 for( int i = 0; i < sinks.length; i++ ) {
                     if( candidate.equals( sinks[i] ) ) {
                         node = (BaseNode) sinks[i];
                         break;
                     }
                 }
-            } else if ( (context.getObjectSource() != null) && (candidate instanceof ObjectSink) ) {
-                ObjectSink[] sinks = context.getObjectSource().getSinkPropagator().getSinks();
+            } else if ( (context.getObjectSource() != null) && (candidate instanceof RightTupleSink) ) {
+                RightTupleSink[] sinks = context.getObjectSource().getSinkPropagator().getSinks();
                 for( int i = 0; i < sinks.length; i++ ) {
                     if( candidate.equals( sinks[i] ) ) {
                         node = (BaseNode) sinks[i];
@@ -149,9 +149,9 @@
      */
     private boolean isSharingEnabledForNode(final BuildContext context,
                                             final BaseNode node) {
-        if ( node instanceof TupleSource ) {
+        if ( node instanceof LeftTupleSource ) {
             return context.getRuleBase().getConfiguration().isShareBetaNodes();
-        } else if ( node instanceof ObjectSource ) {
+        } else if ( node instanceof RightTupleSource ) {
             return context.getRuleBase().getConfiguration().isShareAlphaNodes();
         }
         return false;

Modified: labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/builder/CollectBuilder.java
===================================================================
--- labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/builder/CollectBuilder.java	2008-01-04 00:57:26 UTC (rev 17532)
+++ labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/builder/CollectBuilder.java	2008-01-04 01:54:45 UTC (rev 17533)
@@ -22,9 +22,9 @@
 import org.drools.common.BetaConstraints;
 import org.drools.common.TupleStartEqualsConstraint;
 import org.drools.reteoo.CollectNode;
-import org.drools.reteoo.ObjectSource;
+import org.drools.reteoo.RightTupleSource;
 import org.drools.reteoo.RightInputAdapterNode;
-import org.drools.reteoo.TupleSource;
+import org.drools.reteoo.LeftTupleSource;
 import org.drools.rule.Collect;
 import org.drools.rule.Pattern;
 import org.drools.rule.RuleConditionElement;
@@ -57,7 +57,7 @@
         final ReteooComponentBuilder builder = utils.getBuilderFor( sourcePattern );
 
         // save tuple source and pattern offset for later if needed
-        final TupleSource tupleSource = context.getTupleSource();
+        final LeftTupleSource tupleSource = context.getTupleSource();
         final int currentPatternIndex = context.getCurrentPatternOffset();
         
         // builds the source pattern
@@ -69,7 +69,7 @@
         if ( context.getObjectSource() == null ) {
 
             // attach right input adapter node to convert tuple source into an object source
-            context.setObjectSource( (ObjectSource) utils.attachNode( context,
+            context.setObjectSource( (RightTupleSource) utils.attachNode( context,
                                                                       new RightInputAdapterNode( context.getNextId(),
                                                                                                  context.getTupleSource(),
                                                                                                  context ) ) );
@@ -88,7 +88,7 @@
         BetaConstraints binder = utils.createBetaNodeConstraint( context, context.getBetaconstraints(), false );
         BetaConstraints resultBinder = utils.createBetaNodeConstraint( context, resultBetaConstraints, false );
         
-        context.setTupleSource( (TupleSource) utils.attachNode( context,
+        context.setTupleSource( (LeftTupleSource) utils.attachNode( context,
                                                                 new CollectNode( context.getNextId(),
                                                                                  context.getTupleSource(),
                                                                                  context.getObjectSource(),

Modified: labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/builder/EvalBuilder.java
===================================================================
--- labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/builder/EvalBuilder.java	2008-01-04 00:57:26 UTC (rev 17532)
+++ labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/builder/EvalBuilder.java	2008-01-04 01:54:45 UTC (rev 17533)
@@ -17,7 +17,7 @@
 package org.drools.reteoo.builder;
 
 import org.drools.reteoo.EvalConditionNode;
-import org.drools.reteoo.TupleSource;
+import org.drools.reteoo.LeftTupleSource;
 import org.drools.rule.EvalCondition;
 import org.drools.rule.RuleConditionElement;
 
@@ -39,7 +39,7 @@
         final EvalCondition eval = (EvalCondition) rce;
         utils.checkUnboundDeclarations( context,
                                         eval.getRequiredDeclarations() );
-        context.setTupleSource( (TupleSource) utils.attachNode( context,
+        context.setTupleSource( (LeftTupleSource) utils.attachNode( context,
                                                                 new EvalConditionNode( context.getNextId(),
                                                                                        context.getTupleSource(),
                                                                                        eval,

Modified: labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/builder/FromBuilder.java
===================================================================
--- labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/builder/FromBuilder.java	2008-01-04 00:57:26 UTC (rev 17532)
+++ labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/builder/FromBuilder.java	2008-01-04 01:54:45 UTC (rev 17533)
@@ -20,7 +20,7 @@
 
 import org.drools.common.BetaConstraints;
 import org.drools.reteoo.FromNode;
-import org.drools.reteoo.TupleSource;
+import org.drools.reteoo.LeftTupleSource;
 import org.drools.rule.From;
 import org.drools.rule.RuleConditionElement;
 import org.drools.spi.AlphaNodeFieldConstraint;
@@ -43,7 +43,7 @@
 
         BetaConstraints betaConstraints = utils.createBetaNodeConstraint( context, context.getBetaconstraints(), true );
         
-        context.setTupleSource( (TupleSource) utils.attachNode( context,
+        context.setTupleSource( (LeftTupleSource) utils.attachNode( context,
                                                                 new FromNode( context.getNextId(),
                                                                               from.getDataProvider(),
                                                                               context.getTupleSource(),

Modified: labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/builder/GroupElementBuilder.java
===================================================================
--- labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/builder/GroupElementBuilder.java	2008-01-04 00:57:26 UTC (rev 17532)
+++ labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/builder/GroupElementBuilder.java	2008-01-04 01:54:45 UTC (rev 17533)
@@ -29,9 +29,9 @@
 import org.drools.reteoo.JoinNode;
 import org.drools.reteoo.LeftInputAdapterNode;
 import org.drools.reteoo.NotNode;
-import org.drools.reteoo.ObjectSource;
+import org.drools.reteoo.RightTupleSource;
 import org.drools.reteoo.RightInputAdapterNode;
-import org.drools.reteoo.TupleSource;
+import org.drools.reteoo.LeftTupleSource;
 import org.drools.rule.GroupElement;
 import org.drools.rule.RuleConditionElement;
 
@@ -115,7 +115,7 @@
                 // if a previous object source was bound, but no tuple source
                 if ( context.getObjectSource() != null && context.getTupleSource() == null ) {
                     // adapt it to a Tuple source
-                    context.setTupleSource( (TupleSource) utils.attachNode( context,
+                    context.setTupleSource( (LeftTupleSource) utils.attachNode( context,
                                                                             new LeftInputAdapterNode( context.getNextId(),
                                                                                                       context.getObjectSource(),
                                                                                                       context ) ) );
@@ -130,7 +130,7 @@
                                                                                             context.getBetaconstraints(),
                                                                                             false );
                     
-                    context.setTupleSource( (TupleSource) utils.attachNode( context,
+                    context.setTupleSource( (LeftTupleSource) utils.attachNode( context,
                                                                             new JoinNode( context.getNextId(),
                                                                                           context.getTupleSource(),
                                                                                           context.getObjectSource(),
@@ -198,7 +198,7 @@
 
             // NOT must save some context info to restore it later
             final int currentPatternIndex = context.getCurrentPatternOffset();
-            final TupleSource tupleSource = context.getTupleSource();
+            final LeftTupleSource tupleSource = context.getTupleSource();
 
             // get child
             final RuleConditionElement child = (RuleConditionElement) not.getChildren().get( 0 );
@@ -215,7 +215,7 @@
             if ( context.getObjectSource() == null && context.getTupleSource() != null ) {
 
                 // attach right input adapter node to convert tuple source into an object source
-                context.setObjectSource( (ObjectSource) utils.attachNode( context,
+                context.setObjectSource( (RightTupleSource) utils.attachNode( context,
                                                                           new RightInputAdapterNode( context.getNextId(),
                                                                                                      context.getTupleSource(),
                                                                                                      context ) ) );
@@ -237,7 +237,7 @@
             // then attach the NOT node. It will work both as a simple not node
             // or as subnetwork join node as the context was set appropriatelly
             // in each case
-            context.setTupleSource( (TupleSource) utils.attachNode( context,
+            context.setTupleSource( (LeftTupleSource) utils.attachNode( context,
                                                                     new NotNode( context.getNextId(),
                                                                                  context.getTupleSource(),
                                                                                  context.getObjectSource(),
@@ -275,7 +275,7 @@
 
             // EXISTS must save some context info to restore it later
             final int currentPatternIndex = context.getCurrentPatternOffset();
-            final TupleSource tupleSource = context.getTupleSource();
+            final LeftTupleSource tupleSource = context.getTupleSource();
 
             // get child
             final RuleConditionElement child = (RuleConditionElement) exists.getChildren().get( 0 );
@@ -292,7 +292,7 @@
             if ( context.getObjectSource() == null && context.getTupleSource() != null ) {
 
                 // attach right input adapter node to convert tuple source into an object source
-                context.setObjectSource( (ObjectSource) utils.attachNode( context,
+                context.setObjectSource( (RightTupleSource) utils.attachNode( context,
                                                                           new RightInputAdapterNode( context.getNextId(),
                                                                                                      context.getTupleSource(),
                                                                                                      context ) ) );
@@ -315,7 +315,7 @@
             // then attach the EXISTS node. It will work both as a simple exists node
             // or as subnetwork join node as the context was set appropriatelly
             // in each case
-            context.setTupleSource( (TupleSource) utils.attachNode( context,
+            context.setTupleSource( (LeftTupleSource) utils.attachNode( context,
                                                                     new ExistsNode( context.getNextId(),
                                                                                     context.getTupleSource(),
                                                                                     context.getObjectSource(),

Modified: labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/builder/PatternBuilder.java
===================================================================
--- labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/builder/PatternBuilder.java	2008-01-04 00:57:26 UTC (rev 17532)
+++ labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/reteoo/builder/PatternBuilder.java	2008-01-04 01:54:45 UTC (rev 17533)
@@ -25,7 +25,7 @@
 import org.drools.common.InstanceNotEqualsConstraint;
 import org.drools.common.InternalWorkingMemory;
 import org.drools.reteoo.AlphaNode;
-import org.drools.reteoo.ObjectSource;
+import org.drools.reteoo.RightTupleSource;
 import org.drools.reteoo.ObjectTypeNode;
 import org.drools.rule.Declaration;
 import org.drools.rule.EntryPoint;
@@ -189,7 +189,7 @@
             }
         }
 
-        context.setObjectSource( (ObjectSource) utils.attachNode( context,
+        context.setObjectSource( (RightTupleSource) utils.attachNode( context,
                                                                   new ObjectTypeNode( context.getNextId(),
                                                                                       pattern.getObjectType(),
                                                                                       context ) ) );
@@ -197,7 +197,7 @@
         for ( final Iterator it = alphaConstraints.iterator(); it.hasNext(); ) {
             final AlphaNodeFieldConstraint constraint = (AlphaNodeFieldConstraint) it.next();
 
-            context.setObjectSource( (ObjectSource) utils.attachNode( context,
+            context.setObjectSource( (RightTupleSource) utils.attachNode( context,
                                                                       new AlphaNode( context.getNextId(),
                                                                                      (AlphaNodeFieldConstraint) constraint,
                                                                                      context.getObjectSource(),

Modified: labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/rule/AbstractCompositeConstraint.java
===================================================================
--- labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/rule/AbstractCompositeConstraint.java	2008-01-04 00:57:26 UTC (rev 17532)
+++ labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/rule/AbstractCompositeConstraint.java	2008-01-04 01:54:45 UTC (rev 17533)
@@ -19,7 +19,7 @@
 
 import org.drools.common.InternalFactHandle;
 import org.drools.common.InternalWorkingMemory;
-import org.drools.reteoo.ReteTuple;
+import org.drools.reteoo.LeftTuple;
 import org.drools.spi.AlphaNodeFieldConstraint;
 import org.drools.spi.BetaNodeFieldConstraint;
 import org.drools.spi.Constraint;
@@ -222,7 +222,7 @@
         }
 
         public void updateFromTuple(InternalWorkingMemory workingMemory,
-                                    ReteTuple tuple) {
+                                    LeftTuple tuple) {
             for ( int i = 0; i < contexts.length; i++ ) {
                 contexts[i].updateFromTuple( workingMemory,
                                              tuple );

Modified: labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/rule/AbstractCompositeRestriction.java
===================================================================
--- labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/rule/AbstractCompositeRestriction.java	2008-01-04 00:57:26 UTC (rev 17532)
+++ labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/rule/AbstractCompositeRestriction.java	2008-01-04 01:54:45 UTC (rev 17533)
@@ -6,7 +6,7 @@
 
 import org.drools.common.InternalFactHandle;
 import org.drools.common.InternalWorkingMemory;
-import org.drools.reteoo.ReteTuple;
+import org.drools.reteoo.LeftTuple;
 import org.drools.spi.Restriction;
 
 public abstract class AbstractCompositeRestriction
@@ -121,7 +121,7 @@
         }
 
         public void updateFromTuple(final InternalWorkingMemory workingMemory,
-                                    final ReteTuple tuple) {
+                                    final LeftTuple tuple) {
             for ( int i = 0, length = this.contextEntries.length; i < length; i++ ) {
                 this.contextEntries[i].updateFromTuple( workingMemory,
                                                         tuple );

Modified: labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/rule/AndCompositeRestriction.java
===================================================================
--- labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/rule/AndCompositeRestriction.java	2008-01-04 00:57:26 UTC (rev 17532)
+++ labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/rule/AndCompositeRestriction.java	2008-01-04 01:54:45 UTC (rev 17533)
@@ -2,7 +2,7 @@
 
 import org.drools.common.InternalFactHandle;
 import org.drools.common.InternalWorkingMemory;
-import org.drools.reteoo.ReteTuple;
+import org.drools.reteoo.LeftTuple;
 import org.drools.spi.Extractor;
 import org.drools.spi.Restriction;
 
@@ -38,7 +38,7 @@
         return true;
     }
 
-    public boolean isAllowedCachedRight(final ReteTuple tuple,
+    public boolean isAllowedCachedRight(final LeftTuple tuple,
                                         final ContextEntry context) {
         for ( int i = 0, ilength = this.restrictions.length; i < ilength; i++ ) {
             if ( !this.restrictions[i].isAllowedCachedRight( tuple,

Modified: labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/rule/AndConstraint.java
===================================================================
--- labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/rule/AndConstraint.java	2008-01-04 00:57:26 UTC (rev 17532)
+++ labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/rule/AndConstraint.java	2008-01-04 01:54:45 UTC (rev 17533)
@@ -21,7 +21,7 @@
 
 import org.drools.common.InternalFactHandle;
 import org.drools.common.InternalWorkingMemory;
-import org.drools.reteoo.ReteTuple;
+import org.drools.reteoo.LeftTuple;
 import org.drools.spi.AlphaNodeFieldConstraint;
 import org.drools.spi.BetaNodeFieldConstraint;
 import org.drools.util.ArrayUtils;
@@ -73,7 +73,7 @@
     /**
      * {@inheritDoc}
      */
-    public boolean isAllowedCachedRight(ReteTuple tuple,
+    public boolean isAllowedCachedRight(LeftTuple tuple,
                                         ContextEntry context) {
         if ( this.betaConstraints.length > 0 ) {
             for ( int i = 0; i < this.betaConstraints.length; i++ ) {

Modified: labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/rule/ContextEntry.java
===================================================================
--- labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/rule/ContextEntry.java	2008-01-04 00:57:26 UTC (rev 17532)
+++ labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/rule/ContextEntry.java	2008-01-04 01:54:45 UTC (rev 17533)
@@ -4,7 +4,7 @@
 
 import org.drools.common.InternalFactHandle;
 import org.drools.common.InternalWorkingMemory;
-import org.drools.reteoo.ReteTuple;
+import org.drools.reteoo.LeftTuple;
 
 public interface ContextEntry
     extends
@@ -15,7 +15,7 @@
     public void setNext(ContextEntry entry);
 
     public void updateFromTuple(InternalWorkingMemory workingMemory,
-                                ReteTuple tuple);
+                                LeftTuple tuple);
 
     public void updateFromFactHandle(InternalWorkingMemory workingMemory,
                                      InternalFactHandle handle);

Modified: labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/rule/LiteralRestriction.java
===================================================================
--- labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/rule/LiteralRestriction.java	2008-01-04 00:57:26 UTC (rev 17532)
+++ labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/rule/LiteralRestriction.java	2008-01-04 01:54:45 UTC (rev 17533)
@@ -18,7 +18,7 @@
 
 import org.drools.common.InternalFactHandle;
 import org.drools.common.InternalWorkingMemory;
-import org.drools.reteoo.ReteTuple;
+import org.drools.reteoo.LeftTuple;
 import org.drools.spi.Evaluator;
 import org.drools.spi.Extractor;
 import org.drools.spi.FieldExtractor;
@@ -72,7 +72,7 @@
                                         this.field );
     }
 
-    public boolean isAllowedCachedRight(final ReteTuple tuple,
+    public boolean isAllowedCachedRight(final LeftTuple tuple,
                                         final ContextEntry context) {
         return this.evaluator.evaluate( null,
                                         ((LiteralContextEntry) context).getFieldExtractor(),
@@ -162,7 +162,7 @@
         }
 
         public void updateFromTuple(final InternalWorkingMemory workingMemory,
-                                    final ReteTuple tuple) {
+                                    final LeftTuple tuple) {
             // nothing to do
         }
 

Modified: labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/rule/MultiRestrictionFieldConstraint.java
===================================================================
--- labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/rule/MultiRestrictionFieldConstraint.java	2008-01-04 00:57:26 UTC (rev 17532)
+++ labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/rule/MultiRestrictionFieldConstraint.java	2008-01-04 01:54:45 UTC (rev 17533)
@@ -2,7 +2,7 @@
 
 import org.drools.common.InternalFactHandle;
 import org.drools.common.InternalWorkingMemory;
-import org.drools.reteoo.ReteTuple;
+import org.drools.reteoo.LeftTuple;
 import org.drools.spi.AlphaNodeFieldConstraint;
 import org.drools.spi.BetaNodeFieldConstraint;
 import org.drools.spi.FieldExtractor;
@@ -83,7 +83,7 @@
                                                       handle );
     }
 
-    public boolean isAllowedCachedRight(final ReteTuple tuple,
+    public boolean isAllowedCachedRight(final LeftTuple tuple,
                                         final ContextEntry context) {
         return this.restrictions.isAllowedCachedRight( tuple,
                                                        context );

Modified: labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/rule/OrCompositeRestriction.java
===================================================================
--- labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/rule/OrCompositeRestriction.java	2008-01-04 00:57:26 UTC (rev 17532)
+++ labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/rule/OrCompositeRestriction.java	2008-01-04 01:54:45 UTC (rev 17533)
@@ -2,7 +2,7 @@
 
 import org.drools.common.InternalFactHandle;
 import org.drools.common.InternalWorkingMemory;
-import org.drools.reteoo.ReteTuple;
+import org.drools.reteoo.LeftTuple;
 import org.drools.spi.Extractor;
 import org.drools.spi.Restriction;
 
@@ -38,7 +38,7 @@
         return false;
     }
 
-    public boolean isAllowedCachedRight(final ReteTuple tuple,
+    public boolean isAllowedCachedRight(final LeftTuple tuple,
                                         final ContextEntry context) {
         for ( int i = 0, ilength = this.restrictions.length; i < ilength; i++ ) {
             if ( this.restrictions[i].isAllowedCachedRight( tuple,

Modified: labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/rule/OrConstraint.java
===================================================================
--- labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/rule/OrConstraint.java	2008-01-04 00:57:26 UTC (rev 17532)
+++ labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/rule/OrConstraint.java	2008-01-04 01:54:45 UTC (rev 17533)
@@ -20,7 +20,7 @@
 
 import org.drools.common.InternalFactHandle;
 import org.drools.common.InternalWorkingMemory;
-import org.drools.reteoo.ReteTuple;
+import org.drools.reteoo.LeftTuple;
 import org.drools.spi.AlphaNodeFieldConstraint;
 import org.drools.spi.BetaNodeFieldConstraint;
 import org.drools.util.ArrayUtils;
@@ -77,7 +77,7 @@
     /**
      * {@inheritDoc}
      */
-    public boolean isAllowedCachedRight(ReteTuple tuple,
+    public boolean isAllowedCachedRight(LeftTuple tuple,
                                         ContextEntry context) {
         if ( this.betaConstraints.length > 0 ) {
             for ( int i = 0; i < this.betaConstraints.length; i++ ) {

Modified: labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/rule/PredicateConstraint.java
===================================================================
--- labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/rule/PredicateConstraint.java	2008-01-04 00:57:26 UTC (rev 17532)
+++ labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/rule/PredicateConstraint.java	2008-01-04 01:54:45 UTC (rev 17533)
@@ -21,7 +21,7 @@
 import org.drools.RuntimeDroolsException;
 import org.drools.common.InternalFactHandle;
 import org.drools.common.InternalWorkingMemory;
-import org.drools.reteoo.ReteTuple;
+import org.drools.reteoo.LeftTuple;
 import org.drools.spi.AlphaNodeFieldConstraint;
 import org.drools.spi.BetaNodeFieldConstraint;
 import org.drools.spi.Extractor;
@@ -249,7 +249,7 @@
         }
     }
 
-    public boolean isAllowedCachedRight(final ReteTuple tuple,
+    public boolean isAllowedCachedRight(final LeftTuple tuple,
                                         final ContextEntry context) {
         try {
             final PredicateContextEntry ctx = (PredicateContextEntry) context;
@@ -287,7 +287,7 @@
 
         private static final long    serialVersionUID = 400L;
 
-        public ReteTuple             leftTuple;
+        public LeftTuple             leftTuple;
         public Object                rightObject;
         public InternalWorkingMemory workingMemory;
 
@@ -311,7 +311,7 @@
         }
 
         public void updateFromTuple(final InternalWorkingMemory workingMemory,
-                                    final ReteTuple tuple) {
+                                    final LeftTuple tuple) {
             this.workingMemory = workingMemory;
             this.leftTuple = tuple;
         }

Modified: labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/rule/ReturnValueConstraint.java
===================================================================
--- labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/rule/ReturnValueConstraint.java	2008-01-04 00:57:26 UTC (rev 17532)
+++ labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/rule/ReturnValueConstraint.java	2008-01-04 01:54:45 UTC (rev 17533)
@@ -19,7 +19,7 @@
 import org.drools.RuntimeDroolsException;
 import org.drools.common.InternalFactHandle;
 import org.drools.common.InternalWorkingMemory;
-import org.drools.reteoo.ReteTuple;
+import org.drools.reteoo.LeftTuple;
 import org.drools.rule.ReturnValueRestriction.ReturnValueContextEntry;
 import org.drools.spi.AlphaNodeFieldConstraint;
 import org.drools.spi.BetaNodeFieldConstraint;
@@ -125,7 +125,7 @@
         }
     }
 
-    public boolean isAllowedCachedRight(final ReteTuple tuple,
+    public boolean isAllowedCachedRight(final LeftTuple tuple,
                                         final ContextEntry context) {
         try {
             final ReturnValueContextEntry ctx = (ReturnValueContextEntry) context;

Modified: labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/rule/ReturnValueRestriction.java
===================================================================
--- labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/rule/ReturnValueRestriction.java	2008-01-04 00:57:26 UTC (rev 17532)
+++ labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/rule/ReturnValueRestriction.java	2008-01-04 01:54:45 UTC (rev 17533)
@@ -22,7 +22,7 @@
 import org.drools.WorkingMemory;
 import org.drools.common.InternalFactHandle;
 import org.drools.common.InternalWorkingMemory;
-import org.drools.reteoo.ReteTuple;
+import org.drools.reteoo.LeftTuple;
 import org.drools.spi.Evaluator;
 import org.drools.spi.Extractor;
 import org.drools.spi.FieldExtractor;
@@ -186,7 +186,7 @@
         throw new UnsupportedOperationException( "does not support method call isAllowed(Object object, InternalWorkingMemory workingMemoiry)" );
     }
 
-    public boolean isAllowedCachedRight(final ReteTuple tuple,
+    public boolean isAllowedCachedRight(final LeftTuple tuple,
                                         final ContextEntry context) {
         throw new UnsupportedOperationException( "does not support method call isAllowed(Object object, InternalWorkingMemory workingMemoiry)" );
     }
@@ -285,7 +285,7 @@
 
         public FieldExtractor        fieldExtractor;
         public InternalFactHandle    handle;
-        public ReteTuple             leftTuple;
+        public LeftTuple             leftTuple;
         public InternalWorkingMemory workingMemory;
         public Declaration[]         previousDeclarations;
         public Declaration[]         localDeclarations;
@@ -315,7 +315,7 @@
         }
 
         public void updateFromTuple(final InternalWorkingMemory workingMemory,
-                                    final ReteTuple tuple) {
+                                    final LeftTuple tuple) {
             this.workingMemory = workingMemory;
             this.leftTuple = tuple;
         }
@@ -330,7 +330,7 @@
         /* (non-Javadoc)
          * @see org.drools.rule.ReturnValueContextEntry#getTuple()
          */
-        public ReteTuple getTuple() {
+        public LeftTuple getTuple() {
             return this.leftTuple;
         }
 

Modified: labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/rule/VariableConstraint.java
===================================================================
--- labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/rule/VariableConstraint.java	2008-01-04 00:57:26 UTC (rev 17532)
+++ labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/rule/VariableConstraint.java	2008-01-04 01:54:45 UTC (rev 17533)
@@ -18,7 +18,7 @@
 
 import org.drools.common.InternalFactHandle;
 import org.drools.common.InternalWorkingMemory;
-import org.drools.reteoo.ReteTuple;
+import org.drools.reteoo.LeftTuple;
 import org.drools.spi.AlphaNodeFieldConstraint;
 import org.drools.spi.BetaNodeFieldConstraint;
 import org.drools.spi.Evaluator;
@@ -80,7 +80,7 @@
                                                      handle );
     }
 
-    public boolean isAllowedCachedRight(final ReteTuple tuple,
+    public boolean isAllowedCachedRight(final LeftTuple tuple,
                                         final ContextEntry context) {
         return this.restriction.isAllowedCachedRight( tuple,
                                                       context );

Modified: labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/rule/VariableRestriction.java
===================================================================
--- labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/rule/VariableRestriction.java	2008-01-04 00:57:26 UTC (rev 17532)
+++ labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/rule/VariableRestriction.java	2008-01-04 01:54:45 UTC (rev 17533)
@@ -21,7 +21,7 @@
 import org.drools.base.ValueType;
 import org.drools.common.InternalFactHandle;
 import org.drools.common.InternalWorkingMemory;
-import org.drools.reteoo.ReteTuple;
+import org.drools.reteoo.LeftTuple;
 import org.drools.spi.Evaluator;
 import org.drools.spi.Extractor;
 import org.drools.spi.FieldExtractor;
@@ -85,7 +85,7 @@
                                                   this.evaluator.prepareObject( handle ) );
     }
 
-    public boolean isAllowedCachedRight(final ReteTuple tuple,
+    public boolean isAllowedCachedRight(final LeftTuple tuple,
                                         final ContextEntry context) {
         return this.evaluator.evaluateCachedRight( ((VariableContextEntry) context).workingMemory,
                                                    (VariableContextEntry) context,
@@ -167,7 +167,7 @@
         public Evaluator             evaluator;
         public Object                object;
         public Declaration           declaration;
-        public ReteTuple             reteTuple;
+        public LeftTuple             reteTuple;
         public ContextEntry          entry;
         public boolean               leftNull;
         public boolean               rightNull;
@@ -197,7 +197,7 @@
             return this.object;
         }
 
-        public ReteTuple getTuple() {
+        public LeftTuple getTuple() {
             return this.reteTuple;
         }
 
@@ -229,7 +229,7 @@
         }
 
         public void updateFromTuple(final InternalWorkingMemory workingMemory,
-                                    final ReteTuple tuple) {
+                                    final LeftTuple tuple) {
             this.reteTuple = tuple;
             this.workingMemory = workingMemory;
             this.leftNull = this.declaration.getExtractor().isNullValue( workingMemory,
@@ -265,7 +265,7 @@
         }
 
         public void updateFromTuple(final InternalWorkingMemory workingMemory,
-                                    final ReteTuple tuple) {
+                                    final LeftTuple tuple) {
             this.reteTuple = tuple;
             this.workingMemory = workingMemory;
             this.leftNull = this.declaration.getExtractor().isNullValue( workingMemory,
@@ -311,7 +311,7 @@
         }
 
         public void updateFromTuple(final InternalWorkingMemory workingMemory,
-                                    final ReteTuple tuple) {
+                                    final LeftTuple tuple) {
             this.reteTuple = tuple;
             this.workingMemory = workingMemory;
             this.leftNull = this.declaration.getExtractor().isNullValue( workingMemory,
@@ -357,7 +357,7 @@
         }
 
         public void updateFromTuple(final InternalWorkingMemory workingMemory,
-                                    final ReteTuple tuple) {
+                                    final LeftTuple tuple) {
             this.reteTuple = tuple;
             this.workingMemory = workingMemory;
             this.leftNull = this.declaration.getExtractor().isNullValue( workingMemory,
@@ -402,7 +402,7 @@
         }
 
         public void updateFromTuple(final InternalWorkingMemory workingMemory,
-                                    final ReteTuple tuple) {
+                                    final LeftTuple tuple) {
             this.reteTuple = tuple;
             this.workingMemory = workingMemory;
             this.leftNull = this.declaration.getExtractor().isNullValue( workingMemory,

Modified: labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/spi/BetaNodeFieldConstraint.java
===================================================================
--- labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/spi/BetaNodeFieldConstraint.java	2008-01-04 00:57:26 UTC (rev 17532)
+++ labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/spi/BetaNodeFieldConstraint.java	2008-01-04 01:54:45 UTC (rev 17533)
@@ -17,7 +17,7 @@
  */
 
 import org.drools.common.InternalFactHandle;
-import org.drools.reteoo.ReteTuple;
+import org.drools.reteoo.LeftTuple;
 import org.drools.rule.ContextEntry;
 
 public interface BetaNodeFieldConstraint
@@ -27,7 +27,7 @@
     public boolean isAllowedCachedLeft(ContextEntry context,
                                        InternalFactHandle handle);
 
-    public boolean isAllowedCachedRight(ReteTuple tuple,
+    public boolean isAllowedCachedRight(LeftTuple tuple,
                                         ContextEntry context);
 
     public ContextEntry getContextEntry();

Modified: labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/spi/PropagationContext.java
===================================================================
--- labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/spi/PropagationContext.java	2008-01-04 00:57:26 UTC (rev 17532)
+++ labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/spi/PropagationContext.java	2008-01-04 01:54:45 UTC (rev 17533)
@@ -17,7 +17,7 @@
  */
 
 import java.io.Serializable;
-import org.drools.reteoo.ReteTuple;
+import org.drools.reteoo.LeftTuple;
 import org.drools.rule.EntryPoint;
 import org.drools.rule.Rule;
 
@@ -47,7 +47,7 @@
                                   Activation activation);
 
     public Activation removeRetractedTuple(Rule rule,
-                                           ReteTuple tuple);
+                                           LeftTuple tuple);
 
     public void clearRetractedTuples();
     

Modified: labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/spi/Restriction.java
===================================================================
--- labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/spi/Restriction.java	2008-01-04 00:57:26 UTC (rev 17532)
+++ labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/spi/Restriction.java	2008-01-04 01:54:45 UTC (rev 17533)
@@ -4,7 +4,7 @@
 
 import org.drools.common.InternalFactHandle;
 import org.drools.common.InternalWorkingMemory;
-import org.drools.reteoo.ReteTuple;
+import org.drools.reteoo.LeftTuple;
 import org.drools.rule.ContextEntry;
 import org.drools.rule.Declaration;
 
@@ -21,7 +21,7 @@
     public boolean isAllowedCachedLeft(ContextEntry context,
                                        InternalFactHandle handle);
 
-    public boolean isAllowedCachedRight(ReteTuple tuple,
+    public boolean isAllowedCachedRight(LeftTuple tuple,
                                         ContextEntry context);
 
     public ContextEntry getContextEntry();

Modified: labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/util/AbstractBaseLinkedListNode.java
===================================================================
--- labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/util/AbstractBaseLinkedListNode.java	2008-01-04 00:57:26 UTC (rev 17532)
+++ labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/util/AbstractBaseLinkedListNode.java	2008-01-04 01:54:45 UTC (rev 17533)
@@ -26,13 +26,13 @@
  */
 public class AbstractBaseLinkedListNode
     implements
-    LinkedListNode {
+    Entry {
 
     private static final long serialVersionUID = 400L;
 
-    private LinkedListNode    previous;
+    private Entry    previous;
 
-    private LinkedListNode    next;
+    private Entry    next;
 
     /**
      * Empty Constructor
@@ -43,28 +43,28 @@
     /* (non-Javadoc)
      * @see org.drools.reteoo.LinkedListNode#getNext()
      */
-    public LinkedListNode getNext() {
+    public Entry getNext() {
         return this.next;
     }
 
     /* (non-Javadoc)
      * @see org.drools.reteoo.LinkedListNode#setNext(org.drools.reteoo.LinkedListNode)
      */
-    public void setNext(final LinkedListNode next) {
+    public void setNext(final Entry next) {
         this.next = next;
     }
 
     /* (non-Javadoc)
      * @see org.drools.reteoo.LinkedListNode#getPrevious()
      */
-    public LinkedListNode getPrevious() {
+    public Entry getPrevious() {
         return this.previous;
     }
 
     /* (non-Javadoc)
      * @see org.drools.reteoo.LinkedListNode#setPrevious(org.drools.reteoo.LinkedListNode)
      */
-    public void setPrevious(final LinkedListNode previous) {
+    public void setPrevious(final Entry previous) {
         this.previous = previous;
     }
 }

Modified: labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/util/AbstractHashTable.java
===================================================================
--- labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/util/AbstractHashTable.java	2008-01-04 00:57:26 UTC (rev 17532)
+++ labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/util/AbstractHashTable.java	2008-01-04 01:54:45 UTC (rev 17533)
@@ -6,7 +6,7 @@
 import java.io.Serializable;
 
 import org.drools.common.InternalFactHandle;
-import org.drools.reteoo.ReteTuple;
+import org.drools.reteoo.LeftTuple;
 import org.drools.rule.Declaration;
 import org.drools.spi.Evaluator;
 import org.drools.spi.FieldExtractor;
@@ -346,67 +346,67 @@
         }
     }
 
-    public static class FactEntryImpl
-        implements
-        FactEntry,
-        Entry {
+//    public static class FactEntryImpl
+//        implements
+//        FactEntry,
+//        Entry {
+//
+//        private static final long serialVersionUID = 400L;
+//
+//        public InternalFactHandle handle;
+//
+//        public int                hashCode;
+//
+//        public Entry              next;
+//
+//        //        private LinkedList              list;
+//
+//        public FactEntryImpl(final InternalFactHandle handle) {
+//            this.handle = handle;
+//            this.hashCode = handle.hashCode();
+//            //            this.list = new LinkedList();
+//        }
+//
+//        public FactEntryImpl(final InternalFactHandle handle,
+//                         final int hashCode) {
+//            this.handle = handle;
+//            this.hashCode = hashCode;
+//            //            this.list = new LinkedList();
+//        }
+//
+//        public InternalFactHandle getFactHandle() {
+//            return this.handle;
+//        }
+//
+//        public Entry getNext() {
+//            return this.next;
+//        }
+//
+//        public void setNext(final Entry next) {
+//            this.next = next;
+//        }
+//
+//        //        
+//        //        void add(final LinkedListEntry tupleMatchEntry) {
+//        //            this.list.add( tupleMatchEntry );
+//        //        }
+//        //        void remove(final LinkedListEntry tupleMatchEntry) {
+//        //            this.list.remove( tupleMatchEntry );
+//        //        }        
+//
+//        public int hashCode() {
+//            return this.hashCode;
+//        }
+//
+//        public boolean equals(final Object object) {
+//            return (object == this) || (this.handle == ((FactEntryImpl) object).handle);
+//        }
+//
+//        public String toString() {
+//            return "FactEntry( handle=" + this.handle + " hashcode=" + this.hashCode + " next=" + this.next + " )";
+//        }
+//    }
 
-        private static final long serialVersionUID = 400L;
-
-        public InternalFactHandle handle;
-
-        public int                hashCode;
-
-        public Entry              next;
-
-        //        private LinkedList              list;
-
-        public FactEntryImpl(final InternalFactHandle handle) {
-            this.handle = handle;
-            this.hashCode = handle.hashCode();
-            //            this.list = new LinkedList();
-        }
-
-        public FactEntryImpl(final InternalFactHandle handle,
-                         final int hashCode) {
-            this.handle = handle;
-            this.hashCode = hashCode;
-            //            this.list = new LinkedList();
-        }
-
-        public InternalFactHandle getFactHandle() {
-            return this.handle;
-        }
-
-        public Entry getNext() {
-            return this.next;
-        }
-
-        public void setNext(final Entry next) {
-            this.next = next;
-        }
-
-        //        
-        //        void add(final LinkedListEntry tupleMatchEntry) {
-        //            this.list.add( tupleMatchEntry );
-        //        }
-        //        void remove(final LinkedListEntry tupleMatchEntry) {
-        //            this.list.remove( tupleMatchEntry );
-        //        }        
-
-        public int hashCode() {
-            return this.hashCode;
-        }
-
-        public boolean equals(final Object object) {
-            return (object == this) || (this.handle == ((FactEntryImpl) object).handle);
-        }
-
-        public String toString() {
-            return "FactEntry( handle=" + this.handle + " hashcode=" + this.hashCode + " next=" + this.next + " )";
-        }
-    }
-
     public static class FieldIndex {
         FieldExtractor   extractor;
         Declaration      declaration;
@@ -437,15 +437,15 @@
     public static interface Index {        
         public FieldIndex getFieldIndex(int index);
         
-        public int hashCodeOf(ReteTuple tuple);
+        public int hashCodeOf(LeftTuple tuple);
 
         public int hashCodeOf(Object object);
 
         public boolean equal(Object object,
-                             ReteTuple tuple);
+                             LeftTuple tuple);
 
-        public boolean equal(ReteTuple tuple1,
-                             ReteTuple tuple2);
+        public boolean equal(LeftTuple tuple1,
+                             LeftTuple tuple2);
 
         public boolean equal(Object object1,
                              Object object2);
@@ -484,14 +484,14 @@
             return rehash( hashCode );
         }
 
-        public int hashCodeOf(final ReteTuple tuple) {
+        public int hashCodeOf(final LeftTuple tuple) {
             int hashCode = this.startResult;
             hashCode = TupleIndexHashTable.PRIME * hashCode + this.declaration.getHashCode( null, tuple.get( this.declaration ).getObject() );
             return rehash( hashCode );
         }
 
         public boolean equal(final Object right,
-                             final ReteTuple tuple) {
+                             final LeftTuple tuple) {
             final Object left = tuple.get( this.declaration ).getObject();
 
             return this.evaluator.evaluate( null,
@@ -509,8 +509,8 @@
                                             this.extractor, object2 );
         }
 
-        public boolean equal(final ReteTuple tuple1,
-                             final ReteTuple tuple2) {
+        public boolean equal(final LeftTuple tuple1,
+                             final LeftTuple tuple2) {
             final Object object1 = tuple1.get( this.declaration ).getObject();
             final Object object2 = tuple2.get( this.declaration ).getObject();
             return this.evaluator.evaluate( null,
@@ -565,7 +565,7 @@
             return rehash( hashCode );
         }
 
-        public int hashCodeOf(final ReteTuple tuple) {
+        public int hashCodeOf(final LeftTuple tuple) {
             int hashCode = this.startResult;
 
             hashCode = TupleIndexHashTable.PRIME * hashCode + this.index0.declaration.getHashCode( null, tuple.get( this.index0.declaration ).getObject() );
@@ -575,7 +575,7 @@
         }
 
         public boolean equal(final Object right,
-                             final ReteTuple tuple) {
+                             final LeftTuple tuple) {
             final Object left1 = tuple.get( this.index0.declaration ).getObject();
             final Object left2 = tuple.get( this.index1.declaration ).getObject();
 
@@ -588,8 +588,8 @@
                                                                                               this.index1.extractor, right );
         }
 
-        public boolean equal(final ReteTuple tuple1,
-                             final ReteTuple tuple2) {
+        public boolean equal(final LeftTuple tuple1,
+                             final LeftTuple tuple2) {
             final Object object11 = tuple1.get( this.index0.declaration ).getObject();
             final Object object12 = tuple2.get( this.index0.declaration ).getObject();
 
@@ -666,7 +666,7 @@
             return rehash( hashCode );
         }
 
-        public int hashCodeOf(final ReteTuple tuple) {
+        public int hashCodeOf(final LeftTuple tuple) {
             int hashCode = this.startResult;
 
             hashCode = TupleIndexHashTable.PRIME * hashCode + this.index0.declaration.getHashCode( null, tuple.get( this.index0.declaration ).getObject() );
@@ -677,7 +677,7 @@
         }
 
         public boolean equal(final Object right,
-                             final ReteTuple tuple) {
+                             final LeftTuple tuple) {
             final Object left1 = tuple.get( this.index0.declaration ).getObject();
             final Object left2 = tuple.get( this.index1.declaration ).getObject();
             final Object left3 = tuple.get( this.index2.declaration ).getObject();
@@ -694,8 +694,8 @@
                                                                                                                                          this.index2.extractor, right );
         }
 
-        public boolean equal(final ReteTuple tuple1,
-                             final ReteTuple tuple2) {
+        public boolean equal(final LeftTuple tuple1,
+                             final LeftTuple tuple2) {
             final Object object11 = tuple1.get( this.index0.declaration ).getObject();
             final Object object12 = tuple2.get( this.index0.declaration ).getObject();
             final Object object21 = tuple1.get( this.index1.declaration ).getObject();

Modified: labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/util/Entry.java
===================================================================
--- labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/util/Entry.java	2008-01-04 00:57:26 UTC (rev 17532)
+++ labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/util/Entry.java	2008-01-04 01:54:45 UTC (rev 17533)
@@ -8,7 +8,10 @@
 public interface Entry
     extends
     Serializable {
+	
+	public void setPrevious(Entry entry);
+	public Entry getPrevious();
+	
     public void setNext(Entry next);
-
     public Entry getNext();
 }
\ No newline at end of file

Deleted: labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/util/FactEntry.java
===================================================================
--- labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/util/FactEntry.java	2008-01-04 00:57:26 UTC (rev 17532)
+++ labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/util/FactEntry.java	2008-01-04 01:54:45 UTC (rev 17533)
@@ -1,7 +0,0 @@
-package org.drools.util;
-
-import org.drools.common.InternalFactHandle;
-
-public interface FactEntry {
-    public InternalFactHandle getFactHandle();
-}

Modified: labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/util/FactHandleIndexHashTable.java
===================================================================
--- labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/util/FactHandleIndexHashTable.java	2008-01-04 00:57:26 UTC (rev 17532)
+++ labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/util/FactHandleIndexHashTable.java	2008-01-04 01:54:45 UTC (rev 17533)
@@ -4,13 +4,14 @@
 package org.drools.util;
 
 import org.drools.common.InternalFactHandle;
-import org.drools.reteoo.FactHandleMemory;
-import org.drools.reteoo.ReteTuple;
+import org.drools.reteoo.RightTuple;
+import org.drools.reteoo.RightTupleMemory;
+import org.drools.reteoo.LeftTuple;
 import org.drools.util.TupleIndexHashTable.FieldIndexEntry;
 
 public class FactHandleIndexHashTable extends AbstractHashTable
     implements
-    FactHandleMemory {
+    RightTupleMemory {
 
     private static final long           serialVersionUID = 400L;
 
@@ -65,7 +66,7 @@
         throw new UnsupportedOperationException( "FieldIndexHashTable does not support  iterator()" );
     }
 
-    public Iterator iterator(final ReteTuple tuple) {
+    public Iterator iterator(final LeftTuple tuple) {
         if ( this.tupleValueIterator == null ) {
             this.tupleValueIterator = new FieldIndexHashTableIterator();
         }
@@ -137,20 +138,20 @@
         return result;
     }  
 
-    public boolean add(final InternalFactHandle handle) {
-        final FieldIndexEntry entry = getOrCreate( handle.getObject() );
-        entry.add( handle );
+    public boolean add(final RightTuple rightTuple) {
+        final FieldIndexEntry entry = getOrCreate( rightTuple.getHandle().getObject() );
+        entry.add( rightTuple );
         this.factSize++;
         return true;
     }
 
-    public boolean add(final InternalFactHandle handle,
+    public boolean add(final RightTuple rightTuple,
                        final boolean checkExists) {
         throw new UnsupportedOperationException( "FieldIndexHashTable does not support add(InternalFactHandle handle, boolean checkExists)" );
     }
 
-    public boolean remove(final InternalFactHandle handle) {
-        final Object object = handle.getObject();
+    public boolean remove(final RightTuple rightTuple) {
+        final Object object = rightTuple.getHandle().getObject();
         //this.index.setCachedValue( object );
         final int hashCode = this.index.hashCodeOf( object );
 
@@ -165,7 +166,7 @@
             final FieldIndexEntry next = (FieldIndexEntry) current.next;
             if ( current.matches( object,
                                   hashCode ) ) {
-                current.remove( handle );
+                current.remove( rightTuple );
                 this.factSize--;
                 // If the FactEntryIndex is empty, then remove it from the hash table
                 if ( current.first == null ) {
@@ -185,8 +186,8 @@
         return false;
     }
 
-    public boolean contains(final InternalFactHandle handle) {
-        final Object object = handle.getObject();
+    public boolean contains(final RightTuple  rightTuple) {
+        final Object object = rightTuple.getHandle().getObject();
         //this.index.setCachedValue( object );
 
         final int hashCode = this.index.hashCodeOf( object );
@@ -205,7 +206,7 @@
         return false;
     }
 
-    public FieldIndexEntry get(final ReteTuple tuple) {
+    public FieldIndexEntry get(final LeftTuple tuple) {
         //this.index.setCachedValue( tuple );
 
         final int hashCode = this.index.hashCodeOf( tuple );
@@ -271,8 +272,9 @@
         Entry {
 
         private static final long serialVersionUID = 400L;
+//      private Entry             entry;
         private Entry             next;
-        private FactEntryImpl         first;
+        private RightTuple        first;
         private final int         hashCode;
         private Index             index;
 
@@ -290,42 +292,41 @@
             this.next = next;
         }
 
-        public FactEntryImpl getFirst() {
+        public RightTuple getFirst() {
             return this.first;
         }
 
-        public void add(final InternalFactHandle handle) {
-            final FactEntryImpl entry = new FactEntryImpl( handle );
-            entry.next = this.first;
-            this.first = entry;
+        public void add(final RightTuple rightTuple) {
+            rightTuple.setNext( this.first );
+            this.first = rightTuple;
         }
 
-        public FactEntryImpl get(final InternalFactHandle handle) {
-            final long id = handle.getId();
-            FactEntryImpl current = this.first;
+        public RightTuple get(final RightTuple rightTuple) {
+            InternalFactHandle handle = rightTuple.getHandle();
+            RightTuple current = this.first;
             while ( current != null ) {
-                if ( current.handle.getId() == id ) {
+                if ( current.getHandle() == handle ) {
                     return current;
                 }
-                current = (FactEntryImpl) current.next;
+                current = (RightTuple) current.getNext();
             }
             return null;
         }
 
-        public FactEntryImpl remove(final InternalFactHandle handle) {
-            final long id = handle.getId();
+        public RightTuple remove(final RightTuple rightTuple) {
+            InternalFactHandle handle = rightTuple.getHandle();
 
-            FactEntryImpl previous = this.first;
-            FactEntryImpl current = previous;
+            RightTuple previous = this.first;
+            RightTuple current = previous;
             while ( current != null ) {
-                final FactEntryImpl next = (FactEntryImpl) current.next;
-                if ( current.handle.getId() == id ) {
+                final RightTuple next = (RightTuple) current.getNext();
+                if ( current.getHandle() == handle ) {
                     if ( this.first == current ) {
                         this.first = next;
                     } else {
-                        previous.next = next;
+                        previous.setNext( next );
                     }
-                    current.next = null;
+                    current.setNext( null );
                     return current;
                 }
                 previous = current;
@@ -340,13 +341,13 @@
 
         public boolean matches(final Object object,
                                final int objectHashCode) {
-            return this.hashCode == objectHashCode && this.index.equal( this.first.getFactHandle().getObject(),
+            return this.hashCode == objectHashCode && this.index.equal( this.first.getHandle().getObject(),
                                                                         object );
         }
 
-        public boolean matches(final ReteTuple tuple,
+        public boolean matches(final LeftTuple tuple,
                                final int tupleHashCode) {
-            return this.hashCode == tupleHashCode && this.index.equal( this.first.getFactHandle().getObject(),
+            return this.hashCode == tupleHashCode && this.index.equal( this.first.getHandle().getObject(),
                                                                        tuple );
         }
 
@@ -362,5 +363,14 @@
         public String toString() {
             return "FieldIndexEntry( hashCode=" + this.hashCode + " first=" + this.first + " )";
         }
+
+        public Entry getPrevious() {            
+            return null;
+//          return this.previous;            
+        }
+
+        public void setPrevious(Entry previous) {
+//          this.previous = previous;
+        }
     }
 }
\ No newline at end of file

Modified: labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/util/FactHashTable.java
===================================================================
--- labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/util/FactHashTable.java	2008-01-04 00:57:26 UTC (rev 17532)
+++ labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/util/FactHashTable.java	2008-01-04 01:54:45 UTC (rev 17533)
@@ -4,12 +4,13 @@
 package org.drools.util;
 
 import org.drools.common.InternalFactHandle;
-import org.drools.reteoo.FactHandleMemory;
-import org.drools.reteoo.ReteTuple;
+import org.drools.reteoo.RightTupleMemory;
+import org.drools.reteoo.LeftTuple;
+import org.drools.reteoo.RightTuple;
 
 public class FactHashTable extends AbstractHashTable
     implements
-    FactHandleMemory {
+    RightTupleMemory {
     private static final long serialVersionUID = 400L;
 
     public FactHashTable() {
@@ -23,69 +24,74 @@
                loadFactor );
     }
 
-    public Iterator iterator(final ReteTuple tuple) {
+    public Iterator iterator(final LeftTuple tuple) {
         return iterator();
     }
 
-    public boolean add(final InternalFactHandle handle) {
-        return add( handle,
+    public boolean add(final RightTuple tuple) {
+        return add( tuple,
                     true );
     }
 
-    public boolean add(final InternalFactHandle handle,
+    public boolean add(final RightTuple tuple,
                        final boolean checkExists) {
-        final int hashCode = this.comparator.hashCodeOf( handle );
+        final int hashCode = this.comparator.hashCodeOf( tuple.getHandle() );
+        tuple.setHashCode(hashCode);
+        
         final int index = indexOf( hashCode,
                                    this.table.length );
-
+        
+        InternalFactHandle handle = tuple.getHandle();
         // scan the linked entries to see if it exists
         if ( checkExists ) {
-            FactEntryImpl current = (FactEntryImpl) this.table[index];
+        	RightTuple current = (RightTuple) this.table[index];        	
             while ( current != null ) {
-                if ( hashCode == current.hashCode && handle.getId() == current.handle.getId() ) {
+                if ( hashCode == current.hashCode() && handle == current.getHandle() ) {
                     return false;
                 }
-                current = (FactHashTable.FactEntryImpl) current.getNext();
+                current = (RightTuple) current.getNext();
             }
         }
+        
+        tuple.setNext( this.table[index]);
+        this.table[index] = tuple;
 
-        // We aren't checking the key exists, or it didn't find the key
-        final FactEntryImpl entry = new FactEntryImpl( handle,
-                                               hashCode );
-        entry.next = this.table[index];
-        this.table[index] = entry;
-
         if ( this.size++ >= this.threshold ) {
             resize( 2 * this.table.length );
         }
         return true;
     }
 
-    public boolean contains(final InternalFactHandle handle) {
-        final int hashCode = this.comparator.hashCodeOf( handle );
+    public boolean contains(final RightTuple tuple) {
+    	final int hashCode = this.comparator.hashCodeOf( tuple.getHandle() );
+    	
         final int index = indexOf( hashCode,
                                    this.table.length );
 
-        FactEntryImpl current = (FactEntryImpl) this.table[index];
+        InternalFactHandle handle = tuple.getHandle();
+    	RightTuple current = (RightTuple) this.table[index];        	
         while ( current != null ) {
-            if ( hashCode == current.hashCode && handle.getId() == current.handle.getId() ) {
+            if ( hashCode == current.hashCode() && handle == current.getHandle() ) {
                 return true;
             }
-            current = (FactEntryImpl) current.getNext();
+            current = (RightTuple) current.getNext();
         }
         return false;
     }
 
-    public boolean remove(final InternalFactHandle handle) {
-        final int hashCode = this.comparator.hashCodeOf( handle );
+    public boolean remove(final RightTuple tuple) {
+    	final int hashCode = this.comparator.hashCodeOf( tuple.getHandle() );
+    	
         final int index = indexOf( hashCode,
                                    this.table.length );
 
-        FactEntryImpl previous = (FactEntryImpl) this.table[index];
-        FactEntryImpl current = previous;
+        InternalFactHandle handle = tuple.getHandle();
+        
+        RightTuple previous = (RightTuple) this.table[index];
+        RightTuple current = previous;
         while ( current != null ) {
-            final FactEntryImpl next = (FactEntryImpl) current.getNext();
-            if ( hashCode == current.hashCode && handle.getId() == current.handle.getId() ) {
+            final RightTuple next = (RightTuple) current.getNext();
+            if ( hashCode == current.hashCode() && handle == current.getHandle() ) {
                 if ( previous == current ) {
                     this.table[index] = next;
                 } else {

Modified: labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/util/FactList.java
===================================================================
--- labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/util/FactList.java	2008-01-04 00:57:26 UTC (rev 17532)
+++ labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/util/FactList.java	2008-01-04 01:54:45 UTC (rev 17533)
@@ -6,12 +6,13 @@
 import java.io.Serializable;
 
 import org.drools.common.InternalFactHandle;
-import org.drools.reteoo.FactHandleMemory;
-import org.drools.reteoo.ReteTuple;
+import org.drools.reteoo.RightTuple;
+import org.drools.reteoo.RightTupleMemory;
+import org.drools.reteoo.LeftTuple;
 
 public class FactList
     implements
-    FactHandleMemory {
+    RightTupleMemory {
     private static final long serialVersionUID = 400L;
 
     private final LinkedList list;
@@ -20,22 +21,23 @@
         this.list = new LinkedList();
     }
 
-    public Iterator iterator(final ReteTuple tuple) {
+    public Iterator iterator(final LeftTuple tuple) {
         return iterator();
     }
 
-    public boolean add(final InternalFactHandle handle) {
-        return add( handle,
+    public boolean add(final RightTuple rightTuple) {
+        return add( rightTuple,
                     true );
     }
 
-    public boolean add(final InternalFactHandle handle,
+    public boolean add(final RightTuple rightTuple,
                        final boolean checkExists) {
-        this.list.add( new FactEntryImpl( handle ) );
+        this.list.add( rightTuple );
         return true;
     }
 
-    public boolean contains(final InternalFactHandle handle) {
+    public boolean contains(final RightTuple rightTuple) {
+        InternalFactHandle handle = rightTuple.getHandle();
         Iterator it = this.list.iterator();
         for ( Object object = it.next(); object != null; object = it.next() ) {
             if ( handle.equals( ((LinkedListEntry)object).getObject() ) ) {
@@ -45,11 +47,12 @@
         return false;
     }
 
-    public boolean remove(final InternalFactHandle handle) {
-        Iterator it = this.list.iterator();
+    public boolean remove(final RightTuple rightTuple) {
+        InternalFactHandle handle = rightTuple.getHandle();
+        Iterator it = this.list.iterator();        
         for ( Object object = it.next(); object != null; object = it.next() ) {
             if ( handle.equals( ((LinkedListEntry)object).getObject() ) ) {
-                this.list.remove( (LinkedListEntry)object );
+                this.list.remove( rightTuple );
                 return true;
             }
         }
@@ -67,15 +70,4 @@
     public boolean isIndexed() {
         return false;
     }
-    
-    public static class FactEntryImpl extends LinkedListEntry implements FactEntry, Serializable {    
-        public FactEntryImpl(InternalFactHandle handle) {
-            super(handle);
-        }
-
-        public InternalFactHandle getFactHandle() {
-            return (InternalFactHandle) getObject();
-        }
-        
-    }
 }
\ No newline at end of file

Modified: labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/util/LinkedList.java
===================================================================
--- labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/util/LinkedList.java	2008-01-04 00:57:26 UTC (rev 17532)
+++ labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/util/LinkedList.java	2008-01-04 01:54:45 UTC (rev 17533)
@@ -47,8 +47,8 @@
     Serializable {
     private static final long  serialVersionUID = 400L;
 
-    private LinkedListNode     firstNode;
-    private LinkedListNode     lastNode;
+    private Entry     firstNode;
+    private Entry     lastNode;
 
     private int                size;
 
@@ -68,7 +68,7 @@
      * @param node
      *      The <code>LinkedListNode</code> to be added
      */
-    public void add(final LinkedListNode node) {
+    public void add(final Entry node) {
         if ( this.firstNode == null ) {
             this.firstNode = node;
             this.lastNode = node;;
@@ -88,7 +88,7 @@
      * @param node
      *      The <code>LinkedListNode</code> to be removed.
      */
-    public void remove(final LinkedListNode node) {
+    public void remove(final Entry node) {
         if ( this.firstNode == node ) {
             removeFirst();
         } else if ( this.lastNode == node ) {
@@ -107,7 +107,7 @@
      * @return
      *      The first <code>LinkedListNode</code>.
      */
-    public final LinkedListNode getFirst() {
+    public Entry getFirst() {
         return this.firstNode;
     }
 
@@ -116,7 +116,7 @@
      * @return
      *      The last <code>LinkedListNode</code>.
      */
-    public final LinkedListNode getLast() {
+    public Entry getLast() {
         return this.lastNode;
     }
 
@@ -127,11 +127,11 @@
      * @return
      *      The first <code>LinkedListNode</code>.
      */
-    public LinkedListNode removeFirst() {
+    public Entry removeFirst() {
         if ( this.firstNode == null ) {
             return null;
         }
-        final LinkedListNode node = this.firstNode;
+        final Entry node = this.firstNode;
         this.firstNode = node.getNext();
         node.setNext( null );
         if ( this.firstNode != null ) {
@@ -143,8 +143,8 @@
         return node;
     }
 
-    public void insertAfter(final LinkedListNode existingNode,
-                            final LinkedListNode newNode) {
+    public void insertAfter(final Entry existingNode,
+                            final Entry newNode) {
         if ( newNode.getPrevious() != null || newNode.getNext() != null ) {
             //do nothing if this node is already inserted somewhere
             return;
@@ -156,7 +156,7 @@
                 this.lastNode = newNode;
             } else {
                 // if existing node is null, then insert it as a first node
-                final LinkedListNode node = this.firstNode;
+                final Entry node = this.firstNode;
                 node.setPrevious( newNode );
                 newNode.setNext( node );
                 this.firstNode = newNode;
@@ -181,11 +181,11 @@
      * @return
      *      The first <code>LinkedListNode</code>.
      */
-    public LinkedListNode removeLast() {
+    public Entry removeLast() {
         if ( this.lastNode == null ) {
             return null;
         }
-        final LinkedListNode node = this.lastNode;
+        final Entry node = this.lastNode;
         this.lastNode = node.getPrevious();
         node.setPrevious( null );
         if ( this.lastNode != null ) {
@@ -224,7 +224,7 @@
     public int hashCode() {
         final int PRIME = 31;
         int result = 1;
-        for ( LinkedListNode node = this.firstNode; node != null; node = node.getNext() ) {
+        for ( Entry node = this.firstNode; node != null; node = node.getNext() ) {
             result = PRIME * result + node.hashCode();
         }
         return result;
@@ -235,7 +235,7 @@
             return true;
         }
 
-        if ( object == null || !(object instanceof LinkedList) ) {
+        if ( object == null || !(object instanceof Entry) ) {
             return false;
         }
 
@@ -245,7 +245,7 @@
             return false;
         }
 
-        for ( LinkedListNode thisNode = this.firstNode, otherNode = other.firstNode; thisNode != null && otherNode != null; thisNode = thisNode.getNext(), otherNode = otherNode.getNext() ) {
+        for ( Entry thisNode = this.firstNode, otherNode = other.firstNode; thisNode != null && otherNode != null; thisNode = thisNode.getNext(), otherNode = otherNode.getNext() ) {
             if ( !thisNode.equals( otherNode ) ) {
                 return false;
             }
@@ -271,7 +271,7 @@
         Iterator,
         Serializable {
         private LinkedList     list;
-        private LinkedListNode current;
+        private Entry current;
 
         public void reset(final LinkedList list) {
             this.list = list;
@@ -282,7 +282,7 @@
             if ( this.current == null ) {
                 return null;
             }
-            final LinkedListNode node = this.current;
+            final Entry node = this.current;
             this.current = this.current.getNext();
             return node;
         }
@@ -293,8 +293,8 @@
         java.util.Iterator,
         Serializable {
         private LinkedList     list;
-        private LinkedListNode currentNode;
-        private LinkedListNode nextNode;
+        private Entry currentNode;
+        private Entry nextNode;
         private boolean        immutable;
 
         public JavaUtilIterator(final LinkedList list) {

Deleted: labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/util/LinkedListNode.java
===================================================================
--- labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/util/LinkedListNode.java	2008-01-04 00:57:26 UTC (rev 17532)
+++ labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/util/LinkedListNode.java	2008-01-04 01:54:45 UTC (rev 17533)
@@ -1,61 +0,0 @@
-package org.drools.util;
-
-/*
- * Copyright 2005 JBoss Inc
- * 
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * 
- *      http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import java.io.Serializable;
-
-/**
- * Items placed in a <code>LinkedList<code> must implement this interface .
- * 
- * @see LinkedList
- * 
- * @author <a href="mailto:mark.proctor at jboss.com">Mark Proctor</a>
- * @author <a href="mailto:bob at werken.com">Bob McWhirter</a>
- */
-public interface LinkedListNode
-    extends
-    Serializable {
-
-    /**
-     * Returns the next node
-     * @return
-     *      The next LinkedListNode
-     */
-    public LinkedListNode getNext();
-
-    /**
-     * Sets the next node 
-     * @param next
-     *      The next LinkedListNode
-     */
-    public void setNext(LinkedListNode next);
-
-    /**
-     * Returns the previous node
-     * @return
-     *      The previous LinkedListNode
-     */
-    public LinkedListNode getPrevious();
-
-    /**
-     * Sets the previous node 
-     * @param previous
-     *      The previous LinkedListNode
-     */
-    public void setPrevious(LinkedListNode previous);
-
-}

Modified: labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/util/ObjectHashMap.java
===================================================================
--- labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/util/ObjectHashMap.java	2008-01-04 00:57:26 UTC (rev 17532)
+++ labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/util/ObjectHashMap.java	2008-01-04 01:54:45 UTC (rev 17533)
@@ -139,6 +139,8 @@
         private int               hashCode;
 
         private Entry             next;
+        
+//      private Entry             previous;
 
         public ObjectEntry(final Object key,
                            final Object value,
@@ -158,11 +160,20 @@
 
         public Entry getNext() {
             return this.next;
+        }        
+        
+        public Entry getPrevious() {
+            return null;
+//          return this.previous;
         }
 
+        public void setPrevious(Entry previous) {
+//            this.previous = previous;            
+        }          
+
         public void setNext(final Entry next) {
             this.next = next;
-        }
+        }              
 
         public int hashCode() {
             return this.hashCode;

Modified: labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/util/ObjectHashSet.java
===================================================================
--- labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/util/ObjectHashSet.java	2008-01-04 00:57:26 UTC (rev 17532)
+++ labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/util/ObjectHashSet.java	2008-01-04 01:54:45 UTC (rev 17533)
@@ -143,7 +143,9 @@
 
         private int               hashCode;
 
-        private Entry             next;
+//        private Entry             previous;
+        
+        private Entry             next;        
 
         public ObjectEntry(final Object value,
                            final int hashCode) {
@@ -154,6 +156,15 @@
         public Object getValue() {
             return this.value;
         }
+        
+        public void setPrevious(Entry previous) {
+//            this.previous = previous;            
+        }        
+        
+        public Entry getPrevious() {
+            return null;
+//            return this.previous;
+        }        
 
         public Entry getNext() {
             return this.next;
@@ -161,7 +172,7 @@
 
         public void setNext(final Entry next) {
             this.next = next;
-        }
+        }              
 
         public int hashCode() {
             return this.hashCode;

Modified: labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/util/TupleHashTable.java
===================================================================
--- labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/util/TupleHashTable.java	2008-01-04 00:57:26 UTC (rev 17532)
+++ labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/util/TupleHashTable.java	2008-01-04 01:54:45 UTC (rev 17533)
@@ -4,12 +4,13 @@
 package org.drools.util;
 
 import org.drools.common.InternalFactHandle;
-import org.drools.reteoo.ReteTuple;
-import org.drools.reteoo.TupleMemory;
+import org.drools.reteoo.LeftTuple;
+import org.drools.reteoo.LeftTupleMemory;
+import org.drools.reteoo.RightTuple;
 
 public class TupleHashTable extends AbstractHashTable
     implements
-    TupleMemory {
+    LeftTupleMemory {
     public TupleHashTable() {
         this( 16,
               0.75f );
@@ -21,11 +22,11 @@
                loadFactor );
     }
 
-    public Iterator iterator(final InternalFactHandle handle) {
+    public Iterator iterator(final RightTuple rightTuple) {
         return iterator();
     }
 
-    public void add(final ReteTuple tuple) {
+    public void add(final LeftTuple tuple) {
         final int hashCode = tuple.hashCode();
         final int index = indexOf( hashCode,
                                    this.table.length );
@@ -38,30 +39,30 @@
         }
     }
 
-    public ReteTuple get(final ReteTuple tuple) {
+    public LeftTuple get(final LeftTuple tuple) {
         final int hashCode = tuple.hashCode();
         final int index = indexOf( hashCode,
                                    this.table.length );
 
-        ReteTuple current = (ReteTuple) this.table[index];
+        LeftTuple current = (LeftTuple) this.table[index];
         while ( current != null ) {
             if ( hashCode == current.hashCode() && tuple.equals( current ) ) {
                 return current;
             }
-            current = (ReteTuple) current.getNext();
+            current = (LeftTuple) current.getNext();
         }
         return null;
     }
 
-    public ReteTuple remove(final ReteTuple tuple) {
+    public LeftTuple remove(final LeftTuple tuple) {
         final int hashCode = tuple.hashCode();
         final int index = indexOf( hashCode,
                                    this.table.length );
 
-        ReteTuple previous = (ReteTuple) this.table[index];
-        ReteTuple current = previous;
+        LeftTuple previous = (LeftTuple) this.table[index];
+        LeftTuple current = previous;
         while ( current != null ) {
-            final ReteTuple next = (ReteTuple) current.getNext();
+            final LeftTuple next = (LeftTuple) current.getNext();
             if ( hashCode == current.hashCode() && tuple.equals( current ) ) {
                 if ( previous == current ) {
                     this.table[index] = next;
@@ -86,7 +87,7 @@
         return this.table[index];
     }
 
-    public boolean contains(final ReteTuple tuple) {
+    public boolean contains(final LeftTuple tuple) {
         return (get( tuple ) != null);
     }
 

Modified: labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/util/TupleIndexHashTable.java
===================================================================
--- labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/util/TupleIndexHashTable.java	2008-01-04 00:57:26 UTC (rev 17532)
+++ labs/jbossrules/branches/righttuple/drools-core/src/main/java/org/drools/util/TupleIndexHashTable.java	2008-01-04 01:54:45 UTC (rev 17533)
@@ -4,12 +4,13 @@
 package org.drools.util;
 
 import org.drools.common.InternalFactHandle;
-import org.drools.reteoo.ReteTuple;
-import org.drools.reteoo.TupleMemory;
+import org.drools.reteoo.LeftTuple;
+import org.drools.reteoo.LeftTupleMemory;
+import org.drools.reteoo.RightTuple;
 
 public class TupleIndexHashTable extends AbstractHashTable
     implements
-    TupleMemory {
+    LeftTupleMemory {
 
     private static final long               serialVersionUID = 400L;
 
@@ -69,11 +70,11 @@
         return this.tupleValueFullIterator;
     }
 
-    public Iterator iterator(final InternalFactHandle handle) {
+    public Iterator iterator(final RightTuple rightTuple) {
         if ( this.tupleValueIterator == null ) {
             this.tupleValueIterator = new FieldIndexHashTableIterator();
         }
-        final FieldIndexEntry entry = get( handle );
+        final FieldIndexEntry entry = get( rightTuple );
         this.tupleValueIterator.reset( (entry != null) ? entry.first : null );
         return this.tupleValueIterator;
     }
@@ -188,18 +189,18 @@
         return result;
     }       
 
-    public void add(final ReteTuple tuple) {
+    public void add(final LeftTuple tuple) {
         final FieldIndexEntry entry = getOrCreate( tuple );
         entry.add( tuple );
         this.factSize++;
     }
 
-    public boolean add(final ReteTuple tuple,
+    public boolean add(final LeftTuple tuple,
                        final boolean checkExists) {
         throw new UnsupportedOperationException( "FieldIndexHashTable does not support add(ReteTuple tuple, boolean checkExists)" );
     }
 
-    public ReteTuple remove(final ReteTuple tuple) {
+    public LeftTuple remove(final LeftTuple tuple) {
         final int hashCode = this.index.hashCodeOf( tuple );
 
         final int index = indexOf( hashCode,
@@ -213,7 +214,7 @@
             final FieldIndexEntry next = (FieldIndexEntry) current.next;
             if ( current.matches( tuple,
                                   hashCode ) ) {
-                final ReteTuple old = current.remove( tuple );
+                final LeftTuple old = current.remove( tuple );
                 this.factSize--;
                 // If the FactEntryIndex is empty, then remove it from the hash table
                 if ( current.first == null ) {
@@ -233,7 +234,7 @@
         return null;
     }
 
-    public boolean contains(final ReteTuple tuple) {
+    public boolean contains(final LeftTuple tuple) {
         final int hashCode = this.index.hashCodeOf( tuple );
 
         final int index = indexOf( hashCode,
@@ -250,9 +251,9 @@
         return false;
     }
 
-    public FieldIndexEntry get(final InternalFactHandle handle) {
-        final Object object = handle.getObject();
-        final int hashCode = this.index.hashCodeOf( handle.getObject() );
+    public FieldIndexEntry get(final RightTuple rightTuple) {
+        final Object object = rightTuple.getHandle().getObject();
+        final int hashCode = this.index.hashCodeOf( object );
 
         final int index = indexOf( hashCode,
                                    this.table.length );
@@ -276,7 +277,7 @@
      * @param value
      * @return
      */
-    private FieldIndexEntry getOrCreate(final ReteTuple tuple) {
+    private FieldIndexEntry getOrCreate(final LeftTuple tuple) {
         final int hashCode = this.index.hashCodeOf( tuple );
 
         final int index = indexOf( hashCode,
@@ -315,8 +316,9 @@
         Entry {
 
         private static final long serialVersionUID = 400L;
+//      private Entry             previous;
         private Entry             next;
-        private ReteTuple         first;
+        private LeftTuple         first;
         private final int         hashCode;
         private Index             index;
 
@@ -334,31 +336,31 @@
             this.next = next;
         }
 
-        public ReteTuple getFirst() {
+        public LeftTuple getFirst() {
             return this.first;
         }
 
-        public void add(final ReteTuple tuple) {
+        public void add(final LeftTuple tuple) {
             tuple.setNext( this.first );
             this.first = tuple;
         }
 
-        public ReteTuple get(final ReteTuple tuple) {
-            ReteTuple current = this.first;
+        public LeftTuple get(final LeftTuple tuple) {
+            LeftTuple current = this.first;
             while ( current != null ) {
                 if ( tuple.equals( current ) ) {
                     return current;
                 }
-                current = (ReteTuple) current.getNext();
+                current = (LeftTuple) current.getNext();
             }
             return null;
         }
 
-        public ReteTuple remove(final ReteTuple tuple) {
-            ReteTuple previous = this.first;
-            ReteTuple current = previous;
+        public LeftTuple remove(final LeftTuple tuple) {
+            LeftTuple previous = this.first;
+            LeftTuple current = previous;
             while ( current != null ) {
-                final ReteTuple next = (ReteTuple) current.getNext();
+                final LeftTuple next = (LeftTuple) current.getNext();
                 if ( tuple.equals( current ) ) {
                     if ( this.first == current ) {
                         this.first = next;
@@ -380,7 +382,7 @@
                                                                         this.first );
         }
 
-        public boolean matches(final ReteTuple tuple,
+        public boolean matches(final LeftTuple tuple,
                                final int tupleHashCode) {
             return this.hashCode == tupleHashCode && this.index.equal( this.first,
                                                                        tuple );
@@ -394,6 +396,14 @@
             final FieldIndexEntry other = (FieldIndexEntry) object;
             return this.hashCode == other.hashCode && this.index == other.index;
         }
+
+        public Entry getPrevious() {
+            return null;
+        }
+
+        public void setPrevious(Entry previous) {
+//          this.previous = previous;           
+        }
     }
 
 }
\ No newline at end of file

Modified: labs/jbossrules/branches/righttuple/drools-core/src/test/java/org/drools/common/BaseBetaConstraintsTest.java
===================================================================
--- labs/jbossrules/branches/righttuple/drools-core/src/test/java/org/drools/common/BaseBetaConstraintsTest.java	2008-01-04 00:57:26 UTC (rev 17532)
+++ labs/jbossrules/branches/righttuple/drools-core/src/test/java/org/drools/common/BaseBetaConstraintsTest.java	2008-01-04 01:54:45 UTC (rev 17533)
@@ -101,7 +101,7 @@
         BetaMemory betaMemory = betaConstraints.createBetaMemory( config );
 
         if ( indexedPositions.length > 0 ) {
-            TupleIndexHashTable tupleHashTable = (TupleIndexHashTable) betaMemory.getTupleMemory();
+            TupleIndexHashTable tupleHashTable = (TupleIndexHashTable) betaMemory.getLeftTupleMemory();
             assertTrue( tupleHashTable.isIndexed() );
             Index index = tupleHashTable.getIndex();
 
@@ -110,7 +110,7 @@
                                              index.getFieldIndex( i ) );
             }
 
-            FactHandleIndexHashTable factHashTable = (FactHandleIndexHashTable) betaMemory.getFactHandleMemory();
+            FactHandleIndexHashTable factHashTable = (FactHandleIndexHashTable) betaMemory.getRightTupleMemory();
             assertTrue( factHashTable.isIndexed() );
             index = factHashTable.getIndex();
 
@@ -119,10 +119,10 @@
                                              index.getFieldIndex( i ) );
             }
         } else {
-            TupleHashTable tupleHashTable = (TupleHashTable) betaMemory.getTupleMemory();
+            TupleHashTable tupleHashTable = (TupleHashTable) betaMemory.getLeftTupleMemory();
             assertFalse( tupleHashTable.isIndexed() );
 
-            FactHashTable factHashTable = (FactHashTable) betaMemory.getFactHandleMemory();
+            FactHashTable factHashTable = (FactHashTable) betaMemory.getRightTupleMemory();
             assertFalse( factHashTable.isIndexed() );
         }
     }

Modified: labs/jbossrules/branches/righttuple/drools-core/src/test/java/org/drools/reteoo/AccumulateNodeTest.java
===================================================================
--- labs/jbossrules/branches/righttuple/drools-core/src/test/java/org/drools/reteoo/AccumulateNodeTest.java	2008-01-04 00:57:26 UTC (rev 17532)
+++ labs/jbossrules/branches/righttuple/drools-core/src/test/java/org/drools/reteoo/AccumulateNodeTest.java	2008-01-04 01:54:45 UTC (rev 17533)
@@ -23,7 +23,6 @@
 import org.drools.base.ClassObjectType;
 import org.drools.common.DefaultFactHandle;
 import org.drools.common.EmptyBetaConstraints;
-import org.drools.common.InternalFactHandle;
 import org.drools.common.InternalWorkingMemory;
 import org.drools.common.PropagationContextImpl;
 import org.drools.reteoo.AccumulateNode.AccumulateMemory;
@@ -105,9 +104,9 @@
 
         // check memories are empty
         assertEquals( 0,
-                      this.memory.getTupleMemory().size() );
+                      this.memory.getLeftTupleMemory().size() );
         assertEquals( 0,
-                      this.memory.getFactHandleMemory().size() );
+                      this.memory.getRightTupleMemory().size() );
     }
 
     /* (non-Javadoc)
@@ -128,10 +127,10 @@
                              0,
                              this.sink.getAsserted().size() );
 
-        this.node.assertTuple( new ReteTuple( this.workingMemory.getFactHandleFactory().newFactHandle( "cheese", false, null ) ),
+        this.node.assertTuple( new LeftTuple( this.workingMemory.getFactHandleFactory().newFactHandle( "cheese", false, null ) ),
                                this.context,
                                this.workingMemory );
-        this.node.assertTuple( new ReteTuple( this.workingMemory.getFactHandleFactory().newFactHandle( "other cheese", false, null ) ),
+        this.node.assertTuple( new LeftTuple( this.workingMemory.getFactHandleFactory().newFactHandle( "other cheese", false, null ) ),
                                this.context,
                                this.workingMemory );
 
@@ -152,11 +151,11 @@
     }
 
     /**
-     * Test method for {@link org.drools.reteoo.AccumulateNode#assertTuple(org.drools.reteoo.ReteTuple, org.drools.spi.PropagationContext, org.drools.reteoo.ReteooWorkingMemory)}.
+     * Test method for {@link org.drools.reteoo.AccumulateNode#assertTuple(org.drools.reteoo.LeftTuple, org.drools.spi.PropagationContext, org.drools.reteoo.ReteooWorkingMemory)}.
      */
     public void testAssertTuple() {
         final DefaultFactHandle f0 = (DefaultFactHandle) this.workingMemory.getFactHandleFactory().newFactHandle( "cheese", false, null );
-        final ReteTuple tuple0 = new ReteTuple( f0 );
+        final LeftTuple tuple0 = new LeftTuple( f0 );
 
         // assert tuple, should add one to left memory
         this.node.assertTuple( tuple0,
@@ -164,25 +163,25 @@
                                this.workingMemory );
         // check memories 
         assertEquals( 1,
-                      this.memory.getTupleMemory().size() );
+                      this.memory.getLeftTupleMemory().size() );
         assertEquals( 0,
-                      this.memory.getFactHandleMemory().size() );
+                      this.memory.getRightTupleMemory().size() );
         Assert.assertTrue( "An empty matching objects list should be propagated",
                            this.accumulator.getMatchingObjects().isEmpty() );
 
         // assert tuple, should add left memory 
         final DefaultFactHandle f1 = (DefaultFactHandle) this.workingMemory.getFactHandleFactory().newFactHandle( "other cheese", false, null );
 
-        final ReteTuple tuple1 = new ReteTuple( f1 );
+        final LeftTuple tuple1 = new LeftTuple( f1 );
         this.node.assertTuple( tuple1,
                                this.context,
                                this.workingMemory );
         assertEquals( 2,
-                      this.memory.getTupleMemory().size() );
+                      this.memory.getLeftTupleMemory().size() );
         Assert.assertTrue( "An empty matching objects list should be propagated",
                            this.accumulator.getMatchingObjects().isEmpty() );
 
-        final TupleMemory memory = this.memory.getTupleMemory();
+        final LeftTupleMemory memory = this.memory.getLeftTupleMemory();
         assertTrue( memory.contains( tuple0 ) );
         assertTrue( memory.contains( tuple1 ) );
 
@@ -192,18 +191,18 @@
     }
 
     /**
-     * Test method for {@link org.drools.reteoo.AccumulateNode#assertTuple(org.drools.reteoo.ReteTuple, org.drools.spi.PropagationContext, org.drools.reteoo.ReteooWorkingMemory)}.
+     * Test method for {@link org.drools.reteoo.AccumulateNode#assertTuple(org.drools.reteoo.LeftTuple, org.drools.spi.PropagationContext, org.drools.reteoo.ReteooWorkingMemory)}.
      */
     public void testAssertTupleWithObjects() {
         final DefaultFactHandle f0 = (DefaultFactHandle) this.workingMemory.getFactHandleFactory().newFactHandle( "cheese", false, null );
         final DefaultFactHandle f1 = (DefaultFactHandle) this.workingMemory.getFactHandleFactory().newFactHandle( "other cheese", false, null );
 
-        final ReteTuple tuple0 = new ReteTuple( f0 );
+        final LeftTuple tuple0 = new LeftTuple( f0 );
 
-        this.node.assertObject( f0,
+        this.node.assertRightTuple( f0,
                                 this.context,
                                 this.workingMemory );
-        this.node.assertObject( f1,
+        this.node.assertRightTuple( f1,
                                 this.context,
                                 this.workingMemory );
 
@@ -213,25 +212,25 @@
                                this.workingMemory );
         // check memories 
         assertEquals( 1,
-                      this.memory.getTupleMemory().size() );
+                      this.memory.getLeftTupleMemory().size() );
         assertEquals( 2,
-                      this.memory.getFactHandleMemory().size() );
+                      this.memory.getRightTupleMemory().size() );
         Assert.assertEquals( "Wrong number of elements in matching objects list ",
                              2,
                              this.accumulator.getMatchingObjects().size() );
 
         // assert tuple, should add left memory 
-        final ReteTuple tuple1 = new ReteTuple( f1 );
+        final LeftTuple tuple1 = new LeftTuple( f1 );
         this.node.assertTuple( tuple1,
                                this.context,
                                this.workingMemory );
         assertEquals( 2,
-                      this.memory.getTupleMemory().size() );
+                      this.memory.getLeftTupleMemory().size() );
         Assert.assertEquals( "Wrong number of elements in matching objects list ",
                              2,
                              this.accumulator.getMatchingObjects().size() );
 
-        final TupleMemory memory = this.memory.getTupleMemory();
+        final LeftTupleMemory memory = this.memory.getLeftTupleMemory();
         assertTrue( memory.contains( tuple0 ) );
         assertTrue( memory.contains( tuple1 ) );
 
@@ -241,12 +240,12 @@
     }
 
     /**
-     * Test method for {@link org.drools.reteoo.AccumulateNode#retractTuple(org.drools.reteoo.ReteTuple, org.drools.spi.PropagationContext, org.drools.reteoo.ReteooWorkingMemory)}.
+     * Test method for {@link org.drools.reteoo.AccumulateNode#retractTuple(org.drools.reteoo.LeftTuple, org.drools.spi.PropagationContext, org.drools.reteoo.ReteooWorkingMemory)}.
      */
     public void testRetractTuple() {
         final DefaultFactHandle f0 = (DefaultFactHandle) this.workingMemory.getFactHandleFactory().newFactHandle( "cheese", false, null );
 
-        final ReteTuple tuple0 = new ReteTuple( f0 );
+        final LeftTuple tuple0 = new LeftTuple( f0 );
 
         // assert tuple, should add one to left memory
         this.node.assertTuple( tuple0,
@@ -254,9 +253,9 @@
                                this.workingMemory );
         // check memories 
         assertEquals( 1,
-                      this.memory.getTupleMemory().size() );
+                      this.memory.getLeftTupleMemory().size() );
         assertEquals( 0,
-                      this.memory.getFactHandleMemory().size() );
+                      this.memory.getRightTupleMemory().size() );
         Assert.assertTrue( "An empty matching objects list should be propagated",
                            this.accumulator.getMatchingObjects().isEmpty() );
 
@@ -264,7 +263,7 @@
                                 this.context,
                                 this.workingMemory );
         assertEquals( 0,
-                      this.memory.getTupleMemory().size() );
+                      this.memory.getLeftTupleMemory().size() );
         assertEquals( 1,
                       this.sink.getRetracted().size() );
         assertEquals( 1,
@@ -272,13 +271,13 @@
     }
 
     /**
-     * Test method for {@link org.drools.reteoo.AccumulateNode#assertObject(InternalFactHandle, org.drools.spi.PropagationContext, InternalWorkingMemory)}.
+     * Test method for {@link org.drools.reteoo.AccumulateNode#assertRightTuple(RightTuple, org.drools.spi.PropagationContext, InternalWorkingMemory)}.
      */
     public void testAssertObject() {
         final DefaultFactHandle f0 = (DefaultFactHandle) this.workingMemory.getFactHandleFactory().newFactHandle( "cheese", false, null );
         final DefaultFactHandle f1 = (DefaultFactHandle) this.workingMemory.getFactHandleFactory().newFactHandle( "other cheese", false, null );
 
-        final ReteTuple tuple0 = new ReteTuple( f0 );
+        final LeftTuple tuple0 = new LeftTuple( f0 );
 
         // assert tuple, should add one to left memory
         this.node.assertTuple( tuple0,
@@ -287,28 +286,28 @@
 
         // check memory 
         assertEquals( 1,
-                      this.memory.getTupleMemory().size() );
+                      this.memory.getLeftTupleMemory().size() );
         assertEquals( 1,
                       this.sink.getAsserted().size() );
         assertEquals( 0,
                       this.accumulator.getMatchingObjects().size() );
 
-        this.node.assertObject( f0,
+        this.node.assertRightTuple( f0,
                                 this.context,
                                 this.workingMemory );
         assertEquals( 1,
-                      this.memory.getFactHandleMemory().size() );
+                      this.memory.getRightTupleMemory().size() );
         assertEquals( 2,
                       this.sink.getAsserted().size() );
         assertEquals( 1,
                       this.accumulator.getMatchingObjects().size() );
 
-        this.node.assertObject( f1,
+        this.node.assertRightTuple( f1,
                                 this.context,
                                 this.workingMemory );
 
         assertEquals( 2,
-                      this.memory.getFactHandleMemory().size() );
+                      this.memory.getRightTupleMemory().size() );
         assertEquals( 3,
                       this.sink.getAsserted().size() );
         assertEquals( 2,
@@ -317,22 +316,22 @@
     }
 
     /**
-     * Test method for {@link org.drools.reteoo.AccumulateNode#retractObject(InternalFactHandle, org.drools.spi.PropagationContext, InternalWorkingMemory)}.
+     * Test method for {@link org.drools.reteoo.AccumulateNode#retractRightTuple(RightTuple, org.drools.spi.PropagationContext, InternalWorkingMemory)}.
      */
     public void testRetractObject() {
         final DefaultFactHandle f0 = (DefaultFactHandle) this.workingMemory.getFactHandleFactory().newFactHandle( "cheese", false, null );
         final DefaultFactHandle f1 = (DefaultFactHandle) this.workingMemory.getFactHandleFactory().newFactHandle( "other cheese", false, null );
 
-        final ReteTuple tuple0 = new ReteTuple( f0 );
+        final LeftTuple tuple0 = new LeftTuple( f0 );
 
-        this.node.assertObject( f0,
+        this.node.assertRightTuple( f0,
                                 this.context,
                                 this.workingMemory );
-        this.node.assertObject( f1,
+        this.node.assertRightTuple( f1,
                                 this.context,
                                 this.workingMemory );
         assertEquals( 2,
-                      this.memory.getFactHandleMemory().size() );
+                      this.memory.getRightTupleMemory().size() );
 
         // assert tuple, should add one to left memory
         this.node.assertTuple( tuple0,
@@ -341,7 +340,7 @@
 
         // check memory 
         assertEquals( 1,
-                      this.memory.getTupleMemory().size() );
+                      this.memory.getLeftTupleMemory().size() );
         assertEquals( 0,
                       this.sink.getRetracted().size() );
         assertEquals( 1,
@@ -349,11 +348,11 @@
         assertEquals( 2,
                       this.accumulator.getMatchingObjects().size() );
 
-        this.node.retractObject( f1,
+        this.node.retractRightTuple( f1,
                                  this.context,
                                  this.workingMemory );
         assertEquals( 1,
-                      this.memory.getFactHandleMemory().size() );
+                      this.memory.getRightTupleMemory().size() );
         assertEquals( 1,
                       this.sink.getRetracted().size() );
         assertEquals( 2,
@@ -361,11 +360,11 @@
         assertEquals( 1,
                       this.accumulator.getMatchingObjects().size() );
 
-        this.node.retractObject( f0,
+        this.node.retractRightTuple( f0,
                                  this.context,
                                  this.workingMemory );
         assertEquals( 0,
-                      this.memory.getFactHandleMemory().size() );
+                      this.memory.getRightTupleMemory().size() );
         assertEquals( 2,
                       this.sink.getRetracted().size() );
         assertEquals( 3,
@@ -434,12 +433,12 @@
         final DefaultFactHandle f0 = (DefaultFactHandle) this.workingMemory.getFactHandleFactory().newFactHandle( "cheese", false, null );
         final DefaultFactHandle f1 = (DefaultFactHandle) this.workingMemory.getFactHandleFactory().newFactHandle( "other cheese", false, null );
 
-        final ReteTuple tuple0 = new ReteTuple( f0 );
+        final LeftTuple tuple0 = new LeftTuple( f0 );
 
-        this.node.assertObject( f0,
+        this.node.assertRightTuple( f0,
                                 this.context,
                                 this.workingMemory );
-        this.node.assertObject( f1,
+        this.node.assertRightTuple( f1,
                                 this.context,
                                 this.workingMemory );
 
@@ -448,19 +447,19 @@
                                this.context,
                                this.workingMemory );
         // check memories 
-        assertNull( this.memory.getTupleMemory() );
+        assertNull( this.memory.getLeftTupleMemory() );
         assertEquals( 2,
-                      this.memory.getFactHandleMemory().size() );
+                      this.memory.getRightTupleMemory().size() );
         Assert.assertEquals( "Wrong number of elements in matching objects list ",
                              2,
                              this.accumulator.getMatchingObjects().size() );
 
         // assert tuple, should not add left memory 
-        final ReteTuple tuple1 = new ReteTuple( f1 );
+        final LeftTuple tuple1 = new LeftTuple( f1 );
         this.node.assertTuple( tuple1,
                                this.context,
                                this.workingMemory );
-        assertNull( this.memory.getTupleMemory() );
+        assertNull( this.memory.getLeftTupleMemory() );
         Assert.assertEquals( "Wrong number of elements in matching objects list ",
                              2,
                              this.accumulator.getMatchingObjects().size() );

Modified: labs/jbossrules/branches/righttuple/drools-core/src/test/java/org/drools/reteoo/AgendaTest.java
===================================================================
--- labs/jbossrules/branches/righttuple/drools-core/src/test/java/org/drools/reteoo/AgendaTest.java	2008-01-04 00:57:26 UTC (rev 17532)
+++ labs/jbossrules/branches/righttuple/drools-core/src/test/java/org/drools/reteoo/AgendaTest.java	2008-01-04 01:54:45 UTC (rev 17533)
@@ -84,7 +84,7 @@
                                                              rule2.getLhs(),
                                                              buildContext );        
 
-        final ReteTuple tuple = new ReteTuple( new DefaultFactHandle( 1,
+        final LeftTuple tuple = new LeftTuple( new DefaultFactHandle( 1,
                                                                       "cheese" ) );
 
         final PropagationContext context1 = new PropagationContextImpl( 0,
@@ -178,7 +178,7 @@
             }
         } );
 
-        final ReteTuple tuple = new ReteTuple( new DefaultFactHandle( 1,
+        final LeftTuple tuple = new LeftTuple( new DefaultFactHandle( 1,
                                                                       "cheese" ) );
         final PropagationContext context = new PropagationContextImpl( 0,
                                                                        PropagationContext.ASSERTION,
@@ -256,7 +256,7 @@
             }
         };
 
-        final ReteTuple tuple = new ReteTuple( new DefaultFactHandle( 1,
+        final LeftTuple tuple = new LeftTuple( new DefaultFactHandle( 1,
                                                                       "cheese" ) );
 
         // create a rule for each agendaGroup
@@ -485,7 +485,7 @@
             }
         };
 
-        final ReteTuple tuple = new ReteTuple( new DefaultFactHandle( 1,
+        final LeftTuple tuple = new LeftTuple( new DefaultFactHandle( 1,
                                                                       "cheese" ) );
 
         // create a rule for the agendaGroup
@@ -550,7 +550,7 @@
         final InternalAgendaGroup agendaGroup = new BinaryHeapQueueAgendaGroup( "agendaGroup", ruleBase );
         agenda.addAgendaGroup( agendaGroup );
 
-        final ReteTuple tuple = new ReteTuple( new DefaultFactHandle( 1,
+        final LeftTuple tuple = new LeftTuple( new DefaultFactHandle( 1,
                                                                       "cheese" ) );
 
         // create a rule for the agendaGroup
@@ -617,7 +617,7 @@
             }
         };
 
-        final ReteTuple tuple = new ReteTuple( new DefaultFactHandle( 1,
+        final LeftTuple tuple = new LeftTuple( new DefaultFactHandle( 1,
                                                                       "cheese" ) );
 
         // create a rule for each agendaGroup
@@ -848,25 +848,25 @@
         final RuleFlowGroup ruleFlowGroup1 = agenda.getRuleFlowGroup( "rule-flow-group-1" );
         final RuleFlowGroup ruleFlowGroup2 = agenda.getRuleFlowGroup( "rule-flow-group-2" );
 
-        final ReteTuple tuple0 = new ReteTuple( new DefaultFactHandle( 1,
+        final LeftTuple tuple0 = new LeftTuple( new DefaultFactHandle( 1,
                                                                        "cheese" ) );
         node0.assertTuple( tuple0,
                            context0,
                            workingMemory );
 
-        final ReteTuple tuple1 = new ReteTuple( new DefaultFactHandle( 1,
+        final LeftTuple tuple1 = new LeftTuple( new DefaultFactHandle( 1,
                                                                        "cheese" ) );
         node0.assertTuple( tuple1,
                            context0,
                            workingMemory );
 
-        final ReteTuple tuple2 = new ReteTuple( new DefaultFactHandle( 1,
+        final LeftTuple tuple2 = new LeftTuple( new DefaultFactHandle( 1,
                                                                        "cheese" ) );
         node1.assertTuple( tuple2,
                            context0,
                            workingMemory );
 
-        final ReteTuple tuple3 = new ReteTuple( new DefaultFactHandle( 1,
+        final LeftTuple tuple3 = new LeftTuple( new DefaultFactHandle( 1,
                                                                        "cheese" ) );
         node2.assertTuple( tuple3,
                            context0,
@@ -980,7 +980,7 @@
             public void evaluate(KnowledgeHelper knowledgeHelper,
                                  WorkingMemory w) {
                 // activate rule1
-                final ReteTuple tuple1 = new ReteTuple( new DefaultFactHandle( 1,
+                final LeftTuple tuple1 = new LeftTuple( new DefaultFactHandle( 1,
                                                                                "cheese" ) );
                 node1.assertTuple( tuple1,
                                    context0,
@@ -1001,7 +1001,7 @@
         final RuleFlowGroup ruleFlowGroup0 = agenda.getRuleFlowGroup( "rule-flow-group-0" );
 
         // Create one activation for rule0 only
-        final ReteTuple tuple0 = new ReteTuple( new DefaultFactHandle( 1,
+        final LeftTuple tuple0 = new LeftTuple( new DefaultFactHandle( 1,
                                                                        "cheese" ) );
         node0.assertTuple( tuple0,
                            context0,
@@ -1072,7 +1072,7 @@
                                                                         rule1,
                                                                         null );
 
-        final ReteTuple tuple1 = new ReteTuple( new DefaultFactHandle( 1,
+        final LeftTuple tuple1 = new LeftTuple( new DefaultFactHandle( 1,
                                                                        "cheese" ) );
 
         // create rule0
@@ -1102,7 +1102,7 @@
         final RuleFlowGroup ruleFlowGroup0 = agenda.getRuleFlowGroup( "rule-flow-group-0" );
 
         // Create an activation for both rules
-        final ReteTuple tuple0 = new ReteTuple( new DefaultFactHandle( 1,
+        final LeftTuple tuple0 = new LeftTuple( new DefaultFactHandle( 1,
                                                                        "cheese" ) );
         node0.assertTuple( tuple0,
                            context0,
@@ -1176,12 +1176,12 @@
                                                                         null );
 
         // Create two activation for this rule
-        final ReteTuple tuple0 = new ReteTuple( new DefaultFactHandle( 1,
+        final LeftTuple tuple0 = new LeftTuple( new DefaultFactHandle( 1,
                                                                        "cheese" ) );
         node0.assertTuple( tuple0,
                            context0,
                            workingMemory );
-        final ReteTuple tuple1 = new ReteTuple( new DefaultFactHandle( 1,
+        final LeftTuple tuple1 = new LeftTuple( new DefaultFactHandle( 1,
                                                                        "cheese" ) );
         node0.assertTuple( tuple1,
                            context0,
@@ -1268,7 +1268,7 @@
                                                                         null );
 
         // Create an activation for this rule
-        final ReteTuple tuple0 = new ReteTuple( new DefaultFactHandle( 1,
+        final LeftTuple tuple0 = new LeftTuple( new DefaultFactHandle( 1,
                                                                        "cheese" ) );
         node0.assertTuple( tuple0,
                            context0,
@@ -1302,7 +1302,7 @@
         assertFalse( ruleFlowGroup0.isActive() );
 
         // Add another activation and activate RuleFlowGroup again
-        final ReteTuple tuple1 = new ReteTuple( new DefaultFactHandle( 1,
+        final LeftTuple tuple1 = new LeftTuple( new DefaultFactHandle( 1,
                                                                        "cheese" ) );
         node0.assertTuple( tuple1,
                            context0,
@@ -1324,7 +1324,7 @@
         assertFalse( ruleFlowGroup0.isActive() );
 
         // A new activation should now be added to the RuleFlowGroup but not to the agenda 
-        final ReteTuple tuple2 = new ReteTuple( new DefaultFactHandle( 1,
+        final LeftTuple tuple2 = new LeftTuple( new DefaultFactHandle( 1,
                                                                        "cheese" ) );
         node0.assertTuple( tuple2,
                            context0,
@@ -1392,7 +1392,7 @@
 
         final RuleFlowGroupImpl ruleFlowGroup = (RuleFlowGroupImpl) agenda.getRuleFlowGroup( "rule-flow-group-0" );
 
-        final ReteTuple tuple = new ReteTuple( new DefaultFactHandle( 1,
+        final LeftTuple tuple = new LeftTuple( new DefaultFactHandle( 1,
                                                                       "cheese" ) );
 
         // create a rule for the agendaGroup
@@ -1457,7 +1457,7 @@
             }
         };
 
-        final ReteTuple tuple = new ReteTuple( new DefaultFactHandle( 1,
+        final LeftTuple tuple = new LeftTuple( new DefaultFactHandle( 1,
                                                                       "cheese" ) );
 
         // create a rule for each agendaGroup

Modified: labs/jbossrules/branches/righttuple/drools-core/src/test/java/org/drools/reteoo/AlphaNodeTest.java
===================================================================
--- labs/jbossrules/branches/righttuple/drools-core/src/test/java/org/drools/reteoo/AlphaNodeTest.java	2008-01-04 00:57:26 UTC (rev 17532)
+++ labs/jbossrules/branches/righttuple/drools-core/src/test/java/org/drools/reteoo/AlphaNodeTest.java	2008-01-04 01:54:45 UTC (rev 17533)
@@ -115,7 +115,7 @@
                       memory.size() );
 
         // object should assert as it passes text
-        alphaNode.assertObject( f0,
+        alphaNode.assertRightTuple( f0,
                                 context,
                                 workingMemory );
 
@@ -135,7 +135,7 @@
                                                             stilton );
 
         // object should NOT assert as it does not pass test
-        alphaNode.assertObject( f1,
+        alphaNode.assertRightTuple( f1,
                                 context,
                                 workingMemory );
 
@@ -202,7 +202,7 @@
                       memory.size() );
 
         // object should assert as it passes text
-        alphaNode.assertObject( f0,
+        alphaNode.assertRightTuple( f0,
                                 context,
                                 workingMemory );
 
@@ -264,7 +264,7 @@
                       memory.size() );
 
         // object should assert as it passes text
-        alphaNode.assertObject( f0,
+        alphaNode.assertRightTuple( f0,
                                 context,
                                 workingMemory );
 
@@ -284,7 +284,7 @@
                                                             stilton );
 
         // object should NOT assert as it does not pass test
-        alphaNode.assertObject( f1,
+        alphaNode.assertRightTuple( f1,
                                 context,
                                 workingMemory );
 
@@ -351,7 +351,7 @@
                       memory.size() );
 
         // object should assert as it passes text
-        alphaNode.assertObject( f0,
+        alphaNode.assertRightTuple( f0,
                                 context,
                                 workingMemory );
 
@@ -369,7 +369,7 @@
                                                             stilton );
 
         // object should NOT assert as it does not pass test
-        alphaNode.assertObject( f1,
+        alphaNode.assertRightTuple( f1,
                                 context,
                                 workingMemory );
 
@@ -430,7 +430,7 @@
                       sink.getAsserted() );
 
         // object should assert as it passes text
-        alphaNode.assertObject( f0,
+        alphaNode.assertRightTuple( f0,
                                 context,
                                 workingMemory );
 
@@ -447,7 +447,7 @@
         sink.getAsserted().clear();
 
         // object should not assert as it does not pass text
-        alphaNode.assertObject( f0,
+        alphaNode.assertRightTuple( f0,
                                 context,
                                 workingMemory );
 
@@ -502,7 +502,7 @@
                       memory.size() );
 
         // object should assert as it passes text
-        alphaNode.assertObject( f0,
+        alphaNode.assertRightTuple( f0,
                                 context,
                                 workingMemory );
 
@@ -513,7 +513,7 @@
                                                             "cheese" );
 
         // object should NOT retract as it doesn't exist
-        alphaNode.retractObject( f1,
+        alphaNode.retractRightTuple( f1,
                                  context,
                                  workingMemory );
 
@@ -525,7 +525,7 @@
                     memory.contains( f0 ) );
 
         // object should retract as it does exist
-        alphaNode.retractObject( f0,
+        alphaNode.retractRightTuple( f0,
                                  context,
                                  workingMemory );
 
@@ -585,7 +585,7 @@
                       memory.size() );
 
         // object should assert as it passes text
-        alphaNode.assertObject( f0,
+        alphaNode.assertRightTuple( f0,
                                 context,
                                 workingMemory );
 
@@ -597,7 +597,7 @@
                                                                         10 ) );
 
         // object should NOT retract as it doesn't exist
-        alphaNode.retractObject( f1,
+        alphaNode.retractRightTuple( f1,
                                  context,
                                  workingMemory );
 
@@ -610,7 +610,7 @@
                      memory.contains( f0 ) );
 
         // object should retract as it does exist
-        alphaNode.retractObject( f0,
+        alphaNode.retractRightTuple( f0,
                                  context,
                                  workingMemory );
 
@@ -673,7 +673,7 @@
         final DefaultFactHandle handle1 = new DefaultFactHandle( 1,
                                                                  cheese );
 
-        alphaNode.assertObject( handle1,
+        alphaNode.assertRightTuple( handle1,
                                 context,
                                 workingMemory );
 
@@ -685,7 +685,7 @@
         // adding handle to the mock source
         source.addFact( handle2 );
 
-        alphaNode.assertObject( handle2,
+        alphaNode.assertRightTuple( handle2,
                                 context,
                                 workingMemory );
         assertLength( 1,
@@ -758,7 +758,7 @@
         // adding handle to the mock source
         source.addFact( handle1 );
 
-        alphaNode.assertObject( handle1,
+        alphaNode.assertRightTuple( handle1,
                                 context,
                                 workingMemory );
 
@@ -770,7 +770,7 @@
         // adding handle to the mock source
         source.addFact( handle2 );
 
-        alphaNode.assertObject( handle2,
+        alphaNode.assertRightTuple( handle2,
                                 context,
                                 workingMemory );
 

Modified: labs/jbossrules/branches/righttuple/drools-core/src/test/java/org/drools/reteoo/BetaNodeTest.java
===================================================================
--- labs/jbossrules/branches/righttuple/drools-core/src/test/java/org/drools/reteoo/BetaNodeTest.java	2008-01-04 00:57:26 UTC (rev 17532)
+++ labs/jbossrules/branches/righttuple/drools-core/src/test/java/org/drools/reteoo/BetaNodeTest.java	2008-01-04 01:54:45 UTC (rev 17533)
@@ -46,8 +46,8 @@
      * Test method for {@link org.drools.reteoo.BetaNode#equals(java.lang.Object)}.
      */
     public void testEqualsObject() {
-        final TupleSource ts = new MockTupleSource( 1 );
-        final ObjectSource os = new MockObjectSource( 2 );
+        final LeftTupleSource ts = new MockTupleSource( 1 );
+        final RightTupleSource os = new MockObjectSource( 2 );
 
         ReteooRuleBase ruleBase = ( ReteooRuleBase ) RuleBaseFactory.newRuleBase();
         BuildContext buildContext = new BuildContext( ruleBase, ruleBase.getReteooBuilder().getIdGenerator() );        

Modified: labs/jbossrules/branches/righttuple/drools-core/src/test/java/org/drools/reteoo/CollectNodeTest.java
===================================================================
--- labs/jbossrules/branches/righttuple/drools-core/src/test/java/org/drools/reteoo/CollectNodeTest.java	2008-01-04 00:57:26 UTC (rev 17532)
+++ labs/jbossrules/branches/righttuple/drools-core/src/test/java/org/drools/reteoo/CollectNodeTest.java	2008-01-04 01:54:45 UTC (rev 17533)
@@ -105,9 +105,9 @@
 
         // check memories are empty
         assertEquals( 0,
-                      this.memory.getTupleMemory().size() );
+                      this.memory.getLeftTupleMemory().size() );
         assertEquals( 0,
-                      this.memory.getFactHandleMemory().size() );
+                      this.memory.getRightTupleMemory().size() );
     }
 
     /* (non-Javadoc)
@@ -125,10 +125,10 @@
                              0,
                              this.sink.getAsserted().size() );
 
-        this.node.assertTuple( new ReteTuple( this.workingMemory.getFactHandleFactory().newFactHandle( "cheese", false, null ) ),
+        this.node.assertTuple( new LeftTuple( this.workingMemory.getFactHandleFactory().newFactHandle( "cheese", false, null ) ),
                                this.contextAssert,
                                this.workingMemory );
-        this.node.assertTuple( new ReteTuple( this.workingMemory.getFactHandleFactory().newFactHandle( "other cheese", false, null ) ),
+        this.node.assertTuple( new LeftTuple( this.workingMemory.getFactHandleFactory().newFactHandle( "other cheese", false, null ) ),
                                this.contextAssert,
                                this.workingMemory );
 
@@ -150,7 +150,7 @@
 
     public void testAssertTuple() {
         final DefaultFactHandle f0 = (DefaultFactHandle) this.workingMemory.getFactHandleFactory().newFactHandle( "cheese", false, null );
-        final ReteTuple tuple0 = new ReteTuple( f0 );
+        final LeftTuple tuple0 = new LeftTuple( f0 );
 
         // assert tuple, should add one to left memory
         this.node.assertTuple( tuple0,
@@ -158,26 +158,26 @@
                                this.workingMemory );
         // check memories 
         assertEquals( 1,
-                      this.memory.getTupleMemory().size() );
+                      this.memory.getLeftTupleMemory().size() );
         assertEquals( 0,
-                      this.memory.getFactHandleMemory().size() );
+                      this.memory.getRightTupleMemory().size() );
         Assert.assertTrue( "An empty collection should be propagated",
                            ((Collection) ((DefaultFactHandle) ((Tuple) ((Object[]) this.sink.getAsserted().get( 0 ))[0]).get( 1 )).getObject()).isEmpty() );
 
         // assert tuple, should add left memory 
         final DefaultFactHandle f1 = (DefaultFactHandle) this.workingMemory.getFactHandleFactory().newFactHandle( "other cheese", false, null );
 
-        final ReteTuple tuple1 = new ReteTuple( f1 );
+        final LeftTuple tuple1 = new LeftTuple( f1 );
         this.node.assertTuple( tuple1,
                                this.contextAssert,
                                this.workingMemory );
         assertEquals( 2,
-                      this.memory.getTupleMemory().size() );
+                      this.memory.getLeftTupleMemory().size() );
         Assert.assertTrue( "An empty collection should be propagated",
                            ((Collection) ((DefaultFactHandle) ((Tuple) ((Object[]) this.sink.getAsserted().get( 1 ))[0]).get( 1 )).getObject()).isEmpty() );
 
-        assertTrue( this.memory.getTupleMemory().contains( tuple0 ) );
-        assertTrue( this.memory.getTupleMemory().contains( tuple1 ) );
+        assertTrue( this.memory.getLeftTupleMemory().contains( tuple0 ) );
+        assertTrue( this.memory.getLeftTupleMemory().contains( tuple1 ) );
 
         Assert.assertEquals( "Two tuples should have been propagated",
                              2,
@@ -188,12 +188,12 @@
         final DefaultFactHandle f0 = (DefaultFactHandle) this.workingMemory.getFactHandleFactory().newFactHandle( "cheese", false, null );
         final DefaultFactHandle f1 = (DefaultFactHandle) this.workingMemory.getFactHandleFactory().newFactHandle( "other cheese", false, null );
 
-        final ReteTuple tuple0 = new ReteTuple( f0 );
+        final LeftTuple tuple0 = new LeftTuple( f0 );
 
-        this.node.assertObject( f0,
+        this.node.assertRightTuple( f0,
                                 this.contextAssert,
                                 this.workingMemory );
-        this.node.assertObject( f1,
+        this.node.assertRightTuple( f1,
                                 this.contextAssert,
                                 this.workingMemory );
 
@@ -203,26 +203,26 @@
                                this.workingMemory );
         // check memories 
         assertEquals( 1,
-                      this.memory.getTupleMemory().size() );
+                      this.memory.getLeftTupleMemory().size() );
         assertEquals( 2,
-                      this.memory.getFactHandleMemory().size() );
+                      this.memory.getRightTupleMemory().size() );
         Assert.assertEquals( "Wrong number of elements in matching objects list ",
                              2,
                              ((Collection) ((DefaultFactHandle) ((Tuple) ((Object[]) this.sink.getAsserted().get( 0 ))[0]).get( 1 )).getObject()).size() );
 
         // assert tuple, should add left memory 
-        final ReteTuple tuple1 = new ReteTuple( f1 );
+        final LeftTuple tuple1 = new LeftTuple( f1 );
         this.node.assertTuple( tuple1,
                                this.contextAssert,
                                this.workingMemory );
         assertEquals( 2,
-                      this.memory.getTupleMemory().size() );
+                      this.memory.getLeftTupleMemory().size() );
         Assert.assertEquals( "Wrong number of elements in matching objects list ",
                              2,
                              ((Collection) ((DefaultFactHandle) ((Tuple) ((Object[]) this.sink.getAsserted().get( 1 ))[0]).get( 1 )).getObject()).size() );
 
-        assertTrue( this.memory.getTupleMemory().contains( tuple0 ) );
-        assertTrue( this.memory.getTupleMemory().contains( tuple1 ) );
+        assertTrue( this.memory.getLeftTupleMemory().contains( tuple0 ) );
+        assertTrue( this.memory.getLeftTupleMemory().contains( tuple1 ) );
 
         Assert.assertEquals( "Two tuples should have been propagated",
                              2,
@@ -232,7 +232,7 @@
     public void testRetractTuple() {
         final DefaultFactHandle f0 = (DefaultFactHandle) this.workingMemory.getFactHandleFactory().newFactHandle( "cheese", false, null );
 
-        final ReteTuple tuple0 = new ReteTuple( f0 );
+        final LeftTuple tuple0 = new LeftTuple( f0 );
 
         // assert tuple, should add one to left memory
         this.node.assertTuple( tuple0,
@@ -240,9 +240,9 @@
                                this.workingMemory );
         // check memories 
         assertEquals( 1,
-                      this.memory.getTupleMemory().size() );
+                      this.memory.getLeftTupleMemory().size() );
         assertEquals( 0,
-                      this.memory.getFactHandleMemory().size() );
+                      this.memory.getRightTupleMemory().size() );
         Assert.assertTrue( "An empty collection should be propagated",
                            ((Collection) ((DefaultFactHandle) ((Tuple) ((Object[]) this.sink.getAsserted().get( 0 ))[0]).get( 1 )).getObject()).isEmpty() );
 
@@ -250,7 +250,7 @@
                                 this.contextRetract,
                                 this.workingMemory );
         assertEquals( 0,
-                      this.memory.getTupleMemory().size() );
+                      this.memory.getLeftTupleMemory().size() );
         assertEquals( 1,
                       this.sink.getRetracted().size() );
         assertEquals( 1,
@@ -261,7 +261,7 @@
         final DefaultFactHandle f0 = (DefaultFactHandle) this.workingMemory.getFactHandleFactory().newFactHandle( "cheese", false, null );
         final DefaultFactHandle f1 = (DefaultFactHandle) this.workingMemory.getFactHandleFactory().newFactHandle( "other cheese", false, null );
 
-        final ReteTuple tuple0 = new ReteTuple( f0 );
+        final LeftTuple tuple0 = new LeftTuple( f0 );
 
         // assert tuple, should add one to left memory
         this.node.assertTuple( tuple0,
@@ -270,29 +270,29 @@
 
         // check memory 
         assertEquals( 1,
-                      this.memory.getTupleMemory().size() );
+                      this.memory.getLeftTupleMemory().size() );
         assertEquals( 1,
                       this.sink.getAsserted().size() );
         Assert.assertTrue( "An empty collection should be propagated",
                            ((Collection) ((DefaultFactHandle) ((Tuple) ((Object[]) this.sink.getAsserted().get( 0 ))[0]).get( 1 )).getObject()).isEmpty() );
 
-        this.node.assertObject( f0,
+        this.node.assertRightTuple( f0,
                                 this.contextAssert,
                                 this.workingMemory );
         assertEquals( 1,
-                      this.memory.getFactHandleMemory().size() );
+                      this.memory.getRightTupleMemory().size() );
         assertEquals( 2,
                       this.sink.getAsserted().size() );
         Assert.assertEquals( "Wrong number of elements in matching objects list ",
                              1,
                              ((Collection) ((DefaultFactHandle) ((Tuple) ((Object[]) this.sink.getAsserted().get( 1 ))[0]).get( 1 )).getObject()).size() );
 
-        this.node.assertObject( f1,
+        this.node.assertRightTuple( f1,
                                 this.contextAssert,
                                 this.workingMemory );
 
         assertEquals( 2,
-                      this.memory.getFactHandleMemory().size() );
+                      this.memory.getRightTupleMemory().size() );
         assertEquals( 3,
                       this.sink.getAsserted().size() );
         Assert.assertEquals( "Wrong number of elements in matching objects list ",
@@ -305,16 +305,16 @@
         final DefaultFactHandle f0 = (DefaultFactHandle) this.workingMemory.getFactHandleFactory().newFactHandle( "cheese", false, null );
         final DefaultFactHandle f1 = (DefaultFactHandle) this.workingMemory.getFactHandleFactory().newFactHandle( "other cheese", false, null );
 
-        final ReteTuple tuple0 = new ReteTuple( f0 );
+        final LeftTuple tuple0 = new LeftTuple( f0 );
 
-        this.node.assertObject( f0,
+        this.node.assertRightTuple( f0,
                                 this.contextAssert,
                                 this.workingMemory );
-        this.node.assertObject( f1,
+        this.node.assertRightTuple( f1,
                                 this.contextAssert,
                                 this.workingMemory );
         assertEquals( 2,
-                      this.memory.getFactHandleMemory().size() );
+                      this.memory.getRightTupleMemory().size() );
 
         // assert tuple, should add one to left memory
         this.node.assertTuple( tuple0,
@@ -323,7 +323,7 @@
 
         // check memory 
         assertEquals( 1,
-                      this.memory.getTupleMemory().size() );
+                      this.memory.getLeftTupleMemory().size() );
         assertEquals( 0,
                       this.sink.getRetracted().size() );
         assertEquals( 1,
@@ -332,11 +332,11 @@
                              2,
                              ((Collection) ((DefaultFactHandle) ((Tuple) ((Object[]) this.sink.getAsserted().get( 0 ))[0]).get( 1 )).getObject()).size() );
 
-        this.node.retractObject( f1,
+        this.node.retractRightTuple( f1,
                                  this.contextRetract,
                                  this.workingMemory );
         assertEquals( 1,
-                      this.memory.getFactHandleMemory().size() );
+                      this.memory.getRightTupleMemory().size() );
         assertEquals( 1,
                       this.sink.getRetracted().size() );
         assertEquals( 2,
@@ -345,11 +345,11 @@
                              1,
                              ((Collection) ((DefaultFactHandle) ((Tuple) ((Object[]) this.sink.getAsserted().get( 1 ))[0]).get( 1 )).getObject()).size() );
 
-        this.node.retractObject( f0,
+        this.node.retractRightTuple( f0,
                                  this.contextRetract,
                                  this.workingMemory );
         assertEquals( 0,
-                      this.memory.getFactHandleMemory().size() );
+                      this.memory.getRightTupleMemory().size() );
         assertEquals( 2,
                       this.sink.getRetracted().size() );
         assertEquals( 3,
@@ -398,12 +398,12 @@
         final DefaultFactHandle f0 = (DefaultFactHandle) this.workingMemory.getFactHandleFactory().newFactHandle( "cheese", false, null );
         final DefaultFactHandle f1 = (DefaultFactHandle) this.workingMemory.getFactHandleFactory().newFactHandle( "other cheese", false, null );
 
-        final ReteTuple tuple0 = new ReteTuple( f0 );
+        final LeftTuple tuple0 = new LeftTuple( f0 );
 
-        this.node.assertObject( f0,
+        this.node.assertRightTuple( f0,
                                 this.contextAssert,
                                 this.workingMemory );
-        this.node.assertObject( f1,
+        this.node.assertRightTuple( f1,
                                 this.contextAssert,
                                 this.workingMemory );
 
@@ -412,19 +412,19 @@
                                this.contextAssert,
                                this.workingMemory );
         // check memories 
-        assertNull( this.memory.getTupleMemory() );
+        assertNull( this.memory.getLeftTupleMemory() );
         assertEquals( 2,
-                      this.memory.getFactHandleMemory().size() );
+                      this.memory.getRightTupleMemory().size() );
         Assert.assertEquals( "Wrong number of elements in matching objects list ",
                              2,
                              ((Collection) ((DefaultFactHandle) ((Tuple) ((Object[]) this.sink.getAsserted().get( 0 ))[0]).get( 1 )).getObject()).size() );
 
         // assert tuple, should not add to left memory, since we are in sequential mode
-        final ReteTuple tuple1 = new ReteTuple( f1 );
+        final LeftTuple tuple1 = new LeftTuple( f1 );
         this.node.assertTuple( tuple1,
                                this.contextAssert,
                                this.workingMemory );
-        assertNull( this.memory.getTupleMemory() );
+        assertNull( this.memory.getLeftTupleMemory() );
         Assert.assertEquals( "Wrong number of elements in matching objects list ",
                              2,
                              ((Collection) ((DefaultFactHandle) ((Tuple) ((Object[]) this.sink.getAsserted().get( 1 ))[0]).get( 1 )).getObject()).size() );

Modified: labs/jbossrules/branches/righttuple/drools-core/src/test/java/org/drools/reteoo/CompositeObjectSinkAdapterTest.java
===================================================================
--- labs/jbossrules/branches/righttuple/drools-core/src/test/java/org/drools/reteoo/CompositeObjectSinkAdapterTest.java	2008-01-04 00:57:26 UTC (rev 17532)
+++ labs/jbossrules/branches/righttuple/drools-core/src/test/java/org/drools/reteoo/CompositeObjectSinkAdapterTest.java	2008-01-04 01:54:45 UTC (rev 17533)
@@ -38,7 +38,7 @@
     public String wah;
 
     public void testBeta() {
-        final CompositeObjectSinkAdapter ad = new CompositeObjectSinkAdapter();
+        final CompositeRightTupleSinkAdapter ad = new CompositeRightTupleSinkAdapter();
         final MockBetaNode beta = new MockBetaNode( buildContext.getNextId(),
                                                     null,
                                                     null );
@@ -64,7 +64,7 @@
     }
 
     public void testAlphaWithPredicate() {
-        final CompositeObjectSinkAdapter ad = new CompositeObjectSinkAdapter();
+        final CompositeRightTupleSinkAdapter ad = new CompositeRightTupleSinkAdapter();
         final AlphaNode al = new AlphaNode( buildContext.getNextId(),
                                             new PredicateConstraint( null,
                                                                      null ),
@@ -88,7 +88,7 @@
 
     public void testSingleAlpha() {
 
-        final CompositeObjectSinkAdapter ad = new CompositeObjectSinkAdapter();
+        final CompositeRightTupleSinkAdapter ad = new CompositeRightTupleSinkAdapter();
         final LiteralConstraint lit = new LiteralConstraint( new MockExtractor(),
                                                              equals.getEvaluator( ValueType.STRING_TYPE, Operator.EQUAL ),
                                                              new ObjectFieldImpl( "stilton" ) );
@@ -114,7 +114,7 @@
 
     public void testDoubleAlphaWithBeta() {
 
-        final CompositeObjectSinkAdapter ad = new CompositeObjectSinkAdapter();
+        final CompositeRightTupleSinkAdapter ad = new CompositeRightTupleSinkAdapter();
         final LiteralConstraint lit = new LiteralConstraint( new MockExtractor(),
                                                              equals.getEvaluator( ValueType.STRING_TYPE, Operator.EQUAL ),
                                                              new ObjectFieldImpl( "stilton" ) );
@@ -172,7 +172,7 @@
     }
 
     public void testTripleAlpha() {
-        final CompositeObjectSinkAdapter ad = new CompositeObjectSinkAdapter();
+        final CompositeRightTupleSinkAdapter ad = new CompositeRightTupleSinkAdapter();
         FieldExtractor extractor = ClassFieldExtractorCache.getInstance().getExtractor( Cheese.class,
                                                                                         "type",
                                                                                         this.getClass().getClassLoader() );
@@ -231,7 +231,7 @@
     }
 
     public void testTripleAlphaCharacterConstraint() {
-        final CompositeObjectSinkAdapter ad = new CompositeObjectSinkAdapter();
+        final CompositeRightTupleSinkAdapter ad = new CompositeRightTupleSinkAdapter();
         FieldExtractor extractor = ClassFieldExtractorCache.getInstance().getExtractor( Cheese.class,
                                                                                         "charType",
                                                                                         this.getClass().getClassLoader() );
@@ -283,13 +283,13 @@
         // test propagation
         Cheese cheese = new Cheese();
         cheese.setCharType( 'B' );
-        CompositeObjectSinkAdapter.HashKey hashKey = new CompositeObjectSinkAdapter.HashKey();
+        CompositeRightTupleSinkAdapter.HashKey hashKey = new CompositeRightTupleSinkAdapter.HashKey();
         
         // should find this
         hashKey.setValue( extractor.getIndex(),
                           cheese,
                           extractor );
-        ObjectSink sink = (ObjectSink) ad.hashedSinkMap.get( hashKey );
+        RightTupleSink sink = (RightTupleSink) ad.hashedSinkMap.get( hashKey );
         assertSame( al2, sink );
 
         // should not find this one
@@ -297,7 +297,7 @@
         hashKey.setValue( extractor.getIndex(),
                           cheese,
                           extractor );
-        sink = (ObjectSink) ad.hashedSinkMap.get( hashKey );
+        sink = (RightTupleSink) ad.hashedSinkMap.get( hashKey );
         assertNull( sink );
 
         //now remove one, check the hashing is undone
@@ -311,7 +311,7 @@
 
     public void testPropagationWithNullValue() {
 
-        final CompositeObjectSinkAdapter ad = new CompositeObjectSinkAdapter();
+        final CompositeRightTupleSinkAdapter ad = new CompositeRightTupleSinkAdapter();
         FieldExtractor extractor = ClassFieldExtractorCache.getInstance().getExtractor( Cheese.class,
                                                                                         "type",
                                                                                         this.getClass().getClassLoader() );
@@ -345,7 +345,7 @@
 
         InternalFactHandle handle = new ReteooFactHandleFactory().newFactHandle( new Cheese(), false, null );
         try {
-            ad.propagateAssertObject( handle,
+            ad.propagateAssertRightTuple( handle,
                                       null,
                                       null );
         } catch ( RuntimeException e ) {
@@ -463,8 +463,8 @@
     static class MockBetaNode extends BetaNode {
 
         MockBetaNode(final int id,
-                     final TupleSource leftInput,
-                     final ObjectSource rightInput) {
+                     final LeftTupleSource leftInput,
+                     final RightTupleSource rightInput) {
             super( id,
                    leftInput,
                    rightInput,
@@ -472,35 +472,35 @@
             //  Auto-generated constructor stub
         }
 
-        public void updateSink(final TupleSink sink,
+        public void updateSink(final LeftTupleSink sink,
                                final PropagationContext context,
                                final InternalWorkingMemory workingMemory) {
             //  Auto-generated method stub
 
         }
 
-        public void assertTuple(final ReteTuple tuple,
+        public void assertTuple(final LeftTuple tuple,
                                 final PropagationContext context,
                                 final InternalWorkingMemory workingMemory) {
             //  Auto-generated method stub
 
         }
 
-        public void retractTuple(final ReteTuple tuple,
+        public void retractTuple(final LeftTuple tuple,
                                  final PropagationContext context,
                                  final InternalWorkingMemory workingMemory) {
             //  Auto-generated method stub
 
         }
 
-        public void assertObject(final InternalFactHandle handle,
+        public void assertRightTuple(final RightTuple rightTuple,
                                  final PropagationContext context,
                                  final InternalWorkingMemory workingMemory) {
             //  Auto-generated method stub
 
         }
 
-        public void retractObject(final InternalFactHandle handle,
+        public void retractRightTuple(final RightTuple rightTuple,
                                   final PropagationContext context,
                                   final InternalWorkingMemory workingMemory) {
             //  Auto-generated method stub

Modified: labs/jbossrules/branches/righttuple/drools-core/src/test/java/org/drools/reteoo/EvalConditionNodeTest.java
===================================================================
--- labs/jbossrules/branches/righttuple/drools-core/src/test/java/org/drools/reteoo/EvalConditionNodeTest.java	2008-01-04 00:57:26 UTC (rev 17532)
+++ labs/jbossrules/branches/righttuple/drools-core/src/test/java/org/drools/reteoo/EvalConditionNodeTest.java	2008-01-04 01:54:45 UTC (rev 17533)
@@ -105,7 +105,7 @@
         // Create the Tuple
         final DefaultFactHandle f0 = new DefaultFactHandle( 0,
                                                             "stilton" );
-        final ReteTuple tuple0 = new ReteTuple( f0 );
+        final LeftTuple tuple0 = new LeftTuple( f0 );
 
         // Tuple should pass and propagate 
         node.assertTuple( tuple0,
@@ -115,7 +115,7 @@
         // Create the Tuple
         final DefaultFactHandle f1 = new DefaultFactHandle( 1,
                                                             "cheddar" );
-        final ReteTuple tuple1 = new ReteTuple( f1 );
+        final LeftTuple tuple1 = new LeftTuple( f1 );
 
         // Tuple should pass and propagate 
         node.assertTuple( tuple1,
@@ -151,7 +151,7 @@
         // Create the Tuple
         final DefaultFactHandle f0 = new DefaultFactHandle( 0,
                                                             "stilton" );
-        final ReteTuple tuple0 = new ReteTuple( f0 );
+        final LeftTuple tuple0 = new LeftTuple( f0 );
 
         // Tuple should pass and propagate 
         node.assertTuple( tuple0,
@@ -162,7 +162,7 @@
         // Create the Tuple
         final DefaultFactHandle f1 = new DefaultFactHandle( 1,
                                                             "cheddar" );
-        final ReteTuple tuple1 = new ReteTuple( f1 );
+        final LeftTuple tuple1 = new LeftTuple( f1 );
 
         // Tuple should pass and propagate 
         node.assertTuple( tuple1,
@@ -225,7 +225,7 @@
         // Create the Tuple
         final DefaultFactHandle f0 = new DefaultFactHandle( 0,
                                                             "stilton" );
-        final ReteTuple tuple0 = new ReteTuple( f0 );
+        final LeftTuple tuple0 = new LeftTuple( f0 );
 
         // Tuple should fail and not propagate
         node.assertTuple( tuple0,
@@ -235,7 +235,7 @@
         // Create the Tuple
         final DefaultFactHandle f1 = new DefaultFactHandle( 1,
                                                             "cheddar" );
-        final ReteTuple tuple1 = new ReteTuple( f1 );
+        final LeftTuple tuple1 = new LeftTuple( f1 );
 
         // Tuple should fail and not propagate 
         node.assertTuple( tuple1,
@@ -280,7 +280,7 @@
         final DefaultFactHandle f0 = new DefaultFactHandle( 0,
                                                             "string0" );
 
-        final ReteTuple tuple1 = new ReteTuple( f0 );
+        final LeftTuple tuple1 = new LeftTuple( f0 );
 
         node.assertTuple( tuple1,
                           this.context,

Modified: labs/jbossrules/branches/righttuple/drools-core/src/test/java/org/drools/reteoo/ExistsNodeTest.java
===================================================================
--- labs/jbossrules/branches/righttuple/drools-core/src/test/java/org/drools/reteoo/ExistsNodeTest.java	2008-01-04 00:57:26 UTC (rev 17532)
+++ labs/jbossrules/branches/righttuple/drools-core/src/test/java/org/drools/reteoo/ExistsNodeTest.java	2008-01-04 01:54:45 UTC (rev 17533)
@@ -94,7 +94,7 @@
                                            10 );
         final DefaultFactHandle f0 = (DefaultFactHandle) this.workingMemory.insert( cheddar );
 
-        final ReteTuple tuple1 = new ReteTuple( f0 );
+        final LeftTuple tuple1 = new LeftTuple( f0 );
 
         this.node.assertTuple( tuple1,
                                this.context,
@@ -112,7 +112,7 @@
                                         10 );
         final DefaultFactHandle f1 = (DefaultFactHandle) this.workingMemory.insert( brie );
 
-        this.node.assertObject( f1,
+        this.node.assertRightTuple( f1,
                                 this.context,
                                 this.workingMemory );
 
@@ -123,13 +123,13 @@
         assertLength( 0,
                       this.sink.getRetracted() );
 
-        assertEquals( new ReteTuple( f0 ),
+        assertEquals( new LeftTuple( f0 ),
                       ((Object[]) this.sink.getAsserted().get( 0 ))[0] );
 
         // assert tuple, will have matches, so propagate
         final DefaultFactHandle f2 = (DefaultFactHandle) this.workingMemory.insert( new Cheese( "gouda",
                                                                                                 10 ) );
-        final ReteTuple tuple2 = new ReteTuple( f2 );
+        final LeftTuple tuple2 = new LeftTuple( f2 );
         this.node.assertTuple( tuple2,
                                this.context,
                                this.workingMemory );
@@ -143,12 +143,12 @@
 
         // check memory sizes
         assertEquals( 2,
-                      this.memory.getTupleMemory().size() );
+                      this.memory.getLeftTupleMemory().size() );
         assertEquals( 1,
-                      this.memory.getFactHandleMemory().size() );
+                      this.memory.getRightTupleMemory().size() );
 
         // When this is retracter both tuples should be retracted
-        this.node.retractObject( f1,
+        this.node.retractRightTuple( f1,
                                  this.context,
                                  this.workingMemory );
 
@@ -173,7 +173,7 @@
                                            10 );
         final DefaultFactHandle f0 = (DefaultFactHandle) this.workingMemory.insert( cheddar );
 
-        final ReteTuple tuple1 = new ReteTuple( f0 );
+        final LeftTuple tuple1 = new LeftTuple( f0 );
 
         this.node.assertTuple( tuple1,
                                this.context,
@@ -191,7 +191,7 @@
                                         10 );
         final DefaultFactHandle f1 = (DefaultFactHandle) this.workingMemory.insert( brie );
 
-        this.node.assertObject( f1,
+        this.node.assertRightTuple( f1,
                                 this.context,
                                 this.workingMemory );
 
@@ -205,7 +205,7 @@
         // assert tuple, will have matches, so do assert propagation
         final DefaultFactHandle f2 = (DefaultFactHandle) this.workingMemory.insert( new Cheese( "gouda",
                                                                                                 10 ) );
-        final ReteTuple tuple2 = new ReteTuple( f2 );
+        final LeftTuple tuple2 = new LeftTuple( f2 );
         this.node.assertTuple( tuple2,
                                this.context,
                                this.workingMemory );
@@ -228,7 +228,7 @@
             final Cheese cheddar = new Cheese( "cheddar",
                                                10 );
             final DefaultFactHandle f0 = (DefaultFactHandle) this.workingMemory.insert( cheddar );
-            final ReteTuple tuple1 = new ReteTuple( f0 );
+            final LeftTuple tuple1 = new LeftTuple( f0 );
 
             this.node.assertTuple( tuple1,
                                    this.context,
@@ -241,36 +241,36 @@
 
             // Initially, no objects in right memory
             assertEquals( 0,
-                          this.memory.getFactHandleMemory().size() );
-            this.node.assertObject( f1,
+                          this.memory.getRightTupleMemory().size() );
+            this.node.assertRightTuple( f1,
                                     this.context,
                                     this.workingMemory );
 
             // Now, needs to have 1 object in right memory
             assertEquals( 1,
-                          this.memory.getFactHandleMemory().size() );
+                          this.memory.getRightTupleMemory().size() );
 
             // simulate modify
-            this.node.retractObject( f1,
+            this.node.retractRightTuple( f1,
                                      this.context,
                                      this.workingMemory );
-            this.node.assertObject( f1,
+            this.node.assertRightTuple( f1,
                                     this.context,
                                     this.workingMemory );
             // Memory should not change
             assertEquals( 1,
-                          this.memory.getFactHandleMemory().size() );
+                          this.memory.getRightTupleMemory().size() );
 
             // When this is retracter both tuples should assert
-            this.node.retractObject( f1,
+            this.node.retractRightTuple( f1,
                                      this.context,
                                      this.workingMemory );
             assertEquals( 0,
-                          this.memory.getFactHandleMemory().size() );
+                          this.memory.getRightTupleMemory().size() );
 
             // check memory sizes
             assertEquals( 1,
-                          this.memory.getTupleMemory().size() );
+                          this.memory.getLeftTupleMemory().size() );
 
             // simulate modify
             this.node.retractTuple( tuple1,
@@ -280,12 +280,12 @@
                                    this.context,
                                    this.workingMemory );
             assertEquals( 1,
-                          this.memory.getTupleMemory().size() );
+                          this.memory.getLeftTupleMemory().size() );
             this.node.retractTuple( tuple1,
                                     this.context,
                                     this.workingMemory );
             assertEquals( 0,
-                          this.memory.getTupleMemory().size() );
+                          this.memory.getLeftTupleMemory().size() );
         } catch ( final Exception e ) {
             Assert.fail( "No exception should be raised in this procedure, but got: " + e.toString() );
         }

Modified: labs/jbossrules/branches/righttuple/drools-core/src/test/java/org/drools/reteoo/FromNodeTest.java
===================================================================
--- labs/jbossrules/branches/righttuple/drools-core/src/test/java/org/drools/reteoo/FromNodeTest.java	2008-01-04 00:57:26 UTC (rev 17532)
+++ labs/jbossrules/branches/righttuple/drools-core/src/test/java/org/drools/reteoo/FromNodeTest.java	2008-01-04 01:54:45 UTC (rev 17533)
@@ -76,7 +76,7 @@
         final Person person1 = new Person( "xxx1",
                                            30 );
         final FactHandle person1Handle = workingMemory.insert( person1 );
-        final ReteTuple tuple1 = new ReteTuple( (DefaultFactHandle) person1Handle );
+        final LeftTuple tuple1 = new LeftTuple( (DefaultFactHandle) person1Handle );
         from.assertTuple( tuple1,
                           context,
                           workingMemory );
@@ -90,7 +90,7 @@
         final Person person2 = new Person( "xxx2",
                                            30 );
         final FactHandle person2Handle = workingMemory.insert( person2 );
-        final ReteTuple tuple2 = new ReteTuple( (DefaultFactHandle) person2Handle );
+        final LeftTuple tuple2 = new LeftTuple( (DefaultFactHandle) person2Handle );
         from.assertTuple( tuple2,
                           context,
                           workingMemory );
@@ -108,7 +108,7 @@
         final Person person3 = new Person( "xxx2",
                                            30 );
         final FactHandle person3Handle = workingMemory.insert( person3 );
-        final ReteTuple tuple3 = new ReteTuple( (DefaultFactHandle) person3Handle );
+        final LeftTuple tuple3 = new LeftTuple( (DefaultFactHandle) person3Handle );
         from.assertTuple( tuple3,
                           context,
                           workingMemory );
@@ -183,7 +183,7 @@
         final Person person1 = new Person( "xxx1",
                                            30 );
         final FactHandle person1Handle = workingMemory.insert( person1 );
-        final ReteTuple tuple1 = new ReteTuple( (DefaultFactHandle) person1Handle );
+        final LeftTuple tuple1 = new LeftTuple( (DefaultFactHandle) person1Handle );
         from.assertTuple( tuple1,
                           context,
                           workingMemory );
@@ -197,7 +197,7 @@
         final Person person2 = new Person( "xxx2",
                                            30 );
         final FactHandle person2Handle = workingMemory.insert( person2 );
-        final ReteTuple tuple2 = new ReteTuple( (DefaultFactHandle) person2Handle );
+        final LeftTuple tuple2 = new LeftTuple( (DefaultFactHandle) person2Handle );
         from.assertTuple( tuple2,
                           context,
                           workingMemory );
@@ -215,7 +215,7 @@
         final Person person3 = new Person( "xxx2",
                                            30 );
         final FactHandle person3Handle = workingMemory.insert( person3 );
-        final ReteTuple tuple3 = new ReteTuple( (DefaultFactHandle) person3Handle );
+        final LeftTuple tuple3 = new LeftTuple( (DefaultFactHandle) person3Handle );
         from.assertTuple( tuple3,
                           context,
                           workingMemory );
@@ -275,7 +275,7 @@
         final Person person1 = new Person( "xxx2",
                                            30 );
         final FactHandle person1Handle = workingMemory.insert( person1 );
-        final ReteTuple tuple = new ReteTuple( (DefaultFactHandle) person1Handle );
+        final LeftTuple tuple = new LeftTuple( (DefaultFactHandle) person1Handle );
         from.assertTuple( tuple,
                           context,
                           workingMemory );
@@ -285,8 +285,8 @@
 
         final BetaMemory memory = (BetaMemory) workingMemory.getNodeMemory( from );
         assertEquals( 1,
-                      memory.getTupleMemory().size() );
-        assertNull( memory.getFactHandleMemory() );
+                      memory.getLeftTupleMemory().size() );
+        assertNull( memory.getRightTupleMemory() );
         assertEquals( 2,
                       ((LinkedList) memory.getCreatedHandles().get( tuple )).size() );
 
@@ -301,8 +301,8 @@
                            context,
                            workingMemory );
         assertEquals( 0,
-                      memory.getTupleMemory().size() );
-        assertNull( memory.getFactHandleMemory() );
+                      memory.getLeftTupleMemory().size() );
+        assertNull( memory.getRightTupleMemory() );
     }
 
     public static class MockDataProvider

Modified: labs/jbossrules/branches/righttuple/drools-core/src/test/java/org/drools/reteoo/InstrumentedReteTuple.java
===================================================================
--- labs/jbossrules/branches/righttuple/drools-core/src/test/java/org/drools/reteoo/InstrumentedReteTuple.java	2008-01-04 00:57:26 UTC (rev 17532)
+++ labs/jbossrules/branches/righttuple/drools-core/src/test/java/org/drools/reteoo/InstrumentedReteTuple.java	2008-01-04 01:54:45 UTC (rev 17533)
@@ -20,13 +20,13 @@
 import org.drools.common.DefaultFactHandle;
 import org.drools.common.InternalFactHandle;
 
-public class InstrumentedReteTuple extends ReteTuple {
+public class InstrumentedReteTuple extends LeftTuple {
     /**
      * 
      */
     private static final long serialVersionUID = 400L;
 
-    public InstrumentedReteTuple(final ReteTuple left,
+    public InstrumentedReteTuple(final LeftTuple left,
                                  final FactHandle handle) {
         super( left,
                (InternalFactHandle) handle );

Modified: labs/jbossrules/branches/righttuple/drools-core/src/test/java/org/drools/reteoo/JoinNodeTest.java
===================================================================
--- labs/jbossrules/branches/righttuple/drools-core/src/test/java/org/drools/reteoo/JoinNodeTest.java	2008-01-04 00:57:26 UTC (rev 17532)
+++ labs/jbossrules/branches/righttuple/drools-core/src/test/java/org/drools/reteoo/JoinNodeTest.java	2008-01-04 01:54:45 UTC (rev 17533)
@@ -82,20 +82,20 @@
 
         // check memories are empty
         assertEquals( 0,
-                      this.memory.getTupleMemory().size() );
+                      this.memory.getLeftTupleMemory().size() );
         assertEquals( 0,
-                      this.memory.getFactHandleMemory().size() );
+                      this.memory.getRightTupleMemory().size() );
 
     }
 
     public void testAttach() throws Exception {
-        final Field objectFfield = ObjectSource.class.getDeclaredField( "sink" );
+        final Field objectFfield = RightTupleSource.class.getDeclaredField( "sink" );
         objectFfield.setAccessible( true );
-        ObjectSinkPropagator objectSink = (ObjectSinkPropagator) objectFfield.get( this.objectSource );
+        RightTupletSinkPropagator objectSink = (RightTupletSinkPropagator) objectFfield.get( this.objectSource );
 
-        final Field tupleField = TupleSource.class.getDeclaredField( "sink" );
+        final Field tupleField = LeftTupleSource.class.getDeclaredField( "sink" );
         tupleField.setAccessible( true );
-        TupleSinkPropagator tupleSink = (TupleSinkPropagator) tupleField.get( this.tupleSource );
+        LeftTupleSinkPropagator tupleSink = (LeftTupleSinkPropagator) tupleField.get( this.tupleSource );
 
         assertEquals( 15,
                       this.node.getId() );
@@ -105,8 +105,8 @@
 
         this.node.attach();
 
-        objectSink = (ObjectSinkPropagator) objectFfield.get( this.objectSource );
-        tupleSink = (TupleSinkPropagator) tupleField.get( this.tupleSource );
+        objectSink = (RightTupletSinkPropagator) objectFfield.get( this.objectSource );
+        tupleSink = (LeftTupleSinkPropagator) tupleField.get( this.tupleSource );
 
         assertEquals( 1,
                       objectSink.getSinks().length );
@@ -149,7 +149,7 @@
     public void testAssertTuple() throws Exception {
         final DefaultFactHandle f0 = new DefaultFactHandle( 0,
                                                             "cheese" );
-        final ReteTuple tuple0 = new ReteTuple( f0 );
+        final LeftTuple tuple0 = new LeftTuple( f0 );
 
         // assert tuple, should add one to left memory
         this.node.assertTuple( tuple0,
@@ -157,21 +157,21 @@
                                this.workingMemory );
         // check memories, left memory is populated, right memory is emptys
         assertEquals( 1,
-                      this.memory.getTupleMemory().size() );
+                      this.memory.getLeftTupleMemory().size() );
         assertEquals( 0,
-                      this.memory.getFactHandleMemory().size() );
+                      this.memory.getRightTupleMemory().size() );
 
         // assert tuple, should add left memory should be 2
         final DefaultFactHandle f1 = new DefaultFactHandle( 1,
                                                             "cheese" );
-        final ReteTuple tuple1 = new ReteTuple( f1 );
+        final LeftTuple tuple1 = new LeftTuple( f1 );
         this.node.assertTuple( tuple1,
                                this.context,
                                this.workingMemory );
         assertEquals( 2,
-                      this.memory.getTupleMemory().size() );
+                      this.memory.getLeftTupleMemory().size() );
 
-        final Iterator it = this.memory.getTupleMemory().iterator();
+        final Iterator it = this.memory.getLeftTupleMemory().iterator();
         assertEquals( tuple0,
                       it.next() );
         assertEquals( tuple1,
@@ -209,9 +209,9 @@
 
         final DefaultFactHandle f0 = new DefaultFactHandle( 0,
                                                             "cheese" );
-        final ReteTuple tuple0 = new ReteTuple( f0 );
+        final LeftTuple tuple0 = new LeftTuple( f0 );
 
-        this.node.assertObject( f0,
+        this.node.assertRightTuple( f0,
                                 this.context,
                                 this.workingMemory );
 
@@ -223,12 +223,12 @@
         assertEquals( 1,
                       this.sink.getAsserted().size() );
 
-        assertNull( this.memory.getTupleMemory() );
+        assertNull( this.memory.getLeftTupleMemory() );
 
         assertEquals( 1,
-                      this.memory.getFactHandleMemory().size() );
+                      this.memory.getRightTupleMemory().size() );
 
-        assertEquals( new ReteTuple( tuple0,
+        assertEquals( new LeftTuple( tuple0,
                                      f0 ),
                       ((Object[]) this.sink.getAsserted().get( 0 ))[0] );
     }
@@ -242,23 +242,23 @@
         final DefaultFactHandle f0 = (DefaultFactHandle) this.workingMemory.insert( "test0" );
 
         // assert object, should add one to right memory
-        this.node.assertObject( f0,
+        this.node.assertRightTuple( f0,
                                 this.context,
                                 this.workingMemory );
         assertEquals( 0,
-                      this.memory.getTupleMemory().size() );
+                      this.memory.getLeftTupleMemory().size() );
         assertEquals( 1,
-                      this.memory.getFactHandleMemory().size() );
+                      this.memory.getRightTupleMemory().size() );
 
         // check new objects/handles still assert
         final DefaultFactHandle f1 = (DefaultFactHandle) this.workingMemory.insert( "test1" );
-        this.node.assertObject( f1,
+        this.node.assertRightTuple( f1,
                                 this.context,
                                 this.workingMemory );
         assertEquals( 2,
-                      this.memory.getFactHandleMemory().size() );
+                      this.memory.getRightTupleMemory().size() );
 
-        final Iterator it = this.memory.getFactHandleMemory().iterator( new ReteTuple( f0 ) );
+        final Iterator it = this.memory.getRightTupleMemory().iterator( new LeftTuple( f0 ) );
 
         final InternalFactHandle rf0 = ((FactEntry) it.next()).getFactHandle();
         final InternalFactHandle rf1 = ((FactEntry) it.next()).getFactHandle();
@@ -277,14 +277,14 @@
     public void testAssertPropagations() throws Exception {
         // assert first right object
         final DefaultFactHandle f0 = (DefaultFactHandle) this.workingMemory.insert( "test0" );
-        this.node.assertObject( f0,
+        this.node.assertRightTuple( f0,
                                 this.context,
                                 this.workingMemory );
 
         // assert tuple, should add left memory should be 2
         final DefaultFactHandle f1 = new DefaultFactHandle( 1,
                                                             "cheese" );
-        final ReteTuple tuple1 = new ReteTuple( f1 );
+        final LeftTuple tuple1 = new LeftTuple( f1 );
         this.node.assertTuple( tuple1,
                                this.context,
                                this.workingMemory );
@@ -292,25 +292,25 @@
         assertEquals( 1,
                       this.sink.getAsserted().size() );
 
-        assertEquals( new ReteTuple( tuple1,
+        assertEquals( new LeftTuple( tuple1,
                                      f0 ),
                       ((Object[]) this.sink.getAsserted().get( 0 ))[0] );
 
         final DefaultFactHandle f2 = new DefaultFactHandle( 2,
                                                             "cheese" );
-        final ReteTuple tuple2 = new ReteTuple( f2 );
+        final LeftTuple tuple2 = new LeftTuple( f2 );
         this.node.assertTuple( tuple2,
                                this.context,
                                this.workingMemory );
 
         assertEquals( 2,
                       this.sink.getAsserted().size() );
-        assertEquals( new ReteTuple( tuple2,
+        assertEquals( new LeftTuple( tuple2,
                                      f0 ),
                       ((Object[]) this.sink.getAsserted().get( 1 ))[0] );
 
         final DefaultFactHandle f3 = (DefaultFactHandle) this.workingMemory.insert( "test2" );
-        this.node.assertObject( f3,
+        this.node.assertRightTuple( f3,
                                 this.context,
                                 this.workingMemory );
 
@@ -321,9 +321,9 @@
         tuples.add( ((Object[]) this.sink.getAsserted().get( 2 ))[0] );
         tuples.add( ((Object[]) this.sink.getAsserted().get( 3 ))[0] );
 
-        assertTrue( tuples.contains( new ReteTuple( tuple1,
+        assertTrue( tuples.contains( new LeftTuple( tuple1,
                                                     f3 ) ) );
-        assertTrue( tuples.contains( new ReteTuple( tuple2,
+        assertTrue( tuples.contains( new LeftTuple( tuple2,
                                                     f3 ) ) );
     }
 
@@ -336,29 +336,29 @@
     public void testRetractTuple() throws Exception {
         // setup 2 tuples 3 fact handles
         final DefaultFactHandle f0 = (DefaultFactHandle) this.workingMemory.insert( "test0" );
-        this.node.assertObject( f0,
+        this.node.assertRightTuple( f0,
                                 this.context,
                                 this.workingMemory );
 
         final DefaultFactHandle f1 = (DefaultFactHandle) this.workingMemory.insert( "test1" );
-        final ReteTuple tuple1 = new ReteTuple( f1 );
+        final LeftTuple tuple1 = new LeftTuple( f1 );
         this.node.assertTuple( tuple1,
                                this.context,
                                this.workingMemory );
 
         final DefaultFactHandle f2 = (DefaultFactHandle) this.workingMemory.insert( "test2" );
-        final ReteTuple tuple2 = new ReteTuple( f2 );
+        final LeftTuple tuple2 = new LeftTuple( f2 );
         this.node.assertTuple( tuple2,
                                this.context,
                                this.workingMemory );
 
         final DefaultFactHandle f3 = (DefaultFactHandle) this.workingMemory.insert( "test3" );
-        this.node.assertObject( f3,
+        this.node.assertRightTuple( f3,
                                 this.context,
                                 this.workingMemory );
 
         final DefaultFactHandle f4 = (DefaultFactHandle) this.workingMemory.insert( "test4" );
-        this.node.assertObject( f4,
+        this.node.assertRightTuple( f4,
                                 this.context,
                                 this.workingMemory );
 
@@ -367,10 +367,10 @@
 
         // Double check the item is in memory
         final BetaMemory memory = (BetaMemory) this.workingMemory.getNodeMemory( this.node );
-        assertTrue( memory.getFactHandleMemory().contains( f0 ) );
+        assertTrue( memory.getRightTupleMemory().contains( f0 ) );
 
         // Retract an object, check propagations  and memory
-        this.node.retractObject( f0,
+        this.node.retractRightTuple( f0,
                                  this.context,
                                  this.workingMemory );
         assertLength( 2,
@@ -380,13 +380,13 @@
         tuples.add( ((Object[]) this.sink.getRetracted().get( 0 ))[0] );
         tuples.add( ((Object[]) this.sink.getRetracted().get( 1 ))[0] );
 
-        assertTrue( tuples.contains( new ReteTuple( tuple1,
+        assertTrue( tuples.contains( new LeftTuple( tuple1,
                                                     f0 ) ) );
-        assertTrue( tuples.contains( new ReteTuple( tuple1,
+        assertTrue( tuples.contains( new LeftTuple( tuple1,
                                                     f0 ) ) );
 
         // Now check the item  is no longer in memory
-        assertFalse( memory.getFactHandleMemory().contains( f0 ) );
+        assertFalse( memory.getRightTupleMemory().contains( f0 ) );
 
         this.node.retractTuple( tuple2,
                                 this.context,
@@ -398,9 +398,9 @@
         tuples.add( ((Object[]) this.sink.getRetracted().get( 2 ))[0] );
         tuples.add( ((Object[]) this.sink.getRetracted().get( 3 ))[0] );
 
-        assertTrue( tuples.contains( new ReteTuple( tuple2,
+        assertTrue( tuples.contains( new LeftTuple( tuple2,
                                                     f3 ) ) );
-        assertTrue( tuples.contains( new ReteTuple( tuple2,
+        assertTrue( tuples.contains( new LeftTuple( tuple2,
                                                     f4 ) ) );
     }
 
@@ -408,14 +408,14 @@
         this.constraint.isAllowed = false;
         // assert first right object
         final DefaultFactHandle f0 = (DefaultFactHandle) this.workingMemory.insert( "test0" );
-        this.node.assertObject( f0,
+        this.node.assertRightTuple( f0,
                                 this.context,
                                 this.workingMemory );
 
         // assert tuple, should add left memory should be 2
         final DefaultFactHandle f1 = new DefaultFactHandle( 1,
                                                             "cheese" );
-        final ReteTuple tuple1 = new ReteTuple( f1 );
+        final LeftTuple tuple1 = new LeftTuple( f1 );
         this.node.assertTuple( tuple1,
                                this.context,
                                this.workingMemory );
@@ -424,7 +424,7 @@
         assertLength( 0,
                       this.sink.getAsserted() );
 
-        this.node.retractObject( f0,
+        this.node.retractRightTuple( f0,
                                  this.context,
                                  this.workingMemory );
         assertLength( 0,
@@ -452,7 +452,7 @@
         final DefaultFactHandle f0 = new DefaultFactHandle( 0,
                                                             "string0" );
 
-        final ReteTuple tuple1 = new ReteTuple( f0 );
+        final LeftTuple tuple1 = new LeftTuple( f0 );
 
         joinNode.assertTuple( tuple1,
                               this.context,
@@ -462,7 +462,7 @@
         final DefaultFactHandle string1Handle = new DefaultFactHandle( 1,
                                                                        string1 );
 
-        joinNode.assertObject( string1Handle,
+        joinNode.assertRightTuple( string1Handle,
                                this.context,
                                workingMemory );
 

Modified: labs/jbossrules/branches/righttuple/drools-core/src/test/java/org/drools/reteoo/LeftInputAdapterNodeTest.java
===================================================================
--- labs/jbossrules/branches/righttuple/drools-core/src/test/java/org/drools/reteoo/LeftInputAdapterNodeTest.java	2008-01-04 00:57:26 UTC (rev 17532)
+++ labs/jbossrules/branches/righttuple/drools-core/src/test/java/org/drools/reteoo/LeftInputAdapterNodeTest.java	2008-01-04 01:54:45 UTC (rev 17533)
@@ -65,9 +65,9 @@
         final LeftInputAdapterNode liaNode = new LeftInputAdapterNode( 1,
                                                                        source,
                                                                        buildContext );
-        final Field field = ObjectSource.class.getDeclaredField( "sink" );
+        final Field field = RightTupleSource.class.getDeclaredField( "sink" );
         field.setAccessible( true );
-        ObjectSinkPropagator sink = (ObjectSinkPropagator) field.get( source );
+        RightTupletSinkPropagator sink = (RightTupletSinkPropagator) field.get( source );
 
         assertEquals( 1,
                       liaNode.getId() );
@@ -75,7 +75,7 @@
 
         liaNode.attach();
 
-        sink = (ObjectSinkPropagator) field.get( source );
+        sink = (RightTupletSinkPropagator) field.get( source );
 
         assertEquals( 1,
                       sink.getSinks().length );
@@ -108,7 +108,7 @@
 
         // assert object
         final DefaultFactHandle f0 = (DefaultFactHandle) workingMemory.insert( string1 );
-        liaNode.assertObject( f0,
+        liaNode.assertRightTuple( f0,
                               context,
                               workingMemory );
 
@@ -143,13 +143,13 @@
         final MockTupleSink sink = new MockTupleSink();
         liaNode.addTupleSink( sink );
 
-        liaNode.setObjectMemoryEnabled( true );
+        liaNode.setRightTupleMemoryEnabled( true );
 
         final Object string1 = "cheese";
 
         // assert object
         final DefaultFactHandle f0 = (DefaultFactHandle) workingMemory.insert( string1 );
-        liaNode.assertObject( f0,
+        liaNode.assertRightTuple( f0,
                               context,
                               workingMemory );
 
@@ -168,7 +168,7 @@
 
         // check memory works with multiple handles
         final DefaultFactHandle f1 = (DefaultFactHandle) workingMemory.insert( "test1" );
-        liaNode.assertObject( f1,
+        liaNode.assertRightTuple( f1,
                               context,
                               workingMemory );
 
@@ -211,13 +211,13 @@
         final DefaultFactHandle f0 = (DefaultFactHandle) workingMemory.insert( "f1" );
 
         // assert object 
-        liaNode.assertObject( f0,
+        liaNode.assertRightTuple( f0,
                               context,
                               workingMemory );
 
         final Tuple tuple = (Tuple) ((Object[]) sink.getAsserted().get( 0 ))[0];
 
-        liaNode.retractObject( f0,
+        liaNode.retractRightTuple( f0,
                                context,
                                workingMemory );
 
@@ -242,7 +242,7 @@
                                                                        new MockObjectSource( idGenerator.getNextId() ),
                                                                        buildContext );
         //force liaNode to have memory
-        liaNode.setObjectMemoryEnabled( true );
+        liaNode.setRightTupleMemoryEnabled( true );
 
         final MockTupleSink sink = new MockTupleSink();
         liaNode.addTupleSink( sink );
@@ -250,7 +250,7 @@
         final DefaultFactHandle f0 = (DefaultFactHandle) workingMemory.insert( "f1" );
 
         // assert object
-        liaNode.assertObject( f0,
+        liaNode.assertRightTuple( f0,
                               context,
                               workingMemory );
 
@@ -259,7 +259,7 @@
         final FactHashTable map = (FactHashTable) workingMemory.getNodeMemory( liaNode );
         assertTrue( map.contains( f0 ) );
 
-        liaNode.retractObject( f0,
+        liaNode.retractRightTuple( f0,
                                context,
                                workingMemory );
 

Modified: labs/jbossrules/branches/righttuple/drools-core/src/test/java/org/drools/reteoo/LogicalAssertionTest.java
===================================================================
--- labs/jbossrules/branches/righttuple/drools-core/src/test/java/org/drools/reteoo/LogicalAssertionTest.java	2008-01-04 00:57:26 UTC (rev 17532)
+++ labs/jbossrules/branches/righttuple/drools-core/src/test/java/org/drools/reteoo/LogicalAssertionTest.java	2008-01-04 01:54:45 UTC (rev 17533)
@@ -87,7 +87,7 @@
         rule1.setConsequence( consequence );
 
         final DefaultFactHandle handle1 = (DefaultFactHandle) workingMemory.insert( "o1" );
-        final ReteTuple tuple1 = new ReteTuple( handle1 );
+        final LeftTuple tuple1 = new LeftTuple( handle1 );
 
         final PropagationContext context1 = new PropagationContextImpl( 0,
                                                                         PropagationContext.ASSERTION,
@@ -189,7 +189,7 @@
 
         final DefaultFactHandle handle1 = new DefaultFactHandle( 1,
                                                                  "cheese" );
-        final ReteTuple tuple1 = new ReteTuple( handle1 );
+        final LeftTuple tuple1 = new LeftTuple( handle1 );
 
         final PropagationContext context1 = new PropagationContextImpl( 0,
                                                                         PropagationContext.ASSERTION,
@@ -278,7 +278,7 @@
 
         final DefaultFactHandle handle1 = new DefaultFactHandle( 1,
                                                                  "cheese" );
-        final ReteTuple tuple1 = new ReteTuple( handle1 );
+        final LeftTuple tuple1 = new LeftTuple( handle1 );
 
         final PropagationContext context1 = new PropagationContextImpl( 0,
                                                                         PropagationContext.ASSERTION,
@@ -419,7 +419,7 @@
 
         final DefaultFactHandle handle1 = new DefaultFactHandle( 1,
                                                                  "cheese" );
-        final ReteTuple tuple1 = new ReteTuple( handle1 );
+        final LeftTuple tuple1 = new LeftTuple( handle1 );
 
         final PropagationContext context1 = new PropagationContextImpl( 0,
                                                                         PropagationContext.ASSERTION,
@@ -508,7 +508,7 @@
 
         final DefaultFactHandle handle1 = new DefaultFactHandle( 1,
                                                                  "cheese" );
-        final ReteTuple tuple1 = new ReteTuple( handle1 );
+        final LeftTuple tuple1 = new LeftTuple( handle1 );
 
         final PropagationContext context = new PropagationContextImpl( 0,
                                                                        PropagationContext.ASSERTION,
@@ -538,7 +538,7 @@
 
         final DefaultFactHandle handle2 = new DefaultFactHandle( 2,
                                                                  "cheese" );
-        final ReteTuple tuple2 = new ReteTuple( handle2 );
+        final LeftTuple tuple2 = new LeftTuple( handle2 );
 
         node.assertTuple( tuple2,
                           context,
@@ -609,7 +609,7 @@
 
         final DefaultFactHandle handle1 = new DefaultFactHandle( 1,
                                                                  "cheese" );
-        final ReteTuple tuple1 = new ReteTuple( handle1 );
+        final LeftTuple tuple1 = new LeftTuple( handle1 );
 
         final PropagationContext context1 = new PropagationContextImpl( 0,
                                                                         PropagationContext.ASSERTION,
@@ -631,7 +631,7 @@
 
         final DefaultFactHandle handle2 = new DefaultFactHandle( 2,
                                                                  "cheese" );
-        final ReteTuple tuple2 = new ReteTuple( handle2 );
+        final LeftTuple tuple2 = new LeftTuple( handle2 );
 
         final PropagationContext context2 = new PropagationContextImpl( 0,
                                                                         PropagationContext.ASSERTION,
@@ -738,7 +738,7 @@
 
         final DefaultFactHandle handle1 = new DefaultFactHandle( 1,
                                                                  "cheese" );
-        final ReteTuple tuple1 = new ReteTuple( handle1 );
+        final LeftTuple tuple1 = new LeftTuple( handle1 );
 
         final PropagationContext context1 = new PropagationContextImpl( 0,
                                                                         PropagationContext.ASSERTION,
@@ -838,7 +838,7 @@
 
         final DefaultFactHandle handle1 = new DefaultFactHandle( 1,
                                                                  "cheese" );
-        final ReteTuple tuple1 = new ReteTuple( handle1 );
+        final LeftTuple tuple1 = new LeftTuple( handle1 );
 
         final PropagationContext context1 = new PropagationContextImpl( 0,
                                                                         PropagationContext.ASSERTION,

Modified: labs/jbossrules/branches/righttuple/drools-core/src/test/java/org/drools/reteoo/MockObjectSink.java
===================================================================
--- labs/jbossrules/branches/righttuple/drools-core/src/test/java/org/drools/reteoo/MockObjectSink.java	2008-01-04 00:57:26 UTC (rev 17532)
+++ labs/jbossrules/branches/righttuple/drools-core/src/test/java/org/drools/reteoo/MockObjectSink.java	2008-01-04 01:54:45 UTC (rev 17533)
@@ -19,29 +19,28 @@
 import java.util.ArrayList;
 import java.util.List;
 
-import org.drools.common.InternalFactHandle;
 import org.drools.common.InternalWorkingMemory;
 import org.drools.spi.PropagationContext;
 
 public class MockObjectSink
     implements
-    ObjectSinkNode {
+    RightTupleSinkNode {
     private final List     asserted  = new ArrayList();
     private final List     retracted = new ArrayList();
 
-    private ObjectSinkNode previousObjectSinkNode;
-    private ObjectSinkNode nextObjectSinkNode;
+    private RightTupleSinkNode previousObjectSinkNode;
+    private RightTupleSinkNode nextObjectSinkNode;
 
-    public void assertObject(final InternalFactHandle handle,
+    public void assertRightTuple(final RightTuple rightTuple,
                              final PropagationContext context,
                              final InternalWorkingMemory workingMemory) {
-        this.asserted.add( new Object[]{handle, context, workingMemory} );
+        this.asserted.add( new Object[]{rightTuple, context, workingMemory} );
     }
 
-    public void retractObject(final InternalFactHandle handle,
+    public void retractRightTuple(final RightTuple rightTuple,
                               final PropagationContext context,
                               final InternalWorkingMemory workingMemory) {
-        this.retracted.add( new Object[]{handle, context, workingMemory} );
+        this.retracted.add( new Object[]{rightTuple, context, workingMemory} );
     }
 
     public List getAsserted() {
@@ -57,7 +56,7 @@
      * @return
      *      The next ObjectSinkNode
      */
-    public ObjectSinkNode getNextObjectSinkNode() {
+    public RightTupleSinkNode getNextRightTupleSinkNode() {
         return this.nextObjectSinkNode;
     }
 
@@ -66,7 +65,7 @@
      * @param next
      *      The next ObjectSinkNode
      */
-    public void setNextObjectSinkNode(final ObjectSinkNode next) {
+    public void setNextRightTupleSinkNode(final RightTupleSinkNode next) {
         this.nextObjectSinkNode = next;
     }
 
@@ -75,7 +74,7 @@
      * @return
      *      The previous ObjectSinkNode
      */
-    public ObjectSinkNode getPreviousObjectSinkNode() {
+    public RightTupleSinkNode getPreviousRightTupleSinkNode() {
         return this.previousObjectSinkNode;
     }
 
@@ -84,16 +83,16 @@
      * @param previous
      *      The previous ObjectSinkNode
      */
-    public void setPreviousObjectSinkNode(final ObjectSinkNode previous) {
+    public void setPreviousRightTupleSinkNode(final RightTupleSinkNode previous) {
         this.previousObjectSinkNode = previous;
     }
 
-    public boolean isObjectMemoryEnabled() {
+    public boolean isRightTupleMemoryEnabled() {
         // TODO Auto-generated method stub
         return false;
     }
 
-    public void setObjectMemoryEnabled(boolean objectMemoryOn) {
+    public void setRightTupleMemoryEnabled(boolean objectMemoryOn) {
         // TODO Auto-generated method stub
         
     }

Modified: labs/jbossrules/branches/righttuple/drools-core/src/test/java/org/drools/reteoo/MockObjectSource.java
===================================================================
--- labs/jbossrules/branches/righttuple/drools-core/src/test/java/org/drools/reteoo/MockObjectSource.java	2008-01-04 00:57:26 UTC (rev 17532)
+++ labs/jbossrules/branches/righttuple/drools-core/src/test/java/org/drools/reteoo/MockObjectSource.java	2008-01-04 01:54:45 UTC (rev 17533)
@@ -25,7 +25,7 @@
 import org.drools.common.InternalWorkingMemory;
 import org.drools.spi.PropagationContext;
 
-public class MockObjectSource extends ObjectSource {
+public class MockObjectSource extends RightTupleSource {
     /**
      * 
      */
@@ -59,13 +59,13 @@
         this.facts.add( handle );
     }
 
-    public void updateSink(final ObjectSink sink,
+    public void updateSink(final RightTupleSink sink,
                            final PropagationContext context,
                            final InternalWorkingMemory workingMemory) {
         this.updated++;
         for ( final Iterator it = this.facts.iterator(); it.hasNext(); ) {
             final InternalFactHandle handle = (InternalFactHandle) it.next();
-            sink.assertObject( handle,
+            sink.assertRightTuple( handle,
                                context,
                                workingMemory );
         }

Modified: labs/jbossrules/branches/righttuple/drools-core/src/test/java/org/drools/reteoo/MockTupleSink.java
===================================================================
--- labs/jbossrules/branches/righttuple/drools-core/src/test/java/org/drools/reteoo/MockTupleSink.java	2008-01-04 00:57:26 UTC (rev 17532)
+++ labs/jbossrules/branches/righttuple/drools-core/src/test/java/org/drools/reteoo/MockTupleSink.java	2008-01-04 01:54:45 UTC (rev 17533)
@@ -28,9 +28,9 @@
 import org.drools.common.NodeMemory;
 import org.drools.spi.PropagationContext;
 
-public class MockTupleSink extends TupleSource
+public class MockTupleSink extends LeftTupleSource
     implements
-    TupleSinkNode,
+    LeftTupleSinkNode,
     NodeMemory {
     /**
      * 
@@ -39,8 +39,8 @@
     private final List        asserted         = new ArrayList();
     private final List        retracted        = new ArrayList();
 
-    private TupleSinkNode     previousTupleSinkNode;
-    private TupleSinkNode     nextTupleSinkNode;
+    private LeftTupleSinkNode     previousTupleSinkNode;
+    private LeftTupleSinkNode     nextTupleSinkNode;
 
     public MockTupleSink() {
         super( 0 );
@@ -50,14 +50,14 @@
         super( id );
     }
 
-    public void assertTuple(final ReteTuple tuple,
+    public void assertTuple(final LeftTuple tuple,
                             final PropagationContext context,
                             final InternalWorkingMemory workingMemory) {
         this.asserted.add( new Object[]{tuple, context, workingMemory} );
 
     }
 
-    public void retractTuple(final ReteTuple tuple,
+    public void retractTuple(final LeftTuple tuple,
                              final PropagationContext context,
                              final InternalWorkingMemory workingMemory) {
         this.retracted.add( new Object[]{tuple, context, workingMemory} );
@@ -89,7 +89,7 @@
 
     }
 
-    public void updateSink(final TupleSink sink,
+    public void updateSink(final LeftTupleSink sink,
                            final PropagationContext context,
                            final InternalWorkingMemory workingMemory) throws FactException {
         // TODO Auto-generated method stub
@@ -108,7 +108,7 @@
     }
 
     public List getPropagatedTuples(final ReteooWorkingMemory workingMemory,
-                                    final TupleSink sink) {
+                                    final LeftTupleSink sink) {
         // TODO Auto-generated method stub
         return Collections.EMPTY_LIST;
     }
@@ -118,7 +118,7 @@
      * @return
      *      The next TupleSinkNode
      */
-    public TupleSinkNode getNextTupleSinkNode() {
+    public LeftTupleSinkNode getNextLeftTupleSinkNode() {
         return this.nextTupleSinkNode;
     }
 
@@ -127,7 +127,7 @@
      * @param next
      *      The next TupleSinkNode
      */
-    public void setNextTupleSinkNode(final TupleSinkNode next) {
+    public void setNextLeftTupleSinkNode(final LeftTupleSinkNode next) {
         this.nextTupleSinkNode = next;
     }
 
@@ -136,7 +136,7 @@
      * @return
      *      The previous TupleSinkNode
      */
-    public TupleSinkNode getPreviousTupleSinkNode() {
+    public LeftTupleSinkNode getPreviousRightTupleSinkNode() {
         return this.previousTupleSinkNode;
     }
 
@@ -145,7 +145,7 @@
      * @param previous
      *      The previous TupleSinkNode
      */
-    public void setPreviousTupleSinkNode(final TupleSinkNode previous) {
+    public void setPreviousLeftTupleSinkNode(final LeftTupleSinkNode previous) {
         this.previousTupleSinkNode = previous;
     }
 

Modified: labs/jbossrules/branches/righttuple/drools-core/src/test/java/org/drools/reteoo/MockTupleSource.java
===================================================================
--- labs/jbossrules/branches/righttuple/drools-core/src/test/java/org/drools/reteoo/MockTupleSource.java	2008-01-04 00:57:26 UTC (rev 17532)
+++ labs/jbossrules/branches/righttuple/drools-core/src/test/java/org/drools/reteoo/MockTupleSource.java	2008-01-04 01:54:45 UTC (rev 17533)
@@ -20,7 +20,7 @@
 import org.drools.common.InternalWorkingMemory;
 import org.drools.spi.PropagationContext;
 
-public class MockTupleSource extends TupleSource {
+public class MockTupleSource extends LeftTupleSource {
 
     /**
      * 
@@ -47,7 +47,7 @@
         return this.updated;
     }
 
-    public void updateSink(final TupleSink sink,
+    public void updateSink(final LeftTupleSink sink,
                            final PropagationContext context,
                            final InternalWorkingMemory workingMemory) {
         this.updated++;

Modified: labs/jbossrules/branches/righttuple/drools-core/src/test/java/org/drools/reteoo/NotNodeTest.java
===================================================================
--- labs/jbossrules/branches/righttuple/drools-core/src/test/java/org/drools/reteoo/NotNodeTest.java	2008-01-04 00:57:26 UTC (rev 17532)
+++ labs/jbossrules/branches/righttuple/drools-core/src/test/java/org/drools/reteoo/NotNodeTest.java	2008-01-04 01:54:45 UTC (rev 17533)
@@ -100,7 +100,7 @@
                                            10 );
         final DefaultFactHandle f0 = (DefaultFactHandle) this.workingMemory.insert( cheddar );
 
-        final ReteTuple tuple1 = new ReteTuple( f0 );
+        final LeftTuple tuple1 = new LeftTuple( f0 );
 
         this.node.assertTuple( tuple1,
                                this.context,
@@ -113,7 +113,7 @@
         assertLength( 0,
                       this.sink.getRetracted() );
 
-        assertEquals( new ReteTuple( f0 ),
+        assertEquals( new LeftTuple( f0 ),
                       ((Object[]) this.sink.getAsserted().get( 0 ))[0] );
 
         // assert will match, so propagated tuple should be retracted
@@ -121,7 +121,7 @@
                                         10 );
         final DefaultFactHandle f1 = (DefaultFactHandle) this.workingMemory.insert( brie );
 
-        this.node.assertObject( f1,
+        this.node.assertRightTuple( f1,
                                 this.context,
                                 this.workingMemory );
 
@@ -132,13 +132,13 @@
         assertLength( 1,
                       this.sink.getRetracted() );
 
-        assertEquals( new ReteTuple( f0 ),
+        assertEquals( new LeftTuple( f0 ),
                       ((Object[]) this.sink.getRetracted().get( 0 ))[0] );
 
         // assert tuple, will have matches, so no propagation
         final DefaultFactHandle f2 = (DefaultFactHandle) this.workingMemory.insert( new Cheese( "gouda",
                                                                                                 10 ) );
-        final ReteTuple tuple2 = new ReteTuple( f2 );
+        final LeftTuple tuple2 = new LeftTuple( f2 );
         this.node.assertTuple( tuple2,
                                this.context,
                                this.workingMemory );
@@ -152,12 +152,12 @@
 
         // check memory sizes
         assertEquals( 2,
-                      this.memory.getTupleMemory().size() );
+                      this.memory.getLeftTupleMemory().size() );
         assertEquals( 1,
-                      this.memory.getFactHandleMemory().size() );
+                      this.memory.getRightTupleMemory().size() );
 
         // When this is retracter both tuples should assert
-        this.node.retractObject( f1,
+        this.node.retractRightTuple( f1,
                                  this.context,
                                  this.workingMemory );
 
@@ -182,7 +182,7 @@
                                            10 );
         final DefaultFactHandle f0 = (DefaultFactHandle) this.workingMemory.insert( cheddar );
 
-        final ReteTuple tuple1 = new ReteTuple( f0 );
+        final LeftTuple tuple1 = new LeftTuple( f0 );
 
         this.node.assertTuple( tuple1,
                                this.context,
@@ -195,7 +195,7 @@
         assertLength( 0,
                       this.sink.getRetracted() );
 
-        assertEquals( new ReteTuple( f0 ),
+        assertEquals( new LeftTuple( f0 ),
                       ((Object[]) this.sink.getAsserted().get( 0 ))[0] );
 
         // assert will not match, so activation should stay propagated
@@ -203,7 +203,7 @@
                                         10 );
         final DefaultFactHandle f1 = (DefaultFactHandle) this.workingMemory.insert( brie );
 
-        this.node.assertObject( f1,
+        this.node.assertRightTuple( f1,
                                 this.context,
                                 this.workingMemory );
 
@@ -217,7 +217,7 @@
         // assert tuple, will have no matches, so do assert propagation
         final DefaultFactHandle f2 = (DefaultFactHandle) this.workingMemory.insert( new Cheese( "gouda",
                                                                                                 10 ) );
-        final ReteTuple tuple2 = new ReteTuple( f2 );
+        final LeftTuple tuple2 = new LeftTuple( f2 );
         this.node.assertTuple( tuple2,
                                this.context,
                                this.workingMemory );
@@ -241,7 +241,7 @@
             final Cheese cheddar = new Cheese( "cheddar",
                                                10 );
             final DefaultFactHandle f0 = (DefaultFactHandle) this.workingMemory.insert( cheddar );
-            final ReteTuple tuple1 = new ReteTuple( f0 );
+            final LeftTuple tuple1 = new LeftTuple( f0 );
 
             this.node.assertTuple( tuple1,
                                    this.context,
@@ -254,36 +254,36 @@
 
             // Initially, no objects in right memory
             assertEquals( 0,
-                          this.memory.getFactHandleMemory().size() );
-            this.node.assertObject( f1,
+                          this.memory.getRightTupleMemory().size() );
+            this.node.assertRightTuple( f1,
                                     this.context,
                                     this.workingMemory );
 
             // Now, needs to have 1 object in right memory
             assertEquals( 1,
-                          this.memory.getFactHandleMemory().size() );
+                          this.memory.getRightTupleMemory().size() );
 
             // simulate modify
-            this.node.retractObject( f1,
+            this.node.retractRightTuple( f1,
                                      this.context,
                                      this.workingMemory );
-            this.node.assertObject( f1,
+            this.node.assertRightTuple( f1,
                                     this.context,
                                     this.workingMemory );
             // Memory should not change
             assertEquals( 1,
-                          this.memory.getFactHandleMemory().size() );
+                          this.memory.getRightTupleMemory().size() );
 
             // When this is retracter both tuples should assert
-            this.node.retractObject( f1,
+            this.node.retractRightTuple( f1,
                                      this.context,
                                      this.workingMemory );
             assertEquals( 0,
-                          this.memory.getFactHandleMemory().size() );
+                          this.memory.getRightTupleMemory().size() );
 
             // check memory sizes
             assertEquals( 1,
-                          this.memory.getTupleMemory().size() );
+                          this.memory.getLeftTupleMemory().size() );
 
             // simulate modify
             this.node.retractTuple( tuple1,
@@ -293,12 +293,12 @@
                                    this.context,
                                    this.workingMemory );
             assertEquals( 1,
-                          this.memory.getTupleMemory().size() );
+                          this.memory.getLeftTupleMemory().size() );
             this.node.retractTuple( tuple1,
                                     this.context,
                                     this.workingMemory );
             assertEquals( 0,
-                          this.memory.getTupleMemory().size() );
+                          this.memory.getLeftTupleMemory().size() );
         } catch ( final Exception e ) {
             Assert.fail( "No exception should be raised in this procedure, but got: " + e.toString() );
         }
@@ -355,9 +355,9 @@
 
         final DefaultFactHandle f0 = new DefaultFactHandle( 0,
                                                             "cheese" );
-        final ReteTuple tuple0 = new ReteTuple( f0 );
+        final LeftTuple tuple0 = new LeftTuple( f0 );
 
-        this.node.assertObject( f0,
+        this.node.assertRightTuple( f0,
                                 this.context,
                                 this.workingMemory );
 
@@ -369,10 +369,10 @@
         assertEquals( 0,
                       this.sink.getAsserted().size() );
 
-        assertNull( this.memory.getTupleMemory() );
+        assertNull( this.memory.getLeftTupleMemory() );
 
         assertEquals( 1,
-                      this.memory.getFactHandleMemory().size() );
+                      this.memory.getRightTupleMemory().size() );
 
     }
 

Modified: labs/jbossrules/branches/righttuple/drools-core/src/test/java/org/drools/reteoo/ObjectSourceTest.java
===================================================================
--- labs/jbossrules/branches/righttuple/drools-core/src/test/java/org/drools/reteoo/ObjectSourceTest.java	2008-01-04 00:57:26 UTC (rev 17532)
+++ labs/jbossrules/branches/righttuple/drools-core/src/test/java/org/drools/reteoo/ObjectSourceTest.java	2008-01-04 01:54:45 UTC (rev 17533)
@@ -38,52 +38,52 @@
         final MockObjectSource source = new MockObjectSource( 15 );
 
         // We need to re-assign this var each time the sink changes references
-        final Field field = ObjectSource.class.getDeclaredField( "sink" );
+        final Field field = RightTupleSource.class.getDeclaredField( "sink" );
         field.setAccessible( true );
-        ObjectSinkPropagator sink = (ObjectSinkPropagator) field.get( source );
+        RightTupletSinkPropagator sink = (RightTupletSinkPropagator) field.get( source );
 
-        assertSame( EmptyObjectSinkAdapter.getInstance(),
+        assertSame( EmptyRightTupleSinkAdapter.getInstance(),
                     sink );
 
         final MockObjectSink sink1 = new MockObjectSink();
         source.addObjectSink( sink1 );
-        sink = (ObjectSinkPropagator) field.get( source );
-        assertSame( SingleObjectSinkAdapter.class,
+        sink = (RightTupletSinkPropagator) field.get( source );
+        assertSame( SingleRightTupletSinkAdapter.class,
                     sink.getClass() );
         assertEquals( 1,
                       sink.getSinks().length );
 
         final MockObjectSink sink2 = new MockObjectSink();
         source.addObjectSink( sink2 );
-        sink = (ObjectSinkPropagator) field.get( source );
-        assertSame( CompositeObjectSinkAdapter.class,
+        sink = (RightTupletSinkPropagator) field.get( source );
+        assertSame( CompositeRightTupleSinkAdapter.class,
                     sink.getClass() );
         assertEquals( 2,
                       sink.getSinks().length );
 
         final MockObjectSink sink3 = new MockObjectSink();
         source.addObjectSink( sink3 );
-        assertSame( CompositeObjectSinkAdapter.class,
+        assertSame( CompositeRightTupleSinkAdapter.class,
                     sink.getClass() );
         assertEquals( 3,
                       sink.getSinks().length );
 
         source.removeObjectSink( sink2 );
-        assertSame( CompositeObjectSinkAdapter.class,
+        assertSame( CompositeRightTupleSinkAdapter.class,
                     sink.getClass() );
         assertEquals( 2,
                       sink.getSinks().length );
 
         source.removeObjectSink( sink1 );
-        sink = (ObjectSinkPropagator) field.get( source );
-        assertSame( SingleObjectSinkAdapter.class,
+        sink = (RightTupletSinkPropagator) field.get( source );
+        assertSame( SingleRightTupletSinkAdapter.class,
                     sink.getClass() );
         assertEquals( 1,
                       sink.getSinks().length );
 
         source.removeObjectSink( sink3 );
-        sink = (ObjectSinkPropagator) field.get( source );
-        assertSame( EmptyObjectSinkAdapter.getInstance(),
+        sink = (RightTupletSinkPropagator) field.get( source );
+        assertSame( EmptyRightTupleSinkAdapter.getInstance(),
                     sink );
         assertEquals( 0,
                       sink.getSinks().length );

Modified: labs/jbossrules/branches/righttuple/drools-core/src/test/java/org/drools/reteoo/ObjectTypeNodeTest.java
===================================================================
--- labs/jbossrules/branches/righttuple/drools-core/src/test/java/org/drools/reteoo/ObjectTypeNodeTest.java	2008-01-04 00:57:26 UTC (rev 17532)
+++ labs/jbossrules/branches/righttuple/drools-core/src/test/java/org/drools/reteoo/ObjectTypeNodeTest.java	2008-01-04 01:54:45 UTC (rev 17533)
@@ -105,7 +105,7 @@
         final InternalFactHandle handle1 = (InternalFactHandle) workingMemory.insert( string1 );
 
         // should assert as ObjectType matches
-        objectTypeNode.assertObject( handle1,
+        objectTypeNode.assertRightTuple( handle1,
                                      context,
                                      workingMemory );
 
@@ -152,7 +152,7 @@
         final InternalFactHandle handle1 = (InternalFactHandle) workingMemory.insert( string1 );
 
         // should assert as ObjectType matches
-        objectTypeNode.assertObject( handle1,
+        objectTypeNode.assertRightTuple( handle1,
                                      context,
                                      workingMemory );
 
@@ -232,7 +232,7 @@
                                                                  string1 );
 
         /* should assert as ObjectType matches */
-        objectTypeNode.assertObject( handle1,
+        objectTypeNode.assertRightTuple( handle1,
                                      context,
                                      workingMemory );
         /* check asserted object was added to memory */
@@ -241,7 +241,7 @@
                       memory.size() );
 
         /* should retract as ObjectType matches */
-        objectTypeNode.retractObject( handle1,
+        objectTypeNode.retractRightTuple( handle1,
                                       context,
                                       workingMemory );
         /* check asserted object was removed from memory */
@@ -286,11 +286,11 @@
         final DefaultFactHandle handle2 = new DefaultFactHandle( 2,
                                                                  string2 );
 
-        objectTypeNode.assertObject( handle1,
+        objectTypeNode.assertRightTuple( handle1,
                                      context,
                                      workingMemory );
 
-        objectTypeNode.assertObject( handle2,
+        objectTypeNode.assertRightTuple( handle2,
                                      context,
                                      workingMemory );
 
@@ -315,7 +315,7 @@
         final DefaultFactHandle handle3 = new DefaultFactHandle( 3,
                                                                  string3 );
 
-        objectTypeNode.assertObject( handle3,
+        objectTypeNode.assertRightTuple( handle3,
                                      context,
                                      workingMemory );
 
@@ -389,7 +389,7 @@
         final InternalFactHandle handle1 = (InternalFactHandle) workingMemory.insert( person );
 
         // should assert as ObjectType matches
-        objectTypeNode.assertObject( handle1,
+        objectTypeNode.assertRightTuple( handle1,
                                      context,
                                      workingMemory );
 

Modified: labs/jbossrules/branches/righttuple/drools-core/src/test/java/org/drools/reteoo/ReteTest.java
===================================================================
--- labs/jbossrules/branches/righttuple/drools-core/src/test/java/org/drools/reteoo/ReteTest.java	2008-01-04 00:57:26 UTC (rev 17532)
+++ labs/jbossrules/branches/righttuple/drools-core/src/test/java/org/drools/reteoo/ReteTest.java	2008-01-04 01:54:45 UTC (rev 17533)
@@ -117,7 +117,7 @@
         // ArrayList matches all three ObjectTypeNodes
         final DefaultFactHandle h1 = new DefaultFactHandle( 1,
                                                             new ArrayList() );
-        rete.assertObject( h1,
+        rete.assertRightTuple( h1,
                            new PropagationContextImpl( 0,
                                                        PropagationContext.ASSERTION,
                                                        null,
@@ -126,7 +126,7 @@
 
         // LinkedList matches two ObjectTypeNodes        
         h1.setObject( new LinkedList() );
-        rete.assertObject( h1,
+        rete.assertRightTuple( h1,
                            new PropagationContextImpl( 0,
                                                        PropagationContext.ASSERTION,
                                                        null,
@@ -167,7 +167,7 @@
         final DefaultFactHandle h1 = new DefaultFactHandle( 1,
                                                             string );
 
-        rete.assertObject( h1,
+        rete.assertRightTuple( h1,
                            new PropagationContextImpl( 0,
                                                        PropagationContext.ASSERTION,
                                                        null,
@@ -182,7 +182,7 @@
         final DefaultFactHandle h2 = new DefaultFactHandle( 1,
                                                             list );
 
-        rete.assertObject( h2,
+        rete.assertRightTuple( h2,
                            new PropagationContextImpl( 0,
                                                        PropagationContext.ASSERTION,
                                                        null,
@@ -305,7 +305,7 @@
         final DefaultFactHandle h1 = new DefaultFactHandle( 1,
                                                             string );
 
-        rete.assertObject( h1,
+        rete.assertRightTuple( h1,
                            new PropagationContextImpl( 0,
                                                        PropagationContext.ASSERTION,
                                                        null,
@@ -322,14 +322,14 @@
                                                             list );
 
         // need  to assert first, to force it to build  up the cache
-        rete.assertObject( h2,
+        rete.assertRightTuple( h2,
                            new PropagationContextImpl( 0,
                                                        PropagationContext.ASSERTION,
                                                        null,
                                                        null ),
                            workingMemory );
 
-        rete.retractObject( h2,
+        rete.retractRightTuple( h2,
                             new PropagationContextImpl( 0,
                                                         PropagationContext.ASSERTION,
                                                         null,
@@ -364,7 +364,7 @@
         final DefaultFactHandle h1 = new DefaultFactHandle( 1,
                                                             cheese );
 
-        rete.assertObject( h1,
+        rete.assertRightTuple( h1,
                            new PropagationContextImpl( 0,
                                                        PropagationContext.ASSERTION,
                                                        null,
@@ -404,7 +404,7 @@
         final DefaultFactHandle h1 = new DefaultFactHandle( 1,
                                                             cheese );
 
-        rete.assertObject( h1,
+        rete.assertRightTuple( h1,
                            new PropagationContextImpl( 0,
                                                        PropagationContext.ASSERTION,
                                                        null,

Modified: labs/jbossrules/branches/righttuple/drools-core/src/test/java/org/drools/reteoo/RuleFlowGroupTest.java
===================================================================
--- labs/jbossrules/branches/righttuple/drools-core/src/test/java/org/drools/reteoo/RuleFlowGroupTest.java	2008-01-04 00:57:26 UTC (rev 17532)
+++ labs/jbossrules/branches/righttuple/drools-core/src/test/java/org/drools/reteoo/RuleFlowGroupTest.java	2008-01-04 01:54:45 UTC (rev 17533)
@@ -198,31 +198,31 @@
         final RuleFlowGroupImpl ruleFlowGroup2 = (RuleFlowGroupImpl) agenda.getRuleFlowGroup( "rule-flow-group-2" );
         final RuleFlowGroupImpl ruleFlowGroup3 = (RuleFlowGroupImpl) agenda.getRuleFlowGroup( "rule-flow-group-3" );
 
-        final ReteTuple tuple0 = new ReteTuple( new DefaultFactHandle( 1,
+        final LeftTuple tuple0 = new LeftTuple( new DefaultFactHandle( 1,
                                                                        "cheese" ) );
         node0.assertTuple( tuple0,
                            context0,
                            workingMemory );
 
-        final ReteTuple tuple1 = new ReteTuple( new DefaultFactHandle( 1,
+        final LeftTuple tuple1 = new LeftTuple( new DefaultFactHandle( 1,
                                                                        "cheese" ) );
         node0.assertTuple( tuple1,
                            context0,
                            workingMemory );
 
-        final ReteTuple tuple2 = new ReteTuple( new DefaultFactHandle( 1,
+        final LeftTuple tuple2 = new LeftTuple( new DefaultFactHandle( 1,
                                                                        "cheese" ) );
         node1.assertTuple( tuple2,
                            context0,
                            workingMemory );
 
-        final ReteTuple tuple3 = new ReteTuple( new DefaultFactHandle( 1,
+        final LeftTuple tuple3 = new LeftTuple( new DefaultFactHandle( 1,
                                                                        "cheese" ) );
         node2.assertTuple( tuple3,
                            context0,
                            workingMemory );
 
-        final ReteTuple tuple4 = new ReteTuple( new DefaultFactHandle( 1,
+        final LeftTuple tuple4 = new LeftTuple( new DefaultFactHandle( 1,
                                                                        "cheese" ) );
         node3.assertTuple( tuple4,
                            context0,
@@ -472,43 +472,43 @@
         final RuleFlowGroupImpl ruleFlowGroup2 = (RuleFlowGroupImpl) agenda.getRuleFlowGroup( "rule-flow-group-2" );
         final RuleFlowGroupImpl ruleFlowGroup3 = (RuleFlowGroupImpl) agenda.getRuleFlowGroup( "rule-flow-group-3" );
 
-        final ReteTuple tuple0 = new ReteTuple( new DefaultFactHandle( 1,
+        final LeftTuple tuple0 = new LeftTuple( new DefaultFactHandle( 1,
                                                                        "cheese" ) );
         node0.assertTuple( tuple0,
                            context0,
                            workingMemory );
 
-        final ReteTuple tuple1 = new ReteTuple( new DefaultFactHandle( 1,
+        final LeftTuple tuple1 = new LeftTuple( new DefaultFactHandle( 1,
                                                                        "cheese" ) );
         node0.assertTuple( tuple1,
                            context0,
                            workingMemory );
 
-        final ReteTuple tuple2 = new ReteTuple( new DefaultFactHandle( 1,
+        final LeftTuple tuple2 = new LeftTuple( new DefaultFactHandle( 1,
                                                                        "cheese" ) );
         node1.assertTuple( tuple2,
                            context0,
                            workingMemory );
 
-        final ReteTuple tuple3 = new ReteTuple( new DefaultFactHandle( 1,
+        final LeftTuple tuple3 = new LeftTuple( new DefaultFactHandle( 1,
                                                                        "cheese" ) );
         node2.assertTuple( tuple3,
                            context0,
                            workingMemory );
 
-        final ReteTuple tuple4 = new ReteTuple( new DefaultFactHandle( 1,
+        final LeftTuple tuple4 = new LeftTuple( new DefaultFactHandle( 1,
                                                                        "cheese" ) );
         node3.assertTuple( tuple4,
                            context0,
                            workingMemory );
 
-        final ReteTuple splitTuple1 = new ReteTuple( new DefaultFactHandle( 1,
+        final LeftTuple splitTuple1 = new LeftTuple( new DefaultFactHandle( 1,
                                                                             "cheese" ) );
         splitNode1.assertTuple( splitTuple1,
                                 context0,
                                 workingMemory );
 
-        final ReteTuple splitTuple2 = new ReteTuple( new DefaultFactHandle( 1,
+        final LeftTuple splitTuple2 = new LeftTuple( new DefaultFactHandle( 1,
                                                                             "cheese" ) );
         splitNode2.assertTuple( splitTuple2,
                                 context0,

Modified: labs/jbossrules/branches/righttuple/drools-core/src/test/java/org/drools/reteoo/SchedulerTest.java
===================================================================
--- labs/jbossrules/branches/righttuple/drools-core/src/test/java/org/drools/reteoo/SchedulerTest.java	2008-01-04 00:57:26 UTC (rev 17532)
+++ labs/jbossrules/branches/righttuple/drools-core/src/test/java/org/drools/reteoo/SchedulerTest.java	2008-01-04 01:54:45 UTC (rev 17533)
@@ -93,7 +93,7 @@
                                                                        null,
                                                                        null );
 
-        final ReteTuple tuple = new ReteTuple( new DefaultFactHandle( 1,
+        final LeftTuple tuple = new LeftTuple( new DefaultFactHandle( 1,
                                                                       "cheese" ) );
 
         assertEquals( 0,
@@ -155,7 +155,7 @@
                                                                                     0,
                                                                                     rule,
                                                                                     knowledgeHelper.getActivation() );
-                    final ReteTuple tuple2 = new ReteTuple( new DefaultFactHandle( 2,
+                    final LeftTuple tuple2 = new LeftTuple( new DefaultFactHandle( 2,
                                                                                    "cheese" ) );
                     node.assertTuple( tuple2,
                                       context2,
@@ -170,7 +170,7 @@
                                                                         null,
                                                                         null );
 
-        final ReteTuple tuple1 = new ReteTuple( new DefaultFactHandle( 1,
+        final LeftTuple tuple1 = new LeftTuple( new DefaultFactHandle( 1,
                                                                        "cheese" ) );
 
         node.assertTuple( tuple1,
@@ -236,7 +236,7 @@
                                                                                     0,
                                                                                     rule,
                                                                                     knowledgeHelper.getActivation() );
-                    final ReteTuple tuple2 = new ReteTuple( new DefaultFactHandle( 2,
+                    final LeftTuple tuple2 = new LeftTuple( new DefaultFactHandle( 2,
                                                                                    "cheese" ) );
                     node.assertTuple( tuple2,
                                       context2,
@@ -251,7 +251,7 @@
                                                                         null,
                                                                         null );
 
-        final ReteTuple tuple1 = new ReteTuple( new DefaultFactHandle( 1,
+        final LeftTuple tuple1 = new LeftTuple( new DefaultFactHandle( 1,
                                                                        "cheese" ) );
         node.assertTuple( tuple1,
                           context1,

Modified: labs/jbossrules/branches/righttuple/drools-core/src/test/java/org/drools/reteoo/TupleSourceTest.java
===================================================================
--- labs/jbossrules/branches/righttuple/drools-core/src/test/java/org/drools/reteoo/TupleSourceTest.java	2008-01-04 00:57:26 UTC (rev 17532)
+++ labs/jbossrules/branches/righttuple/drools-core/src/test/java/org/drools/reteoo/TupleSourceTest.java	2008-01-04 01:54:45 UTC (rev 17533)
@@ -32,24 +32,24 @@
         final MockTupleSource source = new MockTupleSource( 15 );
 
         // We need to re-assign this var each time the sink changes references
-        final Field field = TupleSource.class.getDeclaredField( "sink" );
+        final Field field = LeftTupleSource.class.getDeclaredField( "sink" );
         field.setAccessible( true );
-        TupleSinkPropagator sink = (TupleSinkPropagator) field.get( source );
+        LeftTupleSinkPropagator sink = (LeftTupleSinkPropagator) field.get( source );
 
-        assertSame( EmptyTupleSinkAdapter.getInstance(),
+        assertSame( EmptyLeftTupleSinkAdapter.getInstance(),
                     sink );
 
         final MockTupleSink sink1 = new MockTupleSink();
         source.addTupleSink( sink1 );
-        sink = (TupleSinkPropagator) field.get( source );
-        assertSame( SingleTupleSinkAdapter.class,
+        sink = (LeftTupleSinkPropagator) field.get( source );
+        assertSame( SingleLeftTupleSinkAdapter.class,
                     sink.getClass() );
         assertEquals( 1,
                       sink.getSinks().length );
 
         final MockTupleSink sink2 = new MockTupleSink();
         source.addTupleSink( sink2 );
-        sink = (TupleSinkPropagator) field.get( source );
+        sink = (LeftTupleSinkPropagator) field.get( source );
         assertSame( CompositeTupleSinkAdapter.class,
                     sink.getClass() );
         assertEquals( 2,
@@ -69,15 +69,15 @@
                       sink.getSinks().length );
 
         source.removeTupleSink( sink1 );
-        sink = (TupleSinkPropagator) field.get( source );
-        assertSame( SingleTupleSinkAdapter.class,
+        sink = (LeftTupleSinkPropagator) field.get( source );
+        assertSame( SingleLeftTupleSinkAdapter.class,
                     sink.getClass() );
         assertEquals( 1,
                       sink.getSinks().length );
 
         source.removeTupleSink( sink3 );
-        sink = (TupleSinkPropagator) field.get( source );
-        assertSame( EmptyTupleSinkAdapter.getInstance(),
+        sink = (LeftTupleSinkPropagator) field.get( source );
+        assertSame( EmptyLeftTupleSinkAdapter.getInstance(),
                     sink );
         assertEquals( 0,
                       sink.getSinks().length );

Modified: labs/jbossrules/branches/righttuple/drools-core/src/test/java/org/drools/spi/MockConstraint.java
===================================================================
--- labs/jbossrules/branches/righttuple/drools-core/src/test/java/org/drools/spi/MockConstraint.java	2008-01-04 00:57:26 UTC (rev 17532)
+++ labs/jbossrules/branches/righttuple/drools-core/src/test/java/org/drools/spi/MockConstraint.java	2008-01-04 01:54:45 UTC (rev 17533)
@@ -19,7 +19,7 @@
 import org.drools.WorkingMemory;
 import org.drools.common.InternalFactHandle;
 import org.drools.common.InternalWorkingMemory;
-import org.drools.reteoo.ReteTuple;
+import org.drools.reteoo.LeftTuple;
 import org.drools.rule.ContextEntry;
 import org.drools.rule.Declaration;
 
@@ -72,7 +72,7 @@
             }
 
             public void updateFromTuple(final InternalWorkingMemory workingMemory,
-                                        final ReteTuple tuple) {
+                                        final LeftTuple tuple) {
             }
         };
     }
@@ -82,7 +82,7 @@
         return this.isAllowed;
     }
 
-    public boolean isAllowedCachedRight(final ReteTuple tuple,
+    public boolean isAllowedCachedRight(final LeftTuple tuple,
                                         final ContextEntry context) {
         return this.isAllowed;
     }

Modified: labs/jbossrules/branches/righttuple/drools-core/src/test/java/org/drools/util/FieldIndexHashTableTest.java
===================================================================
--- labs/jbossrules/branches/righttuple/drools-core/src/test/java/org/drools/util/FieldIndexHashTableTest.java	2008-01-04 00:57:26 UTC (rev 17532)
+++ labs/jbossrules/branches/righttuple/drools-core/src/test/java/org/drools/util/FieldIndexHashTableTest.java	2008-01-04 01:54:45 UTC (rev 17533)
@@ -14,7 +14,7 @@
 import org.drools.base.evaluators.Operator;
 import org.drools.common.DefaultFactHandle;
 import org.drools.common.InternalFactHandle;
-import org.drools.reteoo.ReteTuple;
+import org.drools.reteoo.LeftTuple;
 import org.drools.rule.Declaration;
 import org.drools.rule.Pattern;
 import org.drools.spi.FieldExtractor;
@@ -52,7 +52,7 @@
 
         assertEquals( 0,
                       map.size() );
-        assertNull( map.get( new ReteTuple( cheddarHandle1 ) ) );
+        assertNull( map.get( new LeftTuple( cheddarHandle1 ) ) );
 
         final Cheese stilton1 = new Cheese( "stilton",
                                             35 );
@@ -70,7 +70,7 @@
         final InternalFactHandle stiltonHandle2 = new DefaultFactHandle( 2,
                                                                          stilton2 );
 
-        final FieldIndexEntry stiltonEntry = map.get( new ReteTuple( stiltonHandle2 ) );
+        final FieldIndexEntry stiltonEntry = map.get( new LeftTuple( stiltonHandle2 ) );
         assertSame( stiltonHandle1,
                     stiltonEntry.getFirst().getFactHandle() );
         assertNull( stiltonEntry.getFirst().getNext() );
@@ -118,7 +118,7 @@
                                             77 );
         final InternalFactHandle stiltonHandle2 = new DefaultFactHandle( 2,
                                                                          stilton2 );
-        final FieldIndexEntry stiltonEntry = map.get( new ReteTuple( stiltonHandle2 ) );
+        final FieldIndexEntry stiltonEntry = map.get( new LeftTuple( stiltonHandle2 ) );
         assertSame( stiltonHandle1,
                     stiltonEntry.getFirst().getFactHandle() );
         assertNull( stiltonEntry.getFirst().getNext() );
@@ -127,7 +127,7 @@
                                             5 );
         final InternalFactHandle cheddarHandle2 = new DefaultFactHandle( 2,
                                                                          cheddar2 );
-        final FieldIndexEntry cheddarEntry = map.get( new ReteTuple( cheddarHandle2 ) );
+        final FieldIndexEntry cheddarEntry = map.get( new LeftTuple( cheddarHandle2 ) );
         assertSame( cheddarHandle1,
                     cheddarEntry.getFirst().getFactHandle() );
         assertNull( cheddarEntry.getFirst().getNext() );
@@ -183,7 +183,7 @@
         final InternalFactHandle stiltonHandle3 = new DefaultFactHandle( 4,
                                                                          stilton2 );
 
-        final FieldIndexEntry stiltonEntry = map.get( new ReteTuple( stiltonHandle3 ) );
+        final FieldIndexEntry stiltonEntry = map.get( new LeftTuple( stiltonHandle3 ) );
         assertSame( stiltonHandle2,
                     stiltonEntry.getFirst().getFactHandle() );
         assertSame( stiltonHandle1,
@@ -544,7 +544,7 @@
         final InternalFactHandle stiltonHandle = new DefaultFactHandle( 2,
                                                                         stilton );
 
-        final Iterator it = map.iterator( new ReteTuple( stiltonHandle ) );
+        final Iterator it = map.iterator( new LeftTuple( stiltonHandle ) );
         for ( ObjectEntry entry = (ObjectEntry) it.next(); entry != null; entry = (ObjectEntry) it.next() ) {
             fail( "Map is empty, there should be no iteration" );
         }




More information about the jboss-svn-commits mailing list