[jboss-svn-commits] JBL Code SVN: r19138 - in labs/jbossrules/trunk/drools-core/src: main/java/org/drools/common and 9 other directories.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Thu Mar 20 09:28:05 EDT 2008
Author: mark.proctor at jboss.com
Date: 2008-03-20 09:28:04 -0400 (Thu, 20 Mar 2008)
New Revision: 19138
Added:
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/LeftTuple.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/LeftTupleMemory.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/LeftTupleSink.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/LeftTupleSinkNode.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/LeftTupleSinkNodeList.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/LeftTupleSinkPropagator.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/LeftTupleSource.java
Removed:
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/ReteTuple.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/TupleMemory.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/TupleSink.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/TupleSinkNode.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/TupleSinkNodeList.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/TupleSinkPropagator.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/TupleSource.java
Modified:
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/base/mvel/DroolsMVELFactory.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/common/BetaConstraints.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/common/DefaultBetaConstraints.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/common/DoubleBetaConstraints.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/common/EmptyBetaConstraints.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/common/InstanceEqualsConstraint.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/common/InstanceNotEqualsConstraint.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/common/PropagationContextImpl.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/common/QuadroupleBetaConstraints.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/common/SingleBetaConstraints.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/common/TripleBetaConstraints.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/common/TupleStartEqualsConstraint.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/conflict/TotalRecencyConflictResolver.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/AccumulateNode.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/BetaMemory.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/BetaNode.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/CollectNode.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/CompositeTupleSinkAdapter.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/EmptyTupleSinkAdapter.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/EvalConditionNode.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/ExistsNode.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/FactHandleMemory.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/FromNode.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/JoinNode.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/LIANodePropagation.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/LeftInputAdapterNode.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/MemoryVisitor.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/NotNode.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/ObjectSinkNode.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/ObjectTypeNode.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/QueryTerminalNode.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/RightInputAdapterNode.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/RuleRemovalContext.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/RuleTerminalNode.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/SingleTupleSinkAdapter.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/builder/AccumulateBuilder.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/builder/BuildContext.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/builder/BuildUtils.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/builder/CollectBuilder.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/builder/EvalBuilder.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/builder/FromBuilder.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/builder/GroupElementBuilder.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/rule/AbstractCompositeConstraint.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/rule/AbstractCompositeRestriction.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/rule/AndCompositeRestriction.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/rule/AndConstraint.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/rule/ContextEntry.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/rule/LiteralRestriction.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/rule/MultiRestrictionFieldConstraint.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/rule/OrCompositeRestriction.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/rule/OrConstraint.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/rule/PredicateConstraint.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/rule/ReturnValueConstraint.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/rule/ReturnValueRestriction.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/rule/VariableConstraint.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/rule/VariableRestriction.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/spi/BetaNodeFieldConstraint.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/spi/PropagationContext.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/spi/Restriction.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/util/AbstractHashTable.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/util/FactHandleIndexHashTable.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/util/FactHashTable.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/util/FactList.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/util/TupleHashTable.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/util/TupleIndexHashTable.java
labs/jbossrules/trunk/drools-core/src/test/java/org/drools/reteoo/AccumulateNodeTest.java
labs/jbossrules/trunk/drools-core/src/test/java/org/drools/reteoo/AgendaTest.java
labs/jbossrules/trunk/drools-core/src/test/java/org/drools/reteoo/BetaNodeTest.java
labs/jbossrules/trunk/drools-core/src/test/java/org/drools/reteoo/CollectNodeTest.java
labs/jbossrules/trunk/drools-core/src/test/java/org/drools/reteoo/CompositeObjectSinkAdapterTest.java
labs/jbossrules/trunk/drools-core/src/test/java/org/drools/reteoo/EvalConditionNodeTest.java
labs/jbossrules/trunk/drools-core/src/test/java/org/drools/reteoo/ExistsNodeTest.java
labs/jbossrules/trunk/drools-core/src/test/java/org/drools/reteoo/FromNodeTest.java
labs/jbossrules/trunk/drools-core/src/test/java/org/drools/reteoo/InstrumentedReteTuple.java
labs/jbossrules/trunk/drools-core/src/test/java/org/drools/reteoo/JoinNodeTest.java
labs/jbossrules/trunk/drools-core/src/test/java/org/drools/reteoo/LogicalAssertionTest.java
labs/jbossrules/trunk/drools-core/src/test/java/org/drools/reteoo/MockTupleSink.java
labs/jbossrules/trunk/drools-core/src/test/java/org/drools/reteoo/MockTupleSource.java
labs/jbossrules/trunk/drools-core/src/test/java/org/drools/reteoo/NotNodeTest.java
labs/jbossrules/trunk/drools-core/src/test/java/org/drools/reteoo/RuleFlowGroupTest.java
labs/jbossrules/trunk/drools-core/src/test/java/org/drools/reteoo/SchedulerTest.java
labs/jbossrules/trunk/drools-core/src/test/java/org/drools/reteoo/TupleSourceTest.java
labs/jbossrules/trunk/drools-core/src/test/java/org/drools/spi/MockConstraint.java
labs/jbossrules/trunk/drools-core/src/test/java/org/drools/util/FieldIndexHashTableTest.java
Log:
JBRULES-1520 RightTuple merge for asynchronous Rete propagations
-Started renaming ReteTuple to LeftTuple
Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/base/mvel/DroolsMVELFactory.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/base/mvel/DroolsMVELFactory.java 2008-03-20 12:55:29 UTC (rev 19137)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/base/mvel/DroolsMVELFactory.java 2008-03-20 13:28:04 UTC (rev 19138)
@@ -13,7 +13,7 @@
import java.util.Map;
import org.drools.WorkingMemory;
-import org.drools.reteoo.ReteTuple;
+import org.drools.reteoo.LeftTuple;
import org.drools.rule.Declaration;
import org.drools.spi.KnowledgeHelper;
import org.drools.spi.Tuple;
@@ -153,7 +153,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/trunk/drools-core/src/main/java/org/drools/common/BetaConstraints.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/common/BetaConstraints.java 2008-03-20 12:55:29 UTC (rev 19137)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/common/BetaConstraints.java 2008-03-20 13:28:04 UTC (rev 19138)
@@ -2,7 +2,7 @@
import org.drools.RuleBaseConfiguration;
import org.drools.reteoo.BetaMemory;
-import org.drools.reteoo.ReteTuple;
+import org.drools.reteoo.LeftTuple;
import org.drools.rule.ContextEntry;
import org.drools.util.LinkedList;
@@ -16,7 +16,7 @@
public void updateFromTuple(ContextEntry[] context,
InternalWorkingMemory workingMemory,
- ReteTuple tuple);
+ LeftTuple tuple);
public void updateFromFactHandle(ContextEntry[] context,
InternalWorkingMemory workingMemory,
@@ -26,7 +26,7 @@
InternalFactHandle handle);
public boolean isAllowedCachedRight(ContextEntry[] context,
- ReteTuple tuple);
+ LeftTuple tuple);
public LinkedList getConstraints();
Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/common/DefaultBetaConstraints.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/common/DefaultBetaConstraints.java 2008-03-20 12:55:29 UTC (rev 19137)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/common/DefaultBetaConstraints.java 2008-03-20 13:28:04 UTC (rev 19138)
@@ -20,8 +20,8 @@
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.LeftTuple;
+import org.drools.reteoo.LeftTupleMemory;
import org.drools.rule.ContextEntry;
import org.drools.rule.VariableConstraint;
import org.drools.spi.BetaNodeFieldConstraint;
@@ -137,7 +137,7 @@
*/
public void updateFromTuple(final ContextEntry[] context,
final InternalWorkingMemory workingMemory,
- final ReteTuple tuple) {
+ final LeftTuple tuple) {
for ( int i = 0; i < context.length; i++ ) {
context[i].updateFromTuple( workingMemory,
tuple );
@@ -192,7 +192,7 @@
* @see org.drools.common.BetaNodeConstraints#isAllowedCachedRight(org.drools.reteoo.ReteTuple)
*/
public boolean isAllowedCachedRight(final ContextEntry[] context,
- final ReteTuple tuple) {
+ final LeftTuple tuple) {
// skip the indexed constraints
LinkedListEntry entry = (LinkedListEntry) findNode( this.indexed+1 );
@@ -238,7 +238,7 @@
}
final FieldIndex[] indexes = (FieldIndex[]) list.toArray( new FieldIndex[list.size()] );
- TupleMemory tupleMemory;
+ LeftTupleMemory tupleMemory;
if ( config.isIndexLeftBetaMemory() ) {
tupleMemory = new TupleIndexHashTable( indexes );
} else {
Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/common/DoubleBetaConstraints.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/common/DoubleBetaConstraints.java 2008-03-20 12:55:29 UTC (rev 19137)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/common/DoubleBetaConstraints.java 2008-03-20 13:28:04 UTC (rev 19138)
@@ -20,8 +20,8 @@
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.LeftTuple;
+import org.drools.reteoo.LeftTupleMemory;
import org.drools.rule.ContextEntry;
import org.drools.rule.VariableConstraint;
import org.drools.spi.BetaNodeFieldConstraint;
@@ -135,7 +135,7 @@
*/
public void updateFromTuple(final ContextEntry[] context,
final InternalWorkingMemory workingMemory,
- final ReteTuple tuple) {
+ final LeftTuple tuple) {
context[0].updateFromTuple( workingMemory,
tuple );
context[1].updateFromTuple( workingMemory,
@@ -178,7 +178,7 @@
* @see org.drools.common.BetaNodeConstraints#isAllowedCachedRight(org.drools.reteoo.ReteTuple)
*/
public boolean isAllowedCachedRight(final ContextEntry[] context,
- final ReteTuple tuple) {
+ final LeftTuple tuple) {
return this.constraint0.isAllowedCachedRight( tuple,
context[0] ) && this.constraint1.isAllowedCachedRight( tuple,
context[1] );
@@ -227,7 +227,7 @@
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 {
Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/common/EmptyBetaConstraints.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/common/EmptyBetaConstraints.java 2008-03-20 12:55:29 UTC (rev 19137)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/common/EmptyBetaConstraints.java 2008-03-20 13:28:04 UTC (rev 19138)
@@ -19,7 +19,7 @@
import org.drools.RuleBaseConfiguration;
import org.drools.reteoo.BetaMemory;
import org.drools.reteoo.FactHandleMemory;
-import org.drools.reteoo.ReteTuple;
+import org.drools.reteoo.LeftTuple;
import org.drools.rule.ContextEntry;
import org.drools.util.FactHashTable;
import org.drools.util.FactList;
@@ -59,7 +59,7 @@
*/
public void updateFromTuple(final ContextEntry[] context,
final InternalWorkingMemory workingMemory,
- final ReteTuple tuple) {
+ final LeftTuple tuple) {
}
/* (non-Javadoc)
@@ -88,7 +88,7 @@
* @see org.drools.common.BetaNodeConstraints#isAllowedCachedRight(org.drools.reteoo.ReteTuple)
*/
public boolean isAllowedCachedRight(final ContextEntry[] context,
- final ReteTuple tuple) {
+ final LeftTuple tuple) {
return true;
}
Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/common/InstanceEqualsConstraint.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/common/InstanceEqualsConstraint.java 2008-03-20 12:55:29 UTC (rev 19137)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/common/InstanceEqualsConstraint.java 2008-03-20 13:28:04 UTC (rev 19138)
@@ -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;
@@ -83,7 +83,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;
}
@@ -156,7 +156,7 @@
}
public void updateFromTuple(final InternalWorkingMemory workingMemory,
- final ReteTuple tuple) {
+ final LeftTuple tuple) {
this.left = tuple.get( this.pattern.getOffset() ).getObject();
}
Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/common/InstanceNotEqualsConstraint.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/common/InstanceNotEqualsConstraint.java 2008-03-20 12:55:29 UTC (rev 19137)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/common/InstanceNotEqualsConstraint.java 2008-03-20 13:28:04 UTC (rev 19138)
@@ -16,7 +16,7 @@
* limitations under the License.
*/
-import org.drools.reteoo.ReteTuple;
+import org.drools.reteoo.LeftTuple;
import org.drools.rule.ContextEntry;
import org.drools.rule.Declaration;
import org.drools.rule.Pattern;
@@ -81,7 +81,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;
}
@@ -156,7 +156,7 @@
}
public void updateFromTuple(final InternalWorkingMemory workingMemory,
- final ReteTuple tuple) {
+ final LeftTuple tuple) {
this.left = tuple.get( this.pattern.getOffset() ).getObject();
}
Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/common/PropagationContextImpl.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/common/PropagationContextImpl.java 2008-03-20 12:55:29 UTC (rev 19137)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/common/PropagationContextImpl.java 2008-03-20 13:28:04 UTC (rev 19138)
@@ -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;
@@ -149,7 +149,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 ) {
@@ -162,7 +162,7 @@
}
public Activation removeRetractedTuple(final Rule rule,
- final ReteTuple tuple) {
+ final LeftTuple tuple) {
if ( this.retracted == null ) {
return null;
}
Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/common/QuadroupleBetaConstraints.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/common/QuadroupleBetaConstraints.java 2008-03-20 12:55:29 UTC (rev 19137)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/common/QuadroupleBetaConstraints.java 2008-03-20 13:28:04 UTC (rev 19138)
@@ -20,8 +20,8 @@
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.LeftTuple;
+import org.drools.reteoo.LeftTupleMemory;
import org.drools.rule.ContextEntry;
import org.drools.rule.VariableConstraint;
import org.drools.spi.BetaNodeFieldConstraint;
@@ -191,7 +191,7 @@
*/
public void updateFromTuple(final ContextEntry[] context,
final InternalWorkingMemory workingMemory,
- final ReteTuple tuple) {
+ final LeftTuple tuple) {
context[0].updateFromTuple( workingMemory,
tuple );
context[1].updateFromTuple( workingMemory,
@@ -254,7 +254,7 @@
* @see org.drools.common.BetaNodeConstraints#isAllowedCachedRight(org.drools.reteoo.ReteTuple)
*/
public boolean isAllowedCachedRight(final ContextEntry[] context,
- final ReteTuple tuple) {
+ final LeftTuple tuple) {
return this.constraint0.isAllowedCachedRight( tuple,
context[0] ) && this.constraint1.isAllowedCachedRight( tuple,
context[1] ) && this.constraint2.isAllowedCachedRight( tuple,
@@ -328,7 +328,7 @@
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 {
Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/common/SingleBetaConstraints.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/common/SingleBetaConstraints.java 2008-03-20 12:55:29 UTC (rev 19137)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/common/SingleBetaConstraints.java 2008-03-20 13:28:04 UTC (rev 19138)
@@ -24,8 +24,8 @@
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.LeftTuple;
+import org.drools.reteoo.LeftTupleMemory;
import org.drools.rule.ContextEntry;
import org.drools.rule.VariableConstraint;
import org.drools.spi.BetaNodeFieldConstraint;
@@ -117,7 +117,7 @@
*/
public void updateFromTuple(final ContextEntry[] context,
final InternalWorkingMemory workingMemory,
- final ReteTuple tuple) {
+ final LeftTuple tuple) {
context[0].updateFromTuple( workingMemory,
tuple );
}
@@ -145,7 +145,7 @@
* @see org.drools.common.BetaNodeConstraints#isAllowedCachedRight(org.drools.reteoo.ReteTuple)
*/
public boolean isAllowedCachedRight(final ContextEntry[] context,
- final ReteTuple tuple) {
+ final LeftTuple tuple) {
return this.constraint.isAllowedCachedRight( tuple,
context[0] );
}
@@ -169,7 +169,7 @@
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 {
Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/common/TripleBetaConstraints.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/common/TripleBetaConstraints.java 2008-03-20 12:55:29 UTC (rev 19137)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/common/TripleBetaConstraints.java 2008-03-20 13:28:04 UTC (rev 19138)
@@ -26,8 +26,8 @@
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.LeftTuple;
+import org.drools.reteoo.LeftTupleMemory;
import org.drools.rule.ContextEntry;
import org.drools.rule.VariableConstraint;
import org.drools.spi.BetaNodeFieldConstraint;
@@ -158,7 +158,7 @@
*/
public void updateFromTuple(final ContextEntry[] context,
final InternalWorkingMemory workingMemory,
- final ReteTuple tuple) {
+ final LeftTuple tuple) {
context[0].updateFromTuple( workingMemory,
tuple );
context[1].updateFromTuple( workingMemory,
@@ -213,7 +213,7 @@
* @see org.drools.common.BetaNodeConstraints#isAllowedCachedRight(org.drools.reteoo.ReteTuple)
*/
public boolean isAllowedCachedRight(final ContextEntry[] context,
- final ReteTuple tuple) {
+ final LeftTuple tuple) {
return this.constraint0.isAllowedCachedRight( tuple,
context[0] ) && this.constraint1.isAllowedCachedRight( tuple,
context[1] ) && this.constraint2.isAllowedCachedRight( tuple,
@@ -274,7 +274,7 @@
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 {
Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/common/TupleStartEqualsConstraint.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/common/TupleStartEqualsConstraint.java 2008-03-20 12:55:29 UTC (rev 19137)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/common/TupleStartEqualsConstraint.java 2008-03-20 13:28:04 UTC (rev 19138)
@@ -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;
@@ -88,11 +88,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() ) );
}
@@ -122,8 +122,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;
@@ -134,8 +134,8 @@
}
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
- left = (ReteTuple)in.readObject();
- right = (ReteTuple)in.readObject();
+ left = (LeftTuple)in.readObject();
+ right = (LeftTuple)in.readObject();
compareSize = in.readInt();
entry = (ContextEntry)in.readObject();
}
@@ -156,7 +156,7 @@
}
public void updateFromTuple(final InternalWorkingMemory workingMemory,
- final ReteTuple tuple) {
+ final LeftTuple tuple) {
this.left = tuple;
this.compareSize = tuple.size();
}
@@ -165,7 +165,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();
}
public void resetTuple() {
Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/conflict/TotalRecencyConflictResolver.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/conflict/TotalRecencyConflictResolver.java 2008-03-20 12:55:29 UTC (rev 19137)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/conflict/TotalRecencyConflictResolver.java 2008-03-20 13:28:04 UTC (rev 19138)
@@ -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/trunk/drools-core/src/main/java/org/drools/reteoo/AccumulateNode.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/AccumulateNode.java 2008-03-20 12:55:29 UTC (rev 19137)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/AccumulateNode.java 2008-03-20 13:28:04 UTC (rev 19138)
@@ -60,7 +60,7 @@
}
public AccumulateNode(final int id,
- final TupleSource leftInput,
+ final LeftTupleSource leftInput,
final ObjectSource rightInput,
final AlphaNodeFieldConstraint[] resultConstraints,
final BetaConstraints sourceBinder,
@@ -114,7 +114,7 @@
* Object result = this.accumulator.accumulate( ... );
*
*/
- public void assertTuple(final ReteTuple leftTuple,
+ public void assertLeftTuple(final LeftTuple leftTuple,
final PropagationContext context,
final InternalWorkingMemory workingMemory) {
@@ -148,7 +148,7 @@
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,
@@ -196,7 +196,7 @@
handle ) ) {
accresult.handle = handle;
- this.sink.propagateAssertTuple( leftTuple,
+ this.sink.propagateAssertLeftTuple( leftTuple,
handle,
context,
workingMemory );
@@ -216,7 +216,7 @@
* it must always also retreat it.
*
*/
- public void retractTuple(final ReteTuple leftTuple,
+ public void retractLeftTuple(final LeftTuple leftTuple,
final PropagationContext context,
final InternalWorkingMemory workingMemory) {
final AccumulateMemory memory = (AccumulateMemory) workingMemory.getNodeMemory( this );
@@ -227,7 +227,7 @@
// if tuple was propagated
if ( accresult.handle != null ) {
- this.sink.propagateRetractTuple( leftTuple,
+ this.sink.propagateRetractLeftTuple( leftTuple,
accresult.handle,
context,
workingMemory );
@@ -266,7 +266,7 @@
// need to clone the tuples to avoid concurrent modification exceptions
Entry[] tuples = memory.betaMemory.getTupleMemory().toArray();
for ( int i = 0; i < tuples.length; i++ ) {
- ReteTuple tuple = (ReteTuple) tuples[i];
+ LeftTuple tuple = (LeftTuple) tuples[i];
if ( this.constraints.isAllowedCachedRight( memory.betaMemory.getContext(),
tuple ) ) {
if ( this.accumulate.supportsReverse() || context.getType() == PropagationContext.ASSERTION ) {
@@ -277,10 +277,10 @@
workingMemory );
} else {
// context is MODIFICATION and does not supports reverse
- this.retractTuple( tuple,
+ this.retractLeftTuple( tuple,
context,
workingMemory );
- this.assertTuple( tuple,
+ this.assertLeftTuple( tuple,
context,
workingMemory );
}
@@ -310,7 +310,7 @@
// need to clone the tuples to avoid concurrent modification exceptions
Entry[] tuples = memory.betaMemory.getTupleMemory().toArray();
for ( int i = 0; i < tuples.length; i++ ) {
- ReteTuple tuple = (ReteTuple) tuples[i];
+ LeftTuple tuple = (LeftTuple) tuples[i];
if ( this.constraints.isAllowedCachedRight( memory.betaMemory.getContext(),
tuple ) ) {
if ( this.accumulate.supportsReverse() ) {
@@ -320,10 +320,10 @@
context,
workingMemory );
} else {
- this.retractTuple( tuple,
+ this.retractLeftTuple( tuple,
context,
workingMemory );
- this.assertTuple( tuple,
+ this.assertLeftTuple( tuple,
context,
workingMemory );
}
@@ -334,7 +334,7 @@
}
public void modifyTuple(final boolean isAssert,
- final ReteTuple leftTuple,
+ final LeftTuple leftTuple,
InternalFactHandle handle,
final PropagationContext context,
final InternalWorkingMemory workingMemory) {
@@ -344,7 +344,7 @@
// if tuple was propagated
if ( accresult.handle != null ) {
- this.sink.propagateRetractTuple( leftTuple,
+ this.sink.propagateRetractLeftTuple( leftTuple,
accresult.handle,
context,
workingMemory );
@@ -354,10 +354,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();
}
@@ -433,7 +433,7 @@
createdHandle ) ) {
accresult.handle = createdHandle;
- this.sink.propagateAssertTuple( leftTuple,
+ this.sink.propagateAssertLeftTuple( leftTuple,
createdHandle,
context,
workingMemory );
@@ -447,7 +447,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 );
@@ -456,7 +456,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.assertLeftTuple( new LeftTuple( (LeftTuple) entry.getKey(),
accresult.handle ),
context,
workingMemory );
Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/BetaMemory.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/BetaMemory.java 2008-03-20 12:55:29 UTC (rev 19137)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/BetaMemory.java 2008-03-20 13:28:04 UTC (rev 19138)
@@ -15,7 +15,7 @@
private static final long serialVersionUID = 400L;
- private TupleMemory tupleMemory;
+ private LeftTupleMemory tupleMemory;
private FactHandleMemory factHandleMemory;
private ObjectHashMap createdHandles;
private ContextEntry[] context;
@@ -23,7 +23,7 @@
public BetaMemory() {
}
- public BetaMemory(final TupleMemory tupleMemory,
+ public BetaMemory(final LeftTupleMemory tupleMemory,
final FactHandleMemory objectMemory,
final ContextEntry[] context ) {
this.tupleMemory = tupleMemory;
@@ -32,7 +32,7 @@
}
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
- tupleMemory = (TupleMemory)in.readObject();
+ tupleMemory = (LeftTupleMemory)in.readObject();
factHandleMemory = (FactHandleMemory)in.readObject();
createdHandles = (ObjectHashMap)in.readObject();
context = (ContextEntry[])in.readObject();
@@ -49,7 +49,7 @@
return this.factHandleMemory;
}
- public TupleMemory getTupleMemory() {
+ public LeftTupleMemory getTupleMemory() {
return this.tupleMemory;
}
Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/BetaNode.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/BetaNode.java 2008-03-20 12:55:29 UTC (rev 19137)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/BetaNode.java 2008-03-20 13:28:04 UTC (rev 19138)
@@ -38,16 +38,16 @@
* 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,
+ LeftTupleSinkNode,
ObjectSinkNode,
NodeMemory {
// ------------------------------------------------------------
@@ -55,15 +55,15 @@
// ------------------------------------------------------------
/** The left input <code>TupleSource</code>. */
- protected TupleSource leftInput;
+ protected LeftTupleSource leftInput;
/** The right input <code>TupleSource</code>. */
protected ObjectSource rightInput;
protected BetaConstraints constraints;
- private TupleSinkNode previousTupleSinkNode;
- private TupleSinkNode nextTupleSinkNode;
+ private LeftTupleSinkNode previousTupleSinkNode;
+ private LeftTupleSinkNode nextTupleSinkNode;
private ObjectSinkNode previousObjectSinkNode;
private ObjectSinkNode nextObjectSinkNode;
@@ -87,7 +87,7 @@
* The right input <code>ObjectSource</code>.
*/
BetaNode(final int id,
- final TupleSource leftInput,
+ final LeftTupleSource leftInput,
final ObjectSource rightInput,
final BetaConstraints constraints) {
super( id );
@@ -102,11 +102,11 @@
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
super.readExternal(in);
- leftInput = (TupleSource)in.readObject();
+ leftInput = (LeftTupleSource)in.readObject();
rightInput = (ObjectSource)in.readObject();
constraints = (BetaConstraints)in.readObject();
- previousTupleSinkNode = (TupleSinkNode)in.readObject();
- nextTupleSinkNode = (TupleSinkNode)in.readObject();
+ previousTupleSinkNode = (LeftTupleSinkNode)in.readObject();
+ nextTupleSinkNode = (LeftTupleSinkNode)in.readObject();
previousObjectSinkNode = (ObjectSinkNode)in.readObject();
nextObjectSinkNode = (ObjectSinkNode)in.readObject();
objectMemory = in.readBoolean();
@@ -153,7 +153,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() );
@@ -198,7 +198,7 @@
final InternalWorkingMemory[] workingMemories) {
context.visitTupleSource( this );
if ( !node.isInUse() ) {
- removeTupleSink( (TupleSink) node );
+ removeTupleSink( (LeftTupleSink) node );
}
if ( !this.isInUse() ) {
for ( int i = 0, length = workingMemories.length; i < length; i++ ) {
@@ -226,11 +226,11 @@
this.objectMemory = objectMemory;
}
- public boolean isTupleMemoryEnabled() {
+ public boolean isLeftTupleMemoryEnabled() {
return tupleMemoryEnabled;
}
- public void setTupleMemoryEnabled(boolean tupleMemoryEnabled) {
+ public void setLeftTupleMemoryEnabled(boolean tupleMemoryEnabled) {
this.tupleMemoryEnabled = tupleMemoryEnabled;
}
@@ -279,7 +279,7 @@
* @return
* The next TupleSinkNode
*/
- public TupleSinkNode getNextTupleSinkNode() {
+ public LeftTupleSinkNode getNextLeftTupleSinkNode() {
return this.nextTupleSinkNode;
}
@@ -288,7 +288,7 @@
* @param next
* The next TupleSinkNode
*/
- public void setNextTupleSinkNode(final TupleSinkNode next) {
+ public void setNextLeftTupleSinkNode(final LeftTupleSinkNode next) {
this.nextTupleSinkNode = next;
}
@@ -297,7 +297,7 @@
* @return
* The previous TupleSinkNode
*/
- public TupleSinkNode getPreviousTupleSinkNode() {
+ public LeftTupleSinkNode getPreviousLeftTupleSinkNode() {
return this.previousTupleSinkNode;
}
@@ -306,7 +306,7 @@
* @param previous
* The previous TupleSinkNode
*/
- public void setPreviousTupleSinkNode(final TupleSinkNode previous) {
+ public void setPreviousLeftTupleSinkNode(final LeftTupleSinkNode previous) {
this.previousTupleSinkNode = previous;
}
Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/CollectNode.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/CollectNode.java 2008-03-20 12:55:29 UTC (rev 19137)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/CollectNode.java 2008-03-20 13:28:04 UTC (rev 19138)
@@ -43,7 +43,7 @@
*/
public class CollectNode extends BetaNode
implements
- TupleSink,
+ LeftTupleSink,
ObjectSink {
private static final long serialVersionUID = 400L;
@@ -75,7 +75,7 @@
* The collect conditional element
*/
public CollectNode(final int id,
- final TupleSource leftInput,
+ final LeftTupleSource leftInput,
final ObjectSource rightInput,
final AlphaNodeFieldConstraint[] resultConstraints,
final BetaConstraints sourceBinder,
@@ -122,7 +122,7 @@
* 4.2. Propagate the tuple
*
*/
- public void assertTuple(final ReteTuple leftTuple,
+ public void assertLeftTuple(final LeftTuple leftTuple,
final PropagationContext context,
final InternalWorkingMemory workingMemory) {
@@ -154,7 +154,7 @@
if ( this.constraints.isAllowedCachedLeft( memory.betaMemory.getContext(),
handle ) ) {
if ( this.unwrapRightObject ) {
- handle = ((ReteTuple) handle.getObject()).getLastHandle();
+ handle = ((LeftTuple) handle.getObject()).getLastHandle();
}
result.add( handle.getObject() );
}
@@ -179,7 +179,7 @@
if ( this.resultsBinder.isAllowedCachedLeft( memory.resultsContext,
resultHandle ) ) {
colresult.propagated = true;
- this.sink.propagateAssertTuple( leftTuple,
+ this.sink.propagateAssertLeftTuple( leftTuple,
resultHandle,
context,
workingMemory );
@@ -191,7 +191,7 @@
/**
* @inheritDoc
*/
- public void retractTuple(final ReteTuple leftTuple,
+ public void retractLeftTuple(final LeftTuple leftTuple,
final PropagationContext context,
final InternalWorkingMemory workingMemory) {
@@ -205,7 +205,7 @@
// if tuple was propagated
if ( result.propagated ) {
- this.sink.propagateRetractTuple( leftTuple,
+ this.sink.propagateRetractLeftTuple( leftTuple,
handle,
context,
workingMemory );
@@ -243,7 +243,7 @@
// need to clone the tuples to avoid concurrent modification exceptions
Entry[] tuples = memory.betaMemory.getTupleMemory().toArray();
for ( int i = 0; i < tuples.length; i++ ) {
- ReteTuple tuple = (ReteTuple) tuples[i];
+ LeftTuple tuple = (LeftTuple) tuples[i];
if ( this.constraints.isAllowedCachedRight( memory.betaMemory.getContext(),
tuple ) ) {
this.modifyTuple( true,
@@ -279,7 +279,7 @@
// need to clone the tuples to avoid concurrent modification exceptions
Entry[] tuples = memory.betaMemory.getTupleMemory().toArray();
for ( int i = 0; i < tuples.length; i++ ) {
- ReteTuple tuple = (ReteTuple) tuples[i];
+ LeftTuple tuple = (LeftTuple) tuples[i];
if ( this.constraints.isAllowedCachedRight( memory.betaMemory.getContext(),
tuple ) ) {
@@ -304,7 +304,7 @@
* @param workingMemory
*/
public void modifyTuple(final boolean isAssert,
- final ReteTuple leftTuple,
+ final LeftTuple leftTuple,
InternalFactHandle handle,
final PropagationContext context,
final InternalWorkingMemory workingMemory) {
@@ -315,7 +315,7 @@
// if tuple was propagated
if ( result.propagated ) {
- this.sink.propagateRetractTuple( leftTuple,
+ this.sink.propagateRetractLeftTuple( leftTuple,
result.handle,
context,
workingMemory );
@@ -324,7 +324,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 ) {
@@ -356,7 +356,7 @@
if ( this.resultsBinder.isAllowedCachedLeft( memory.resultsContext,
result.handle ) ) {
result.propagated = true;
- this.sink.propagateAssertTuple( leftTuple,
+ this.sink.propagateAssertLeftTuple( leftTuple,
result.handle,
context,
workingMemory );
@@ -366,7 +366,7 @@
}
}
- public void updateSink(final TupleSink sink,
+ public void updateSink(final LeftTupleSink sink,
final PropagationContext context,
final InternalWorkingMemory workingMemory) {
final CollectMemory memory = (CollectMemory) workingMemory.getNodeMemory( this );
@@ -375,7 +375,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.assertLeftTuple( new LeftTuple( (LeftTuple) entry.getKey(),
result.handle ),
context,
workingMemory );
Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/CompositeTupleSinkAdapter.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/CompositeTupleSinkAdapter.java 2008-03-20 12:55:29 UTC (rev 19137)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/CompositeTupleSinkAdapter.java 2008-03-20 13:28:04 UTC (rev 19138)
@@ -10,99 +10,99 @@
public class CompositeTupleSinkAdapter
implements
- TupleSinkPropagator {
- private TupleSinkNodeList sinks;
+ LeftTupleSinkPropagator {
+ private LeftTupleSinkNodeList sinks;
public CompositeTupleSinkAdapter() {
- this.sinks = new TupleSinkNodeList();
+ this.sinks = new LeftTupleSinkNodeList();
}
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
- sinks = (TupleSinkNodeList)in.readObject();
+ sinks = (LeftTupleSinkNodeList)in.readObject();
}
public void writeExternal(ObjectOutput out) throws IOException {
out.writeObject(sinks);
}
- 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,
+ public void propagateAssertLeftTuple(final LeftTuple tuple,
final InternalFactHandle handle,
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.assertLeftTuple( new LeftTuple( tuple,
handle ),
context,
workingMemory );
}
}
- public void propagateAssertTuple(final ReteTuple tuple,
+ public void propagateAssertLeftTuple(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.assertLeftTuple( new LeftTuple( tuple ),
context,
workingMemory );
}
}
- public void propagateRetractTuple(final ReteTuple tuple,
+ public void propagateRetractLeftTuple(final LeftTuple tuple,
final InternalFactHandle handle,
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.retractLeftTuple( new LeftTuple( tuple,
handle ),
context,
workingMemory );
}
}
- public void propagateRetractTuple(final ReteTuple tuple,
+ public void propagateRetractLeftTuple(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.retractLeftTuple( new LeftTuple( tuple ),
context,
workingMemory );
}
}
- public void createAndPropagateAssertTuple(final InternalFactHandle handle,
+ public void createAndPropagateAssertLeftTuple(final InternalFactHandle handle,
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.assertLeftTuple( new LeftTuple( handle ),
context,
workingMemory );
}
}
- public void createAndPropagateRetractTuple(final InternalFactHandle handle,
+ public void createAndPropagateRetractLeftTuple(final InternalFactHandle handle,
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.retractLeftTuple( new LeftTuple( handle ),
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;
}
Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/EmptyTupleSinkAdapter.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/EmptyTupleSinkAdapter.java 2008-03-20 12:55:29 UTC (rev 19137)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/EmptyTupleSinkAdapter.java 2008-03-20 13:28:04 UTC (rev 19138)
@@ -10,7 +10,7 @@
public class EmptyTupleSinkAdapter
implements
- TupleSinkPropagator {
+ LeftTupleSinkPropagator {
private static final EmptyTupleSinkAdapter instance = new EmptyTupleSinkAdapter();
@@ -27,40 +27,40 @@
public void writeExternal(ObjectOutput out) throws IOException {
}
- public void propagateAssertTuple(final ReteTuple tuple,
+ public void propagateAssertLeftTuple(final LeftTuple tuple,
final InternalFactHandle handle,
final PropagationContext context,
final InternalWorkingMemory workingMemory) {
}
- public void propagateAssertTuple(final ReteTuple tuple,
+ public void propagateAssertLeftTuple(final LeftTuple tuple,
final PropagationContext context,
final InternalWorkingMemory workingMemory) {
}
- public void propagateRetractTuple(final ReteTuple tuple,
+ public void propagateRetractLeftTuple(final LeftTuple tuple,
final InternalFactHandle handle,
final PropagationContext context,
final InternalWorkingMemory workingMemory) {
}
- public void propagateRetractTuple(final ReteTuple tuple,
+ public void propagateRetractLeftTuple(final LeftTuple tuple,
final PropagationContext context,
final InternalWorkingMemory workingMemory) {
}
- public void createAndPropagateAssertTuple(final InternalFactHandle handle,
+ public void createAndPropagateAssertLeftTuple(final InternalFactHandle handle,
final PropagationContext context,
final InternalWorkingMemory workingMemory) {
}
- public void createAndPropagateRetractTuple(final InternalFactHandle handle,
+ public void createAndPropagateRetractLeftTuple(final InternalFactHandle handle,
final PropagationContext context,
final InternalWorkingMemory workingMemory) {
}
- public TupleSink[] getSinks() {
- return new TupleSink[]{};
+ public LeftTupleSink[] getSinks() {
+ return new LeftTupleSink[]{};
}
public int size() {
Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/EvalConditionNode.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/EvalConditionNode.java 2008-03-20 12:55:29 UTC (rev 19137)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/EvalConditionNode.java 2008-03-20 13:28:04 UTC (rev 19138)
@@ -42,14 +42,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
@@ -64,12 +64,12 @@
private EvalCondition condition;
/** The source of incoming <code>Tuples</code>. */
- private TupleSource tupleSource;
+ private LeftTupleSource tupleSource;
protected boolean tupleMemoryEnabled;
- private TupleSinkNode previousTupleSinkNode;
- private TupleSinkNode nextTupleSinkNode;
+ private LeftTupleSinkNode previousTupleSinkNode;
+ private LeftTupleSinkNode nextTupleSinkNode;
// ------------------------------------------------------------
// Constructors
@@ -88,7 +88,7 @@
* @param eval
*/
public EvalConditionNode(final int id,
- final TupleSource tupleSource,
+ final LeftTupleSource tupleSource,
final EvalCondition eval,
final BuildContext context) {
super( id );
@@ -100,10 +100,10 @@
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
super.readExternal(in);
condition = (EvalCondition)in.readObject();
- tupleSource = (TupleSource)in.readObject();
+ tupleSource = (LeftTupleSource)in.readObject();
tupleMemoryEnabled = in.readBoolean();
- previousTupleSinkNode = (TupleSinkNode)in.readObject();
- nextTupleSinkNode = (TupleSinkNode)in.readObject();
+ previousTupleSinkNode = (LeftTupleSinkNode)in.readObject();
+ nextTupleSinkNode = (LeftTupleSinkNode)in.readObject();
}
public void writeExternal(ObjectOutput out) throws IOException {
@@ -167,7 +167,7 @@
* @throws AssertionException
* If an error occurs while asserting.
*/
- public void assertTuple(final ReteTuple tuple,
+ public void assertLeftTuple(final LeftTuple tuple,
final PropagationContext context,
final InternalWorkingMemory workingMemory) {
final EvalMemory memory = (EvalMemory) workingMemory.getNodeMemory( this );
@@ -181,21 +181,21 @@
memory.tupleMemory.add( tuple );
}
- this.sink.propagateAssertTuple( tuple,
+ this.sink.propagateAssertLeftTuple( tuple,
context,
workingMemory );
}
}
- public void retractTuple(final ReteTuple tuple,
+ public void retractLeftTuple(final LeftTuple tuple,
final PropagationContext context,
final InternalWorkingMemory workingMemory) {
final EvalMemory memory = (EvalMemory) workingMemory.getNodeMemory( this );
// can we improve that?
- final ReteTuple memTuple = memory.tupleMemory.remove( tuple );
+ final LeftTuple memTuple = memory.tupleMemory.remove( tuple );
if ( memTuple != null ) {
- this.sink.propagateRetractTuple( memTuple,
+ this.sink.propagateRetractLeftTuple( memTuple,
context,
workingMemory );
}
@@ -235,15 +235,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 EvalMemory memory = (EvalMemory) workingMemory.getNodeMemory( this );
final Iterator it = memory.tupleMemory.iterator();
- for ( ReteTuple tuple = (ReteTuple) it.next(); tuple != null; tuple = (ReteTuple) it.next() ) {
- sink.assertTuple( tuple,
+ for ( LeftTuple tuple = (LeftTuple) it.next(); tuple != null; tuple = (LeftTuple) it.next() ) {
+ sink.assertLeftTuple( tuple,
context,
workingMemory );
}
@@ -255,7 +255,7 @@
final InternalWorkingMemory[] workingMemories) {
context.visitTupleSource( this );
if ( !node.isInUse() ) {
- removeTupleSink( (TupleSink) node );
+ removeTupleSink( (LeftTupleSink) node );
}
if ( !this.isInUse() ) {
for ( int i = 0, length = workingMemories.length; i < length; i++ ) {
@@ -270,11 +270,11 @@
}
}
- public boolean isTupleMemoryEnabled() {
+ public boolean isLeftTupleMemoryEnabled() {
return tupleMemoryEnabled;
}
- public void setTupleMemoryEnabled(boolean tupleMemoryEnabled) {
+ public void setLeftTupleMemoryEnabled(boolean tupleMemoryEnabled) {
this.tupleMemoryEnabled = tupleMemoryEnabled;
}
@@ -283,7 +283,7 @@
* @return
* The next TupleSinkNode
*/
- public TupleSinkNode getNextTupleSinkNode() {
+ public LeftTupleSinkNode getNextLeftTupleSinkNode() {
return this.nextTupleSinkNode;
}
@@ -292,7 +292,7 @@
* @param next
* The next TupleSinkNode
*/
- public void setNextTupleSinkNode(final TupleSinkNode next) {
+ public void setNextLeftTupleSinkNode(final LeftTupleSinkNode next) {
this.nextTupleSinkNode = next;
}
@@ -301,7 +301,7 @@
* @return
* The previous TupleSinkNode
*/
- public TupleSinkNode getPreviousTupleSinkNode() {
+ public LeftTupleSinkNode getPreviousLeftTupleSinkNode() {
return this.previousTupleSinkNode;
}
@@ -310,7 +310,7 @@
* @param previous
* The previous TupleSinkNode
*/
- public void setPreviousTupleSinkNode(final TupleSinkNode previous) {
+ public void setPreviousLeftTupleSinkNode(final LeftTupleSinkNode previous) {
this.previousTupleSinkNode = previous;
}
Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/ExistsNode.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/ExistsNode.java 2008-03-20 12:55:29 UTC (rev 19137)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/ExistsNode.java 2008-03-20 13:28:04 UTC (rev 19138)
@@ -66,7 +66,7 @@
* The constraints to be applied to the right objects
*/
public ExistsNode(final int id,
- final TupleSource leftInput,
+ final LeftTupleSource leftInput,
final ObjectSource rightInput,
final BetaConstraints joinNodeBinder,
final BuildContext context) {
@@ -89,7 +89,7 @@
* @param workingMemory
* The working memory session.
*/
- public void assertTuple(final ReteTuple leftTuple,
+ public void assertLeftTuple(final LeftTuple leftTuple,
final PropagationContext context,
final InternalWorkingMemory workingMemory) {
final BetaMemory memory = (BetaMemory) workingMemory.getNodeMemory( this );
@@ -114,7 +114,7 @@
this.constraints.resetTuple( memory.getContext() );
if ( leftTuple.getMatch() != null ) {
- this.sink.propagateAssertTuple( leftTuple,
+ this.sink.propagateAssertLeftTuple( leftTuple,
context,
workingMemory );
}
@@ -147,11 +147,11 @@
this.constraints.updateFromFactHandle( memory.getContext(),
workingMemory,
handle );
- for ( ReteTuple tuple = (ReteTuple) it.next(); tuple != null; tuple = (ReteTuple) it.next() ) {
+ for ( LeftTuple tuple = (LeftTuple) it.next(); tuple != null; tuple = (LeftTuple) it.next() ) {
if ( this.constraints.isAllowedCachedRight( memory.getContext(),
tuple ) && tuple.getMatch() == null) {
tuple.setMatch( handle );
- this.sink.propagateAssertTuple( tuple,
+ this.sink.propagateAssertLeftTuple( tuple,
context,
workingMemory );
}
@@ -184,7 +184,7 @@
this.constraints.updateFromFactHandle( memory.getContext(),
workingMemory,
handle );
- for ( ReteTuple tuple = (ReteTuple) it.next(); tuple != null; tuple = (ReteTuple) it.next() ) {
+ for ( LeftTuple tuple = (LeftTuple) it.next(); tuple != null; tuple = (LeftTuple) it.next() ) {
if ( this.constraints.isAllowedCachedRight( memory.getContext(),
tuple ) ) {
if ( tuple.getMatch() == handle ) {
@@ -209,7 +209,7 @@
// if there is now no new tuple match then propagate assert.
if ( tuple.getMatch() == null ) {
- this.sink.propagateRetractTuple( tuple,
+ this.sink.propagateRetractLeftTuple( tuple,
context,
workingMemory );
}
@@ -232,19 +232,19 @@
* @param workingMemory
* The working memory session.
*/
- public void retractTuple(final ReteTuple leftTuple,
+ public void retractLeftTuple(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.getTupleMemory().remove( leftTuple );
if ( tuple == null ) {
return;
}
if ( tuple.getMatch() != null) {
- this.sink.propagateRetractTuple( tuple,
+ this.sink.propagateRetractLeftTuple( tuple,
context,
workingMemory );
}
@@ -254,15 +254,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() ) {
+ for ( LeftTuple tuple = (LeftTuple) tupleIter.next(); tuple != null; tuple = (LeftTuple) tupleIter.next() ) {
if ( tuple.getMatch() != null ) {
- sink.assertTuple( new ReteTuple( tuple ),
+ sink.assertLeftTuple( new LeftTuple( tuple ),
context,
workingMemory );
}
Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/FactHandleMemory.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/FactHandleMemory.java 2008-03-20 12:55:29 UTC (rev 19137)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/FactHandleMemory.java 2008-03-20 13:28:04 UTC (rev 19138)
@@ -7,7 +7,7 @@
public interface FactHandleMemory {
public Iterator iterator();
- public Iterator iterator(ReteTuple tuple);
+ public Iterator iterator(LeftTuple tuple);
public boolean add(InternalFactHandle handle,
boolean checkExists);
Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/FromNode.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/FromNode.java 2008-03-20 12:55:29 UTC (rev 19137)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/FromNode.java 2008-03-20 13:28:04 UTC (rev 19138)
@@ -22,9 +22,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 {
/**
*
@@ -32,12 +32,12 @@
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;
@@ -46,7 +46,7 @@
public FromNode(final int id,
final DataProvider dataProvider,
- final TupleSource tupleSource,
+ final LeftTupleSource tupleSource,
final AlphaNodeFieldConstraint[] constraints,
final BetaConstraints binder) {
super( id );
@@ -60,11 +60,11 @@
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
super.readExternal(in);
dataProvider = (DataProvider)in.readObject();
- tupleSource = (TupleSource)in.readObject();
+ tupleSource = (LeftTupleSource)in.readObject();
alphaConstraints = (AlphaNodeFieldConstraint[])in.readObject();
betaConstraints = (BetaConstraints)in.readObject();
- previousTupleSinkNode = (TupleSinkNode)in.readObject();
- nextTupleSinkNode = (TupleSinkNode)in.readObject();
+ previousTupleSinkNode = (LeftTupleSinkNode)in.readObject();
+ nextTupleSinkNode = (LeftTupleSinkNode)in.readObject();
tupleMemoryEnabled = in.readBoolean();
}
@@ -81,7 +81,7 @@
/**
* @inheritDoc
*/
- public void assertTuple(final ReteTuple leftTuple,
+ public void assertLeftTuple(final LeftTuple leftTuple,
final PropagationContext context,
final InternalWorkingMemory workingMemory) {
final FromMemory memory = (FromMemory) workingMemory.getNodeMemory( this );
@@ -120,7 +120,7 @@
handle ) ) {
list.add( new LinkedListEntry( handle ) );
- this.sink.propagateAssertTuple( leftTuple,
+ this.sink.propagateAssertLeftTuple( leftTuple,
handle,
context,
workingMemory );
@@ -138,12 +138,12 @@
}
- public void retractTuple(final ReteTuple leftTuple,
+ public void retractLeftTuple(final LeftTuple leftTuple,
final PropagationContext context,
final InternalWorkingMemory workingMemory) {
final FromMemory memory = (FromMemory) workingMemory.getNodeMemory( this );
- final ReteTuple tuple = memory.betaMemory.getTupleMemory().remove( leftTuple );
+ final LeftTuple tuple = memory.betaMemory.getTupleMemory().remove( leftTuple );
if ( tuple == null ) {
return;
@@ -154,7 +154,7 @@
if ( list != null ) {
for ( LinkedListEntry entry = (LinkedListEntry) list.getFirst(); entry != null; entry = (LinkedListEntry) entry.getNext() ) {
final InternalFactHandle handle = (InternalFactHandle) entry.getObject();
- this.sink.propagateRetractTuple( leftTuple,
+ this.sink.propagateRetractLeftTuple( leftTuple,
handle,
context,
workingMemory );
@@ -194,7 +194,7 @@
context.visitTupleSource( this );
if ( !node.isInUse() ) {
- removeTupleSink( (TupleSink) node );
+ removeTupleSink( (LeftTupleSink) node );
}
if ( !this.isInUse() ) {
for ( int i = 0, length = workingMemories.length; i < length; i++ ) {
@@ -209,21 +209,21 @@
}
}
- public void updateSink(final TupleSink sink,
+ public void updateSink(final LeftTupleSink sink,
final PropagationContext context,
final InternalWorkingMemory workingMemory) {
final FromMemory memory = (FromMemory) workingMemory.getNodeMemory( this );
final Iterator tupleIter = memory.betaMemory.getTupleMemory().iterator();
- for ( ReteTuple tuple = (ReteTuple) tupleIter.next(); tuple != null; tuple = (ReteTuple) tupleIter.next() ) {
+ for ( LeftTuple tuple = (LeftTuple) tupleIter.next(); tuple != null; tuple = (LeftTuple) tupleIter.next() ) {
final LinkedList list = (LinkedList) memory.betaMemory.getCreatedHandles().remove( tuple );
if ( list == null ) {
continue;
}
for ( LinkedListEntry entry = (LinkedListEntry) list.getFirst(); entry != null; entry = (LinkedListEntry) entry.getNext() ) {
final InternalFactHandle handle = (InternalFactHandle) entry.getObject();
- this.sink.propagateAssertTuple( tuple,
+ this.sink.propagateAssertLeftTuple( tuple,
handle,
context,
workingMemory );
@@ -240,11 +240,11 @@
this.alphaConstraints );
}
- public boolean isTupleMemoryEnabled() {
+ public boolean isLeftTupleMemoryEnabled() {
return tupleMemoryEnabled;
}
- public void setTupleMemoryEnabled(boolean tupleMemoryEnabled) {
+ public void setLeftTupleMemoryEnabled(boolean tupleMemoryEnabled) {
this.tupleMemoryEnabled = tupleMemoryEnabled;
}
@@ -253,7 +253,7 @@
* @return
* The next TupleSinkNode
*/
- public TupleSinkNode getNextTupleSinkNode() {
+ public LeftTupleSinkNode getNextLeftTupleSinkNode() {
return this.nextTupleSinkNode;
}
@@ -262,7 +262,7 @@
* @param next
* The next TupleSinkNode
*/
- public void setNextTupleSinkNode(final TupleSinkNode next) {
+ public void setNextLeftTupleSinkNode(final LeftTupleSinkNode next) {
this.nextTupleSinkNode = next;
}
@@ -271,7 +271,7 @@
* @return
* The previous TupleSinkNode
*/
- public TupleSinkNode getPreviousTupleSinkNode() {
+ public LeftTupleSinkNode getPreviousLeftTupleSinkNode() {
return this.previousTupleSinkNode;
}
@@ -280,7 +280,7 @@
* @param previous
* The previous TupleSinkNode
*/
- public void setPreviousTupleSinkNode(final TupleSinkNode previous) {
+ public void setPreviousLeftTupleSinkNode(final LeftTupleSinkNode previous) {
this.previousTupleSinkNode = previous;
}
Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/JoinNode.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/JoinNode.java 2008-03-20 12:55:29 UTC (rev 19137)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/JoinNode.java 2008-03-20 13:28:04 UTC (rev 19138)
@@ -43,7 +43,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>
@@ -64,7 +64,7 @@
}
public JoinNode(final int id,
- final TupleSource leftInput,
+ final LeftTupleSource leftInput,
final ObjectSource rightInput,
final BetaConstraints binder,
final BuildContext context) {
@@ -81,9 +81,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
@@ -93,7 +93,7 @@
* @param workingMemory
* The working memory seesion.
*/
- public void assertTuple(final ReteTuple leftTuple,
+ public void assertLeftTuple(final LeftTuple leftTuple,
final PropagationContext context,
final InternalWorkingMemory workingMemory) {
final BetaMemory memory = (BetaMemory) workingMemory.getNodeMemory( this );
@@ -110,7 +110,7 @@
final InternalFactHandle handle = entry.getFactHandle();
if ( this.constraints.isAllowedCachedLeft( memory.getContext(),
handle ) ) {
- this.sink.propagateAssertTuple( leftTuple,
+ this.sink.propagateAssertLeftTuple( leftTuple,
handle,
context,
workingMemory );
@@ -126,9 +126,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 handle
@@ -153,10 +153,10 @@
this.constraints.updateFromFactHandle( memory.getContext(),
workingMemory,
handle );
- for ( ReteTuple tuple = (ReteTuple) it.next(); tuple != null; tuple = (ReteTuple) it.next() ) {
+ for ( LeftTuple leftTuple = (LeftTuple) it.next(); leftTuple != null; leftTuple = (LeftTuple) it.next() ) {
if ( this.constraints.isAllowedCachedRight( memory.getContext(),
- tuple ) ) {
- this.sink.propagateAssertTuple( tuple,
+ leftTuple ) ) {
+ this.sink.propagateAssertLeftTuple( leftTuple,
handle,
context,
workingMemory );
@@ -188,10 +188,10 @@
this.constraints.updateFromFactHandle( memory.getContext(),
workingMemory,
handle );
- for ( ReteTuple tuple = (ReteTuple) it.next(); tuple != null; tuple = (ReteTuple) it.next() ) {
+ for ( LeftTuple leftTuple = (LeftTuple) it.next(); leftTuple != null; leftTuple = (LeftTuple) it.next() ) {
if ( this.constraints.isAllowedCachedRight( memory.getContext(),
- tuple ) ) {
- this.sink.propagateRetractTuple( tuple,
+ leftTuple ) ) {
+ this.sink.propagateRetractLeftTuple( leftTuple,
handle,
context,
workingMemory );
@@ -213,11 +213,11 @@
* @param workingMemory
* The working memory seesion.
*/
- public void retractTuple(final ReteTuple leftTuple,
+ public void retractLeftTuple(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.getTupleMemory().remove( leftTuple );
if ( tuple == null ) {
return;
}
@@ -230,7 +230,7 @@
final InternalFactHandle handle = entry.getFactHandle();
if ( this.constraints.isAllowedCachedLeft( memory.getContext(),
handle ) ) {
- this.sink.propagateRetractTuple( leftTuple,
+ this.sink.propagateRetractLeftTuple( leftTuple,
handle,
context,
workingMemory );
@@ -243,23 +243,23 @@
/* (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 );
+ for ( LeftTuple LeftTuple = (LeftTuple) tupleIter.next(); LeftTuple != null; LeftTuple = (LeftTuple) tupleIter.next() ) {
+ final Iterator objectIter = memory.getFactHandleMemory().iterator( LeftTuple );
this.constraints.updateFromTuple( memory.getContext(),
workingMemory,
- tuple );
+ LeftTuple );
for ( FactEntry entry = (FactEntry) objectIter.next(); entry != null; entry = (FactEntry) objectIter.next() ) {
final InternalFactHandle handle = entry.getFactHandle();
if ( this.constraints.isAllowedCachedLeft( memory.getContext(),
handle ) ) {
- sink.assertTuple( new ReteTuple( tuple,
+ sink.assertLeftTuple( new LeftTuple( LeftTuple,
handle ),
context,
workingMemory );
Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/LIANodePropagation.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/LIANodePropagation.java 2008-03-20 12:55:29 UTC (rev 19137)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/LIANodePropagation.java 2008-03-20 13:28:04 UTC (rev 19138)
@@ -36,7 +36,7 @@
}
public void doPropagation(InternalWorkingMemory workingMemory) {
- node.getSinkPropagator().createAndPropagateAssertTuple( handle, context, workingMemory );
+ node.getSinkPropagator().createAndPropagateAssertLeftTuple( handle, context, workingMemory );
}
Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/LeftInputAdapterNode.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/LeftInputAdapterNode.java 2008-03-20 12:55:29 UTC (rev 19137)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/LeftInputAdapterNode.java 2008-03-20 13:28:04 UTC (rev 19138)
@@ -42,7 +42,7 @@
* @author <a href="mailto:bob at werken.com">Bob McWhirter</a>
*
*/
-public class LeftInputAdapterNode extends TupleSource
+public class LeftInputAdapterNode extends LeftTupleSource
implements
ObjectSinkNode,
NodeMemory {
@@ -140,7 +140,7 @@
final InternalWorkingMemory workingMemory) {
if ( !workingMemory.isSequential() ) {
- this.sink.createAndPropagateAssertTuple( handle,
+ this.sink.createAndPropagateAssertLeftTuple( handle,
context,
workingMemory );
@@ -175,13 +175,13 @@
}
if ( propagate ) {
- this.sink.createAndPropagateRetractTuple( handle,
+ this.sink.createAndPropagateRetractLeftTuple( handle,
context,
workingMemory );
}
}
- public void updateSink(final TupleSink sink,
+ public void updateSink(final LeftTupleSink sink,
final PropagationContext context,
final InternalWorkingMemory workingMemory) {
if ( this.objectMemoryEnabled ) {
@@ -190,7 +190,7 @@
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 ),
+ sink.assertLeftTuple( new LeftTuple( handle ),
context,
workingMemory );
}
@@ -208,7 +208,7 @@
final InternalWorkingMemory[] workingMemories) {
context.visitTupleSource( this );
if ( !node.isInUse() ) {
- removeTupleSink( (TupleSink) node );
+ removeTupleSink( (LeftTupleSink) node );
}
if ( !this.isInUse() ) {
for ( int i = 0, length = workingMemories.length; i < length; i++ ) {
@@ -296,17 +296,17 @@
private static class ObjectSinkAdapter
implements
ObjectSink {
- private TupleSink sink;
+ private LeftTupleSink sink;
- public ObjectSinkAdapter(final TupleSink sink) {
+ public ObjectSinkAdapter(final LeftTupleSink sink) {
this.sink = sink;
}
public void assertObject(final InternalFactHandle handle,
final PropagationContext context,
final InternalWorkingMemory workingMemory) {
- final ReteTuple tuple = new ReteTuple( handle );
- this.sink.assertTuple( tuple,
+ final LeftTuple tuple = new LeftTuple( handle );
+ this.sink.assertLeftTuple( tuple,
context,
workingMemory );
}
Copied: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/LeftTuple.java (from rev 19137, labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/ReteTuple.java)
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/LeftTuple.java (rev 0)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/LeftTuple.java 2008-03-20 13:28:04 UTC (rev 19138)
@@ -0,0 +1,246 @@
+package org.drools.reteoo;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.io.ObjectOutput;
+import java.io.IOException;
+import java.io.ObjectInput;
+
+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 InternalFactHandle handle;
+
+ private LeftTuple parent;
+
+ private Activation activation;
+
+ private long recency;
+
+ private int hashCode;
+
+ private InternalFactHandle match;
+
+ private Entry next;
+
+ // ------------------------------------------------------------
+ // Constructors
+ // ------------------------------------------------------------
+ public LeftTuple() {
+
+ }
+ public LeftTuple(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 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 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 void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
+ index = in.readInt();
+ handle = (InternalFactHandle)in.readObject();
+ parent = (LeftTuple)in.readObject();
+ activation = (Activation)in.readObject();
+ recency = in.readLong();
+ hashCode = in.readInt();
+ match = (InternalFactHandle)in.readObject();
+ next = (Entry)in.readObject();
+
+ }
+
+ public void writeExternal(ObjectOutput out) throws IOException {
+ out.writeInt(index);
+ out.writeObject(handle);
+ out.writeObject(parent);
+ out.writeObject(activation);
+ out.writeLong(recency);
+ out.writeInt(hashCode);
+ out.writeObject(match);
+ out.writeObject(next);
+ }
+
+ public InternalFactHandle get(final int index) {
+ LeftTuple 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();
+ 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 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();
+
+ 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/trunk/drools-core/src/main/java/org/drools/reteoo/LeftTupleMemory.java (from rev 19137, labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/TupleMemory.java)
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/LeftTupleMemory.java (rev 0)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/LeftTupleMemory.java 2008-03-20 13:28:04 UTC (rev 19138)
@@ -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(InternalFactHandle handle);
+
+ public void add(LeftTuple tuple);
+
+ public LeftTuple remove(LeftTuple leftTuple);
+
+ public boolean contains(LeftTuple leftTuple);
+
+ public boolean isIndexed();
+
+ public int size();
+
+ public Entry[] getTable();
+
+ public Entry[] toArray();
+
+}
Copied: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/LeftTupleSink.java (from rev 19137, labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/TupleSink.java)
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/LeftTupleSink.java (rev 0)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/LeftTupleSink.java 2008-03-20 13:28:04 UTC (rev 19138)
@@ -0,0 +1,60 @@
+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 java.io.Externalizable;
+
+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
+ Externalizable,
+ Sink {
+
+ /**
+ * Assert a new <code>ReteTuple</code>.
+ *
+ * @param leftTuple
+ * 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 assertLeftTuple(LeftTuple leftTuple,
+ PropagationContext context,
+ InternalWorkingMemory workingMemory);
+
+ void retractLeftTuple(LeftTuple leftTuple,
+ PropagationContext context,
+ InternalWorkingMemory workingMemory);
+
+ public boolean isLeftTupleMemoryEnabled();
+
+ public void setLeftTupleMemoryEnabled(boolean tupleMemoryEnabled);
+}
Copied: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/LeftTupleSinkNode.java (from rev 19137, labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/TupleSinkNode.java)
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/LeftTupleSinkNode.java (rev 0)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/LeftTupleSinkNode.java 2008-03-20 13:28:04 UTC (rev 19138)
@@ -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/trunk/drools-core/src/main/java/org/drools/reteoo/LeftTupleSinkNodeList.java (from rev 19137, labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/TupleSinkNodeList.java)
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/LeftTupleSinkNodeList.java (rev 0)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/LeftTupleSinkNodeList.java 2008-03-20 13:28:04 UTC (rev 19138)
@@ -0,0 +1,243 @@
+package org.drools.reteoo;
+
+import java.io.Serializable;
+import java.io.Externalizable;
+import java.io.ObjectOutput;
+import java.io.ObjectInput;
+import java.io.IOException;
+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
+ Externalizable {
+ private static final long serialVersionUID = 400L;
+
+ private LeftTupleSinkNode firstNode;
+ private LeftTupleSinkNode lastNode;
+
+ private int size;
+
+ /**
+ * Construct an empty <code>LinkedList</code>
+ */
+ public LeftTupleSinkNodeList() {
+ }
+
+ public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
+ firstNode = (LeftTupleSinkNode)in.readObject();
+ lastNode = (LeftTupleSinkNode)in.readObject();
+ size = in.readInt();
+ }
+
+ public void writeExternal(ObjectOutput out) throws IOException {
+ out.writeObject(firstNode);
+ out.writeObject(lastNode);
+ out.writeInt(size);
+ }
+ /**
+ * 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/trunk/drools-core/src/main/java/org/drools/reteoo/LeftTupleSinkPropagator.java (from rev 19137, labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/TupleSinkPropagator.java)
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/LeftTupleSinkPropagator.java (rev 0)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/LeftTupleSinkPropagator.java 2008-03-20 13:28:04 UTC (rev 19138)
@@ -0,0 +1,59 @@
+package org.drools.reteoo;
+
+import java.io.Externalizable;
+
+import org.drools.common.InternalFactHandle;
+import org.drools.common.InternalWorkingMemory;
+import org.drools.spi.PropagationContext;
+
+public interface LeftTupleSinkPropagator
+ extends
+ Externalizable {
+ public void propagateAssertLeftTuple(LeftTuple leftTuple,
+ InternalFactHandle handle,
+ PropagationContext context,
+ InternalWorkingMemory workingMemory);
+
+ public void propagateAssertLeftTuple(LeftTuple leftTuple,
+ PropagationContext context,
+ InternalWorkingMemory workingMemory);
+
+ public void propagateRetractLeftTuple(LeftTuple leftTuple,
+ InternalFactHandle handle,
+ PropagationContext context,
+ InternalWorkingMemory workingMemory);
+
+ public void propagateRetractLeftTuple(LeftTuple tuple,
+ PropagationContext context,
+ InternalWorkingMemory workingMemory);
+
+ public void createAndPropagateAssertLeftTuple(InternalFactHandle handle,
+ PropagationContext context,
+ InternalWorkingMemory workingMemory);
+
+ public void createAndPropagateRetractLeftTuple(InternalFactHandle handle,
+ 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/trunk/drools-core/src/main/java/org/drools/reteoo/LeftTupleSource.java (from rev 19137, labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/TupleSource.java)
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/LeftTupleSource.java (rev 0)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/LeftTupleSource.java 2008-03-20 13:28:04 UTC (rev 19138)
@@ -0,0 +1,136 @@
+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 java.io.Externalizable;
+import java.io.IOException;
+import java.io.ObjectOutput;
+import java.io.ObjectInput;
+
+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
+ Externalizable {
+ // ------------------------------------------------------------
+ // Instance members
+ // ------------------------------------------------------------
+
+ /** The destination for <code>Tuples</code>. */
+ protected LeftTupleSinkPropagator sink;
+
+ // ------------------------------------------------------------
+ // Constructors
+ // ------------------------------------------------------------
+ public LeftTupleSource() {
+
+ }
+
+ /**
+ * Single parameter constructor that specifies the unique id of the node.
+ *
+ * @param id
+ */
+ LeftTupleSource(final int id) {
+ super( id );
+ this.sink = EmptyTupleSinkAdapter.getInstance();
+ }
+
+ // ------------------------------------------------------------
+ // Instance methods
+ // ------------------------------------------------------------
+ public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
+ super.readExternal(in);
+ sink = (LeftTupleSinkPropagator)in.readObject();
+ }
+
+ public void writeExternal(ObjectOutput out) throws IOException {
+ super.writeExternal(out);
+ out.writeObject(sink);
+ }
+
+ /**
+ * 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 instanceof EmptyTupleSinkAdapter ) {
+ 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 LeftTupleSink tupleSink) {
+ if ( this.sink instanceof EmptyTupleSinkAdapter ) {
+ 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 LeftTupleSinkPropagator getSinkPropagator() {
+ return this.sink;
+ }
+
+ public abstract void updateSink(LeftTupleSink sink,
+ PropagationContext context,
+ InternalWorkingMemory workingMemory);
+
+ public boolean isInUse() {
+ return this.sink.size() > 0;
+ }
+}
Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/MemoryVisitor.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/MemoryVisitor.java 2008-03-20 12:55:29 UTC (rev 19137)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/MemoryVisitor.java 2008-03-20 13:28:04 UTC (rev 19138)
@@ -104,10 +104,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] );
}
@@ -130,10 +130,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] );
}
@@ -155,10 +155,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] );
}
@@ -258,7 +258,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/trunk/drools-core/src/main/java/org/drools/reteoo/NotNode.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/NotNode.java 2008-03-20 12:55:29 UTC (rev 19137)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/NotNode.java 2008-03-20 13:28:04 UTC (rev 19138)
@@ -63,7 +63,7 @@
* The right input <code>TupleSource</code>.
*/
public NotNode(final int id,
- final TupleSource leftInput,
+ final LeftTupleSource leftInput,
final ObjectSource rightInput,
final BetaConstraints joinNodeBinder,
final BuildContext context) {
@@ -86,7 +86,7 @@
* @param workingMemory
* The working memory seesion.
*/
- public void assertTuple(final ReteTuple leftTuple,
+ public void assertLeftTuple(final LeftTuple leftTuple,
final PropagationContext context,
final InternalWorkingMemory workingMemory) {
final BetaMemory memory = (BetaMemory) workingMemory.getNodeMemory( this );
@@ -112,7 +112,7 @@
this.constraints.resetTuple( memory.getContext() );
if ( leftTuple.getMatch() == null ) {
- this.sink.propagateAssertTuple( leftTuple,
+ this.sink.propagateAssertLeftTuple( leftTuple,
context,
workingMemory );
}
@@ -145,11 +145,11 @@
this.constraints.updateFromFactHandle( memory.getContext(),
workingMemory,
handle );
- for ( ReteTuple tuple = (ReteTuple) it.next(); tuple != null; tuple = (ReteTuple) it.next() ) {
+ for ( LeftTuple leftTuple = (LeftTuple) it.next(); leftTuple != null; leftTuple = (LeftTuple) it.next() ) {
if ( this.constraints.isAllowedCachedRight( memory.getContext(),
- tuple ) && tuple.getMatch() == null) {
- tuple.setMatch( handle );
- this.sink.propagateRetractTuple( tuple,
+ leftTuple ) && leftTuple.getMatch() == null) {
+ leftTuple.setMatch( handle );
+ this.sink.propagateRetractLeftTuple( leftTuple,
context,
workingMemory );
}
@@ -183,32 +183,32 @@
this.constraints.updateFromFactHandle( memory.getContext(),
workingMemory,
handle );
- for ( ReteTuple tuple = (ReteTuple) it.next(); tuple != null; tuple = (ReteTuple) it.next() ) {
+ for ( LeftTuple leftTuple = (LeftTuple) it.next(); leftTuple != null; leftTuple = (LeftTuple) it.next() ) {
if ( this.constraints.isAllowedCachedRight( memory.getContext(),
- tuple ) ) {
+ leftTuple ) ) {
- if ( tuple.getMatch() == handle ) {
+ if ( leftTuple.getMatch() == handle ) {
// reset the match
- tuple.setMatch( null );
+ leftTuple.setMatch( null );
// find next match, remember it and break.
- final Iterator tupleIt = memory.getFactHandleMemory().iterator( tuple );
+ final Iterator tupleIt = memory.getFactHandleMemory().iterator( leftTuple );
this.constraints.updateFromTuple( memory.getContext(),
- workingMemory, tuple );
+ workingMemory, leftTuple );
for ( FactEntry entry = (FactEntry) tupleIt.next(); entry != null; entry = (FactEntry) tupleIt.next() ) {
final InternalFactHandle rightHandle = entry.getFactHandle();
if ( this.constraints.isAllowedCachedLeft( memory.getContext(),
rightHandle ) ) {
- tuple.setMatch( rightHandle );
+ leftTuple.setMatch( rightHandle );
break;
}
}
this.constraints.resetTuple( memory.getContext() );
// if there is now no new tuple match then propagate assert.
- if ( tuple.getMatch() == null ) {
- this.sink.propagateAssertTuple( tuple,
+ if ( leftTuple.getMatch() == null ) {
+ this.sink.propagateAssertLeftTuple( leftTuple,
context,
workingMemory );
}
@@ -230,19 +230,19 @@
* @param workingMemory
* The working memory seesion.
*/
- public void retractTuple(final ReteTuple leftTuple,
+ public void retractLeftTuple(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.getTupleMemory().remove( leftTuple );
if ( tuple == null ) {
return;
}
if ( tuple.getMatch() == null) {
- this.sink.propagateRetractTuple( tuple,
+ this.sink.propagateRetractLeftTuple( tuple,
context,
workingMemory );
}
@@ -251,15 +251,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() ) {
- if ( tuple.getMatch() == null ) {
- sink.assertTuple( new ReteTuple( tuple ),
+ for ( LeftTuple leftTuple = (LeftTuple) tupleIter.next(); leftTuple != null; leftTuple = (LeftTuple) tupleIter.next() ) {
+ if ( leftTuple.getMatch() == null ) {
+ sink.assertLeftTuple( new LeftTuple( leftTuple ),
context,
workingMemory );
}
Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/ObjectSinkNode.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/ObjectSinkNode.java 2008-03-20 12:55:29 UTC (rev 19137)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/ObjectSinkNode.java 2008-03-20 13:28:04 UTC (rev 19138)
@@ -19,7 +19,7 @@
/**
* Items placed in a <code>LinkedList<code> must implement this interface .
*
- * @see TupleSinkNodeList
+ * @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>
Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/ObjectTypeNode.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/ObjectTypeNode.java 2008-03-20 12:55:29 UTC (rev 19137)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/ObjectTypeNode.java 2008-03-20 13:28:04 UTC (rev 19138)
@@ -348,8 +348,8 @@
}
if ( !hasConstraints && sinks[i] instanceof ObjectSource ) {
hasConstraints = !this.canSkipOnModify( ((ObjectSource) sinks[i]).getSinkPropagator().getSinks() );
- } else if ( !hasConstraints && sinks[i] instanceof TupleSource ) {
- hasConstraints = !this.canSkipOnModify( ((TupleSource) sinks[i]).getSinkPropagator().getSinks() );
+ } else if ( !hasConstraints && sinks[i] instanceof LeftTupleSource ) {
+ hasConstraints = !this.canSkipOnModify( ((LeftTupleSource) sinks[i]).getSinkPropagator().getSinks() );
}
}
Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/QueryTerminalNode.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/QueryTerminalNode.java 2008-03-20 12:55:29 UTC (rev 19137)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/QueryTerminalNode.java 2008-03-20 13:28:04 UTC (rev 19138)
@@ -40,7 +40,7 @@
*/
public final class QueryTerminalNode extends BaseNode
implements
- TupleSinkNode,
+ LeftTupleSinkNode,
NodeMemory,
TerminalNode {
// ------------------------------------------------------------
@@ -54,11 +54,11 @@
/** The rule to invoke upon match. */
private Rule rule;
private GroupElement subrule;
- private TupleSource tupleSource;
+ private LeftTupleSource tupleSource;
private boolean tupleMemoryEnabled;
- private TupleSinkNode previousTupleSinkNode;
- private TupleSinkNode nextTupleSinkNode;
+ private LeftTupleSinkNode previousTupleSinkNode;
+ private LeftTupleSinkNode nextTupleSinkNode;
// ------------------------------------------------------------
// Constructors
@@ -75,7 +75,7 @@
* The rule.
*/
public QueryTerminalNode(final int id,
- final TupleSource source,
+ final LeftTupleSource source,
final Rule rule,
final GroupElement subrule) {
super( id );
@@ -92,10 +92,10 @@
super.readExternal(in);
rule = (Rule)in.readObject();
subrule = (GroupElement)in.readObject();
- tupleSource = (TupleSource)in.readObject();
+ tupleSource = (LeftTupleSource)in.readObject();
tupleMemoryEnabled = in.readBoolean();
- previousTupleSinkNode = (TupleSinkNode)in.readObject();
- nextTupleSinkNode = (TupleSinkNode)in.readObject();
+ previousTupleSinkNode = (LeftTupleSinkNode)in.readObject();
+ nextTupleSinkNode = (LeftTupleSinkNode)in.readObject();
}
public void writeExternal(ObjectOutput out) throws IOException {
@@ -131,7 +131,7 @@
* @throws AssertionException
* If an error occurs while asserting.
*/
- public void assertTuple(final ReteTuple tuple,
+ public void assertLeftTuple(final LeftTuple tuple,
final PropagationContext context,
final InternalWorkingMemory workingMemory) {
final LinkedList list = (LinkedList) workingMemory.getNodeMemory( this );
@@ -142,7 +142,7 @@
list.add( tuple );
}
- public void retractTuple(final ReteTuple tuple,
+ public void retractLeftTuple(final LeftTuple tuple,
final PropagationContext context,
final InternalWorkingMemory workingMemory) {
}
@@ -207,11 +207,11 @@
return new LinkedList();
}
- public boolean isTupleMemoryEnabled() {
+ public boolean isLeftTupleMemoryEnabled() {
return tupleMemoryEnabled;
}
- public void setTupleMemoryEnabled(boolean tupleMemoryEnabled) {
+ public void setLeftTupleMemoryEnabled(boolean tupleMemoryEnabled) {
this.tupleMemoryEnabled = tupleMemoryEnabled;
}
@@ -227,7 +227,7 @@
* @return
* The previous TupleSinkNode
*/
- public TupleSinkNode getPreviousTupleSinkNode() {
+ public LeftTupleSinkNode getPreviousLeftTupleSinkNode() {
return this.previousTupleSinkNode;
}
@@ -236,7 +236,7 @@
* @param previous
* The previous TupleSinkNode
*/
- public void setPreviousTupleSinkNode(final TupleSinkNode previous) {
+ public void setPreviousLeftTupleSinkNode(final LeftTupleSinkNode previous) {
this.previousTupleSinkNode = previous;
}
@@ -245,7 +245,7 @@
* @return
* The next TupleSinkNode
*/
- public TupleSinkNode getNextTupleSinkNode() {
+ public LeftTupleSinkNode getNextLeftTupleSinkNode() {
return this.nextTupleSinkNode;
}
@@ -254,7 +254,7 @@
* @param next
* The next TupleSinkNode
*/
- public void setNextTupleSinkNode(final TupleSinkNode next) {
+ public void setNextLeftTupleSinkNode(final LeftTupleSinkNode next) {
this.nextTupleSinkNode = next;
}
Deleted: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/ReteTuple.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/ReteTuple.java 2008-03-20 12:55:29 UTC (rev 19137)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/ReteTuple.java 2008-03-20 13:28:04 UTC (rev 19138)
@@ -1,246 +0,0 @@
-package org.drools.reteoo;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.io.ObjectOutput;
-import java.io.IOException;
-import java.io.ObjectInput;
-
-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 InternalFactHandle handle;
-
- private ReteTuple parent;
-
- private Activation activation;
-
- private long recency;
-
- private int hashCode;
-
- private InternalFactHandle match;
-
- private Entry next;
-
- // ------------------------------------------------------------
- // Constructors
- // ------------------------------------------------------------
- public ReteTuple() {
-
- }
- 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 void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
- index = in.readInt();
- handle = (InternalFactHandle)in.readObject();
- parent = (ReteTuple)in.readObject();
- activation = (Activation)in.readObject();
- recency = in.readLong();
- hashCode = in.readInt();
- match = (InternalFactHandle)in.readObject();
- next = (Entry)in.readObject();
-
- }
-
- public void writeExternal(ObjectOutput out) throws IOException {
- out.writeInt(index);
- out.writeObject(handle);
- out.writeObject(parent);
- out.writeObject(activation);
- out.writeLong(recency);
- out.writeInt(hashCode);
- out.writeObject(match);
- out.writeObject(next);
- }
-
- 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/trunk/drools-core/src/main/java/org/drools/reteoo/RightInputAdapterNode.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/RightInputAdapterNode.java 2008-03-20 12:55:29 UTC (rev 19137)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/RightInputAdapterNode.java 2008-03-20 13:28:04 UTC (rev 19138)
@@ -44,17 +44,17 @@
*/
public class RightInputAdapterNode extends ObjectSource
implements
- TupleSinkNode,
+ LeftTupleSinkNode,
NodeMemory {
private static final long serialVersionUID = 400L;
- private TupleSource tupleSource;
+ private LeftTupleSource tupleSource;
protected boolean tupleMemoryEnabled;
- private TupleSinkNode previousTupleSinkNode;
- private TupleSinkNode nextTupleSinkNode;
+ private LeftTupleSinkNode previousTupleSinkNode;
+ private LeftTupleSinkNode nextTupleSinkNode;
public RightInputAdapterNode() {
}
@@ -69,7 +69,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;
@@ -78,10 +78,10 @@
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
super.readExternal(in);
- tupleSource = (TupleSource)in.readObject();
+ tupleSource = (LeftTupleSource)in.readObject();
tupleMemoryEnabled = in.readBoolean();
- previousTupleSinkNode = (TupleSinkNode)in.readObject();
- nextTupleSinkNode = (TupleSinkNode)in.readObject();
+ previousTupleSinkNode = (LeftTupleSinkNode)in.readObject();
+ nextTupleSinkNode = (LeftTupleSinkNode)in.readObject();
}
public void writeExternal(ObjectOutput out) throws IOException {
@@ -110,7 +110,7 @@
* @param workingMemory
* the <code>WorkingMemory</code> session.
*/
- public void assertTuple(final ReteTuple tuple,
+ public void assertLeftTuple(final LeftTuple tuple,
final PropagationContext context,
final InternalWorkingMemory workingMemory) {
@@ -134,7 +134,7 @@
* Retracts the corresponding tuple by retrieving and retracting
* the fact created for it
*/
- public void retractTuple(final ReteTuple tuple,
+ public void retractLeftTuple(final LeftTuple tuple,
final PropagationContext context,
final InternalWorkingMemory workingMemory) {
@@ -207,11 +207,11 @@
}
}
- public boolean isTupleMemoryEnabled() {
+ public boolean isLeftTupleMemoryEnabled() {
return tupleMemoryEnabled;
}
- public void setTupleMemoryEnabled(boolean tupleMemoryEnabled) {
+ public void setLeftTupleMemoryEnabled(boolean tupleMemoryEnabled) {
this.tupleMemoryEnabled = tupleMemoryEnabled;
}
@@ -220,7 +220,7 @@
* @return
* The next TupleSinkNode
*/
- public TupleSinkNode getNextTupleSinkNode() {
+ public LeftTupleSinkNode getNextLeftTupleSinkNode() {
return this.nextTupleSinkNode;
}
@@ -229,7 +229,7 @@
* @param next
* The next TupleSinkNode
*/
- public void setNextTupleSinkNode(final TupleSinkNode next) {
+ public void setNextLeftTupleSinkNode(final LeftTupleSinkNode next) {
this.nextTupleSinkNode = next;
}
@@ -238,7 +238,7 @@
* @return
* The previous TupleSinkNode
*/
- public TupleSinkNode getPreviousTupleSinkNode() {
+ public LeftTupleSinkNode getPreviousLeftTupleSinkNode() {
return this.previousTupleSinkNode;
}
@@ -247,7 +247,7 @@
* @param previous
* The previous TupleSinkNode
*/
- public void setPreviousTupleSinkNode(final TupleSinkNode previous) {
+ public void setPreviousLeftTupleSinkNode(final LeftTupleSinkNode previous) {
this.previousTupleSinkNode = previous;
}
Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/RuleRemovalContext.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/RuleRemovalContext.java 2008-03-20 12:55:29 UTC (rev 19137)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/RuleRemovalContext.java 2008-03-20 13:28:04 UTC (rev 19138)
@@ -59,7 +59,7 @@
*
* @param node
*/
- public void visitTupleSource( TupleSource node ) {
+ public void visitTupleSource( LeftTupleSource node ) {
this.visitedNodes.put( new Integer(node.getId()), node );
}
@@ -70,7 +70,7 @@
* @param node
* @return
*/
- public boolean alreadyVisited( TupleSource node ) {
+ public boolean alreadyVisited( LeftTupleSource node ) {
return this.visitedNodes.containsKey( new Integer( node.getId() ) );
}
Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/RuleTerminalNode.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/RuleTerminalNode.java 2008-03-20 12:55:29 UTC (rev 19137)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/RuleTerminalNode.java 2008-03-20 13:28:04 UTC (rev 19138)
@@ -58,7 +58,7 @@
*/
public final class RuleTerminalNode extends BaseNode
implements
- TupleSinkNode,
+ LeftTupleSinkNode,
NodeMemory,
TerminalNode, Externalizable {
// ------------------------------------------------------------
@@ -78,10 +78,10 @@
* because declarations may have different offsets in each subrule
*/
private GroupElement subrule;
- private TupleSource tupleSource;
+ private LeftTupleSource tupleSource;
- private TupleSinkNode previousTupleSinkNode;
- private TupleSinkNode nextTupleSinkNode;
+ private LeftTupleSinkNode previousTupleSinkNode;
+ private LeftTupleSinkNode nextTupleSinkNode;
protected boolean tupleMemoryEnabled;
@@ -101,7 +101,7 @@
* The rule.
*/
public RuleTerminalNode(final int id,
- final TupleSource source,
+ final LeftTupleSource source,
final Rule rule,
final GroupElement subrule,
final BuildContext buildContext) {
@@ -120,9 +120,9 @@
sequence = in.readInt();
rule = (Rule)in.readObject();
subrule = (GroupElement)in.readObject();
- tupleSource = (TupleSource)in.readObject();
- previousTupleSinkNode = (TupleSinkNode)in.readObject();
- nextTupleSinkNode = (TupleSinkNode)in.readObject();
+ tupleSource = (LeftTupleSource)in.readObject();
+ previousTupleSinkNode = (LeftTupleSinkNode)in.readObject();
+ nextTupleSinkNode = (LeftTupleSinkNode)in.readObject();
}
public void writeExternal(ObjectOutput out) throws IOException {
@@ -156,7 +156,7 @@
// org.drools.impl.TupleSink
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- public void assertTuple(final ReteTuple tuple,
+ public void assertLeftTuple(final LeftTuple tuple,
final PropagationContext context,
final InternalWorkingMemory workingMemory) {
assertTuple( tuple,
@@ -176,7 +176,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) {
@@ -196,7 +196,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();
@@ -379,11 +379,11 @@
}
}
- public void retractTuple(final ReteTuple leftTuple,
+ public void retractLeftTuple(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
@@ -470,7 +470,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() ) {
@@ -508,11 +508,11 @@
return new TerminalNodeMemory();
}
- public boolean isTupleMemoryEnabled() {
+ public boolean isLeftTupleMemoryEnabled() {
return tupleMemoryEnabled;
}
- public void setTupleMemoryEnabled(boolean tupleMemoryEnabled) {
+ public void setLeftTupleMemoryEnabled(boolean tupleMemoryEnabled) {
this.tupleMemoryEnabled = tupleMemoryEnabled;
}
@@ -521,7 +521,7 @@
* @return
* The next TupleSinkNode
*/
- public TupleSinkNode getNextTupleSinkNode() {
+ public LeftTupleSinkNode getNextLeftTupleSinkNode() {
return this.nextTupleSinkNode;
}
@@ -530,7 +530,7 @@
* @param next
* The next TupleSinkNode
*/
- public void setNextTupleSinkNode(final TupleSinkNode next) {
+ public void setNextLeftTupleSinkNode(final LeftTupleSinkNode next) {
this.nextTupleSinkNode = next;
}
@@ -539,7 +539,7 @@
* @return
* The previous TupleSinkNode
*/
- public TupleSinkNode getPreviousTupleSinkNode() {
+ public LeftTupleSinkNode getPreviousLeftTupleSinkNode() {
return this.previousTupleSinkNode;
}
@@ -548,7 +548,7 @@
* @param previous
* The previous TupleSinkNode
*/
- public void setPreviousTupleSinkNode(final TupleSinkNode previous) {
+ public void setPreviousLeftTupleSinkNode(final LeftTupleSinkNode previous) {
this.previousTupleSinkNode = previous;
}
Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/SingleTupleSinkAdapter.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/SingleTupleSinkAdapter.java 2008-03-20 12:55:29 UTC (rev 19137)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/SingleTupleSinkAdapter.java 2008-03-20 13:28:04 UTC (rev 19138)
@@ -10,79 +10,79 @@
public class SingleTupleSinkAdapter
implements
- TupleSinkPropagator {
- private TupleSink sink;
+ LeftTupleSinkPropagator {
+ private LeftTupleSink sink;
public SingleTupleSinkAdapter() {
}
- public SingleTupleSinkAdapter(final TupleSink sink) {
+ public SingleTupleSinkAdapter(final LeftTupleSink sink) {
this.sink = sink;
}
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
- sink = (TupleSink)in.readObject();
+ sink = (LeftTupleSink)in.readObject();
}
public void writeExternal(ObjectOutput out) throws IOException {
out.writeObject(sink);
}
- public void propagateAssertTuple(final ReteTuple tuple,
+ public void propagateAssertLeftTuple(final LeftTuple tuple,
final InternalFactHandle handle,
final PropagationContext context,
final InternalWorkingMemory workingMemory) {
- this.sink.assertTuple( new ReteTuple( tuple,
+ this.sink.assertLeftTuple( new LeftTuple( tuple,
handle ),
context,
workingMemory );
}
- public void propagateAssertTuple(final ReteTuple tuple,
+ public void propagateAssertLeftTuple(final LeftTuple tuple,
final PropagationContext context,
final InternalWorkingMemory workingMemory) {
- this.sink.assertTuple( new ReteTuple( tuple ),
+ this.sink.assertLeftTuple( new LeftTuple( tuple ),
context,
workingMemory );
}
- public void propagateRetractTuple(final ReteTuple tuple,
+ public void propagateRetractLeftTuple(final LeftTuple tuple,
final InternalFactHandle handle,
final PropagationContext context,
final InternalWorkingMemory workingMemory) {
- this.sink.retractTuple( new ReteTuple( tuple,
+ this.sink.retractLeftTuple( new LeftTuple( tuple,
handle ),
context,
workingMemory );
}
- public void propagateRetractTuple(final ReteTuple tuple,
+ public void propagateRetractLeftTuple(final LeftTuple tuple,
final PropagationContext context,
final InternalWorkingMemory workingMemory) {
- this.sink.retractTuple( new ReteTuple( tuple ),
+ this.sink.retractLeftTuple( new LeftTuple( tuple ),
context,
workingMemory );
}
- public void createAndPropagateAssertTuple(final InternalFactHandle handle,
+ public void createAndPropagateAssertLeftTuple(final InternalFactHandle handle,
final PropagationContext context,
final InternalWorkingMemory workingMemory) {
- this.sink.assertTuple( new ReteTuple( handle ),
+ this.sink.assertLeftTuple( new LeftTuple( handle ),
context,
workingMemory );
}
- public void createAndPropagateRetractTuple(final InternalFactHandle handle,
+ public void createAndPropagateRetractLeftTuple(final InternalFactHandle handle,
final PropagationContext context,
final InternalWorkingMemory workingMemory) {
- this.sink.retractTuple( new ReteTuple( handle ),
+ this.sink.retractLeftTuple( new LeftTuple( handle ),
context,
workingMemory );
}
- public TupleSink[] getSinks() {
- return new TupleSink[]{this.sink};
+ public LeftTupleSink[] getSinks() {
+ return new LeftTupleSink[]{this.sink};
}
public int size() {
Deleted: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/TupleMemory.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/TupleMemory.java 2008-03-20 12:55:29 UTC (rev 19137)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/TupleMemory.java 2008-03-20 13:28:04 UTC (rev 19138)
@@ -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/trunk/drools-core/src/main/java/org/drools/reteoo/TupleSink.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/TupleSink.java 2008-03-20 12:55:29 UTC (rev 19137)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/TupleSink.java 2008-03-20 13:28:04 UTC (rev 19138)
@@ -1,60 +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 java.io.Externalizable;
-
-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
- Externalizable,
- 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/trunk/drools-core/src/main/java/org/drools/reteoo/TupleSinkNode.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/TupleSinkNode.java 2008-03-20 12:55:29 UTC (rev 19137)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/TupleSinkNode.java 2008-03-20 13:28:04 UTC (rev 19138)
@@ -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/trunk/drools-core/src/main/java/org/drools/reteoo/TupleSinkNodeList.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/TupleSinkNodeList.java 2008-03-20 12:55:29 UTC (rev 19137)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/TupleSinkNodeList.java 2008-03-20 13:28:04 UTC (rev 19138)
@@ -1,243 +0,0 @@
-package org.drools.reteoo;
-
-import java.io.Serializable;
-import java.io.Externalizable;
-import java.io.ObjectOutput;
-import java.io.ObjectInput;
-import java.io.IOException;
-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
- Externalizable {
- private static final long serialVersionUID = 400L;
-
- private TupleSinkNode firstNode;
- private TupleSinkNode lastNode;
-
- private int size;
-
- /**
- * Construct an empty <code>LinkedList</code>
- */
- public TupleSinkNodeList() {
- }
-
- public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
- firstNode = (TupleSinkNode)in.readObject();
- lastNode = (TupleSinkNode)in.readObject();
- size = in.readInt();
- }
-
- public void writeExternal(ObjectOutput out) throws IOException {
- out.writeObject(firstNode);
- out.writeObject(lastNode);
- out.writeInt(size);
- }
- /**
- * 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/trunk/drools-core/src/main/java/org/drools/reteoo/TupleSinkPropagator.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/TupleSinkPropagator.java 2008-03-20 12:55:29 UTC (rev 19137)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/TupleSinkPropagator.java 2008-03-20 13:28:04 UTC (rev 19138)
@@ -1,59 +0,0 @@
-package org.drools.reteoo;
-
-import java.io.Externalizable;
-
-import org.drools.common.InternalFactHandle;
-import org.drools.common.InternalWorkingMemory;
-import org.drools.spi.PropagationContext;
-
-public interface TupleSinkPropagator
- extends
- Externalizable {
- 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/trunk/drools-core/src/main/java/org/drools/reteoo/TupleSource.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/TupleSource.java 2008-03-20 12:55:29 UTC (rev 19137)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/TupleSource.java 2008-03-20 13:28:04 UTC (rev 19138)
@@ -1,136 +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 java.io.Externalizable;
-import java.io.IOException;
-import java.io.ObjectOutput;
-import java.io.ObjectInput;
-
-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
- Externalizable {
- // ------------------------------------------------------------
- // Instance members
- // ------------------------------------------------------------
-
- /** The destination for <code>Tuples</code>. */
- protected TupleSinkPropagator sink;
-
- // ------------------------------------------------------------
- // Constructors
- // ------------------------------------------------------------
- public TupleSource() {
-
- }
-
- /**
- * 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
- // ------------------------------------------------------------
- public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
- super.readExternal(in);
- sink = (TupleSinkPropagator)in.readObject();
- }
-
- public void writeExternal(ObjectOutput out) throws IOException {
- super.writeExternal(out);
- out.writeObject(sink);
- }
-
- /**
- * 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 instanceof EmptyTupleSinkAdapter ) {
- 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 instanceof EmptyTupleSinkAdapter ) {
- 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);
-
- public boolean isInUse() {
- return this.sink.size() > 0;
- }
-}
Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/builder/AccumulateBuilder.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/builder/AccumulateBuilder.java 2008-03-20 12:55:29 UTC (rev 19137)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/builder/AccumulateBuilder.java 2008-03-20 13:28:04 UTC (rev 19138)
@@ -24,7 +24,7 @@
import org.drools.reteoo.AccumulateNode;
import org.drools.reteoo.ObjectSource;
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
@@ -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/trunk/drools-core/src/main/java/org/drools/reteoo/builder/BuildContext.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/builder/BuildContext.java 2008-03-20 12:55:29 UTC (rev 19137)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/builder/BuildContext.java 2008-03-20 13:28:04 UTC (rev 19138)
@@ -28,7 +28,7 @@
import org.drools.reteoo.ObjectSource;
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,7 +40,7 @@
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;
@@ -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/trunk/drools-core/src/main/java/org/drools/reteoo/builder/BuildUtils.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/builder/BuildUtils.java 2008-03-20 12:55:29 UTC (rev 19137)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/builder/BuildUtils.java 2008-03-20 13:28:04 UTC (rev 19138)
@@ -35,8 +35,8 @@
import org.drools.reteoo.ObjectSink;
import org.drools.reteoo.ObjectSource;
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;
@@ -106,8 +106,8 @@
}
}
} 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];
@@ -155,7 +155,7 @@
*/
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 ) {
return context.getRuleBase().getConfiguration().isShareAlphaNodes();
Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/builder/CollectBuilder.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/builder/CollectBuilder.java 2008-03-20 12:55:29 UTC (rev 19137)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/builder/CollectBuilder.java 2008-03-20 13:28:04 UTC (rev 19138)
@@ -24,7 +24,7 @@
import org.drools.reteoo.CollectNode;
import org.drools.reteoo.ObjectSource;
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
@@ -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/trunk/drools-core/src/main/java/org/drools/reteoo/builder/EvalBuilder.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/builder/EvalBuilder.java 2008-03-20 12:55:29 UTC (rev 19137)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/builder/EvalBuilder.java 2008-03-20 13:28:04 UTC (rev 19138)
@@ -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/trunk/drools-core/src/main/java/org/drools/reteoo/builder/FromBuilder.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/builder/FromBuilder.java 2008-03-20 12:55:29 UTC (rev 19137)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/builder/FromBuilder.java 2008-03-20 13:28:04 UTC (rev 19138)
@@ -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/trunk/drools-core/src/main/java/org/drools/reteoo/builder/GroupElementBuilder.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/builder/GroupElementBuilder.java 2008-03-20 12:55:29 UTC (rev 19137)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/builder/GroupElementBuilder.java 2008-03-20 13:28:04 UTC (rev 19138)
@@ -31,7 +31,7 @@
import org.drools.reteoo.NotNode;
import org.drools.reteoo.ObjectSource;
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 );
@@ -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 );
@@ -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/trunk/drools-core/src/main/java/org/drools/rule/AbstractCompositeConstraint.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/rule/AbstractCompositeConstraint.java 2008-03-20 12:55:29 UTC (rev 19137)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/rule/AbstractCompositeConstraint.java 2008-03-20 13:28:04 UTC (rev 19138)
@@ -23,7 +23,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.Constraint;
@@ -275,7 +275,7 @@
}
public void updateFromTuple(InternalWorkingMemory workingMemory,
- ReteTuple tuple) {
+ LeftTuple tuple) {
this.workingMemory = workingMemory;
for ( int i = 0; i < alphas.length; i++ ) {
if ( alphas[i] != null ) {
Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/rule/AbstractCompositeRestriction.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/rule/AbstractCompositeRestriction.java 2008-03-20 12:55:29 UTC (rev 19137)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/rule/AbstractCompositeRestriction.java 2008-03-20 13:28:04 UTC (rev 19138)
@@ -9,7 +9,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
@@ -145,7 +145,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/trunk/drools-core/src/main/java/org/drools/rule/AndCompositeRestriction.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/rule/AndCompositeRestriction.java 2008-03-20 12:55:29 UTC (rev 19137)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/rule/AndCompositeRestriction.java 2008-03-20 13:28:04 UTC (rev 19138)
@@ -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;
@@ -44,7 +44,7 @@
return true;
}
- public boolean isAllowedCachedRight(final ReteTuple tuple,
+ public boolean isAllowedCachedRight(final LeftTuple tuple,
final ContextEntry context) {
CompositeContextEntry contextEntry = (CompositeContextEntry) context;
for ( int i = 0, ilength = this.restrictions.length; i < ilength; i++ ) {
Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/rule/AndConstraint.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/rule/AndConstraint.java 2008-03-20 12:55:29 UTC (rev 19137)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/rule/AndConstraint.java 2008-03-20 13:28:04 UTC (rev 19138)
@@ -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;
@@ -79,7 +79,7 @@
/**
* {@inheritDoc}
*/
- public boolean isAllowedCachedRight(ReteTuple tuple,
+ public boolean isAllowedCachedRight(LeftTuple tuple,
ContextEntry context) {
for ( int i = 0; i < this.alphaConstraints.length; i++ ) {
if ( !this.alphaConstraints[i].isAllowed( ((MultiFieldConstraintContextEntry) context).handle,
Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/rule/ContextEntry.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/rule/ContextEntry.java 2008-03-20 12:55:29 UTC (rev 19137)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/rule/ContextEntry.java 2008-03-20 13:28:04 UTC (rev 19138)
@@ -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/trunk/drools-core/src/main/java/org/drools/rule/LiteralRestriction.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/rule/LiteralRestriction.java 2008-03-20 12:55:29 UTC (rev 19137)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/rule/LiteralRestriction.java 2008-03-20 13:28:04 UTC (rev 19138)
@@ -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;
@@ -93,7 +93,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(),
@@ -198,7 +198,7 @@
}
public void updateFromTuple(final InternalWorkingMemory workingMemory,
- final ReteTuple tuple) {
+ final LeftTuple tuple) {
// nothing to do
}
Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/rule/MultiRestrictionFieldConstraint.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/rule/MultiRestrictionFieldConstraint.java 2008-03-20 12:55:29 UTC (rev 19137)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/rule/MultiRestrictionFieldConstraint.java 2008-03-20 13:28:04 UTC (rev 19138)
@@ -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.FieldExtractor;
import org.drools.spi.Restriction;
@@ -96,7 +96,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/trunk/drools-core/src/main/java/org/drools/rule/OrCompositeRestriction.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/rule/OrCompositeRestriction.java 2008-03-20 12:55:29 UTC (rev 19137)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/rule/OrCompositeRestriction.java 2008-03-20 13:28:04 UTC (rev 19138)
@@ -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;
@@ -44,7 +44,7 @@
return false;
}
- public boolean isAllowedCachedRight(final ReteTuple tuple,
+ public boolean isAllowedCachedRight(final LeftTuple tuple,
final ContextEntry context) {
CompositeContextEntry contextEntry = (CompositeContextEntry) context;
for ( int i = 0, ilength = this.restrictions.length; i < ilength; i++ ) {
Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/rule/OrConstraint.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/rule/OrConstraint.java 2008-03-20 12:55:29 UTC (rev 19137)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/rule/OrConstraint.java 2008-03-20 13:28:04 UTC (rev 19138)
@@ -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;
@@ -87,7 +87,7 @@
/**
* {@inheritDoc}
*/
- public boolean isAllowedCachedRight(ReteTuple tuple,
+ public boolean isAllowedCachedRight(LeftTuple tuple,
ContextEntry context) {
if( this.alphaConstraints.length == 0 && this.betaConstraints.length == 0 ) {
return true;
Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/rule/PredicateConstraint.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/rule/PredicateConstraint.java 2008-03-20 12:55:29 UTC (rev 19137)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/rule/PredicateConstraint.java 2008-03-20 13:28:04 UTC (rev 19138)
@@ -25,7 +25,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.Extractor;
import org.drools.spi.PredicateExpression;
import org.drools.spi.Restriction;
@@ -276,7 +276,7 @@
}
}
- public boolean isAllowedCachedRight(final ReteTuple tuple,
+ public boolean isAllowedCachedRight(final LeftTuple tuple,
final ContextEntry context) {
try {
final PredicateContextEntry ctx = (PredicateContextEntry) context;
@@ -315,7 +315,7 @@
private static final long serialVersionUID = 400L;
- public ReteTuple leftTuple;
+ public LeftTuple leftTuple;
public Object rightObject;
public InternalWorkingMemory workingMemory;
@@ -327,7 +327,7 @@
}
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
- leftTuple = (ReteTuple)in.readObject();
+ leftTuple = (LeftTuple)in.readObject();
rightObject = in.readObject();
workingMemory = (InternalWorkingMemory)in.readObject();
dialectContext = in.readObject();
@@ -357,7 +357,7 @@
}
public void updateFromTuple(final InternalWorkingMemory workingMemory,
- final ReteTuple tuple) {
+ final LeftTuple tuple) {
this.workingMemory = workingMemory;
this.leftTuple = tuple;
}
Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/rule/ReturnValueConstraint.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/rule/ReturnValueConstraint.java 2008-03-20 12:55:29 UTC (rev 19137)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/rule/ReturnValueConstraint.java 2008-03-20 13:28:04 UTC (rev 19138)
@@ -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.Evaluator;
import org.drools.spi.FieldExtractor;
@@ -140,7 +140,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/trunk/drools-core/src/main/java/org/drools/rule/ReturnValueRestriction.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/rule/ReturnValueRestriction.java 2008-03-20 12:55:29 UTC (rev 19137)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/rule/ReturnValueRestriction.java 2008-03-20 13:28:04 UTC (rev 19138)
@@ -26,7 +26,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;
@@ -214,7 +214,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)" );
}
@@ -317,7 +317,7 @@
public FieldExtractor fieldExtractor;
public InternalFactHandle handle;
- public ReteTuple leftTuple;
+ public LeftTuple leftTuple;
public InternalWorkingMemory workingMemory;
public Declaration[] previousDeclarations;
public Declaration[] localDeclarations;
@@ -340,7 +340,7 @@
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
fieldExtractor = (FieldExtractor)in.readObject();
handle = (InternalFactHandle)in.readObject();
- leftTuple = (ReteTuple)in.readObject();
+ leftTuple = (LeftTuple)in.readObject();
workingMemory = (InternalWorkingMemory)in.readObject();
previousDeclarations = (Declaration[])in.readObject();
localDeclarations = (Declaration[])in.readObject();
@@ -374,7 +374,7 @@
}
public void updateFromTuple(final InternalWorkingMemory workingMemory,
- final ReteTuple tuple) {
+ final LeftTuple tuple) {
this.workingMemory = workingMemory;
this.leftTuple = tuple;
}
@@ -389,7 +389,7 @@
/* (non-Javadoc)
* @see org.drools.rule.ReturnValueContextEntry#getTuple()
*/
- public ReteTuple getTuple() {
+ public LeftTuple getTuple() {
return this.leftTuple;
}
Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/rule/VariableConstraint.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/rule/VariableConstraint.java 2008-03-20 12:55:29 UTC (rev 19137)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/rule/VariableConstraint.java 2008-03-20 13:28:04 UTC (rev 19138)
@@ -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.FieldExtractor;
@@ -96,7 +96,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/trunk/drools-core/src/main/java/org/drools/rule/VariableRestriction.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/rule/VariableRestriction.java 2008-03-20 12:55:29 UTC (rev 19137)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/rule/VariableRestriction.java 2008-03-20 13:28:04 UTC (rev 19138)
@@ -25,7 +25,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;
@@ -105,7 +105,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,
@@ -188,7 +188,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;
@@ -211,7 +211,7 @@
evaluator = (Evaluator)in.readObject();
object = in.readObject();
declaration = (Declaration)in.readObject();
- reteTuple = (ReteTuple)in.readObject();
+ reteTuple = (LeftTuple)in.readObject();
entry = (ContextEntry)in.readObject();
leftNull = in.readBoolean();
rightNull = in.readBoolean();
@@ -245,7 +245,7 @@
return this.object;
}
- public ReteTuple getTuple() {
+ public LeftTuple getTuple() {
return this.reteTuple;
}
@@ -300,7 +300,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,
@@ -361,7 +361,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,
@@ -422,7 +422,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,
@@ -483,7 +483,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,
@@ -543,7 +543,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/trunk/drools-core/src/main/java/org/drools/spi/BetaNodeFieldConstraint.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/spi/BetaNodeFieldConstraint.java 2008-03-20 12:55:29 UTC (rev 19137)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/spi/BetaNodeFieldConstraint.java 2008-03-20 13:28:04 UTC (rev 19138)
@@ -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 createContextEntry();
Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/spi/PropagationContext.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/spi/PropagationContext.java 2008-03-20 12:55:29 UTC (rev 19137)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/spi/PropagationContext.java 2008-03-20 13:28:04 UTC (rev 19138)
@@ -18,7 +18,7 @@
import java.io.Externalizable;
-import org.drools.reteoo.ReteTuple;
+import org.drools.reteoo.LeftTuple;
import org.drools.rule.EntryPoint;
import org.drools.rule.Rule;
@@ -48,7 +48,7 @@
Activation activation);
public Activation removeRetractedTuple(Rule rule,
- ReteTuple tuple);
+ LeftTuple tuple);
public void clearRetractedTuples();
Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/spi/Restriction.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/spi/Restriction.java 2008-03-20 12:55:29 UTC (rev 19137)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/spi/Restriction.java 2008-03-20 13:28:04 UTC (rev 19138)
@@ -5,7 +5,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;
@@ -23,7 +23,7 @@
public boolean isAllowedCachedLeft(ContextEntry context,
InternalFactHandle handle);
- public boolean isAllowedCachedRight(ReteTuple tuple,
+ public boolean isAllowedCachedRight(LeftTuple tuple,
ContextEntry context);
public ContextEntry createContextEntry();
Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/util/AbstractHashTable.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/util/AbstractHashTable.java 2008-03-20 12:55:29 UTC (rev 19137)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/util/AbstractHashTable.java 2008-03-20 13:28:04 UTC (rev 19138)
@@ -9,7 +9,7 @@
import java.io.ObjectInput;
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;
@@ -565,15 +565,15 @@
public static interface Index extends Externalizable {
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);
@@ -633,14 +633,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,
@@ -658,8 +658,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,
@@ -732,7 +732,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() );
@@ -742,7 +742,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();
@@ -755,8 +755,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();
@@ -854,7 +854,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() );
@@ -865,7 +865,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();
@@ -882,8 +882,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/trunk/drools-core/src/main/java/org/drools/util/FactHandleIndexHashTable.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/util/FactHandleIndexHashTable.java 2008-03-20 12:55:29 UTC (rev 19137)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/util/FactHandleIndexHashTable.java 2008-03-20 13:28:04 UTC (rev 19138)
@@ -5,7 +5,7 @@
import org.drools.common.InternalFactHandle;
import org.drools.reteoo.FactHandleMemory;
-import org.drools.reteoo.ReteTuple;
+import org.drools.reteoo.LeftTuple;
import org.drools.util.TupleIndexHashTable.FieldIndexEntry;
import java.io.ObjectInput;
@@ -89,7 +89,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();
}
@@ -237,7 +237,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 );
@@ -393,7 +393,7 @@
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(),
tuple );
Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/util/FactHashTable.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/util/FactHashTable.java 2008-03-20 12:55:29 UTC (rev 19137)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/util/FactHashTable.java 2008-03-20 13:28:04 UTC (rev 19138)
@@ -5,7 +5,7 @@
import org.drools.common.InternalFactHandle;
import org.drools.reteoo.FactHandleMemory;
-import org.drools.reteoo.ReteTuple;
+import org.drools.reteoo.LeftTuple;
public class FactHashTable extends AbstractHashTable
implements
@@ -23,7 +23,7 @@
loadFactor );
}
- public Iterator iterator(final ReteTuple tuple) {
+ public Iterator iterator(final LeftTuple tuple) {
return iterator();
}
Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/util/FactList.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/util/FactList.java 2008-03-20 12:55:29 UTC (rev 19137)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/util/FactList.java 2008-03-20 13:28:04 UTC (rev 19138)
@@ -7,7 +7,7 @@
import org.drools.common.InternalFactHandle;
import org.drools.reteoo.FactHandleMemory;
-import org.drools.reteoo.ReteTuple;
+import org.drools.reteoo.LeftTuple;
public class FactList
implements
@@ -20,7 +20,7 @@
this.list = new LinkedList();
}
- public Iterator iterator(final ReteTuple tuple) {
+ public Iterator iterator(final LeftTuple tuple) {
return iterator();
}
Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/util/TupleHashTable.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/util/TupleHashTable.java 2008-03-20 12:55:29 UTC (rev 19137)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/util/TupleHashTable.java 2008-03-20 13:28:04 UTC (rev 19138)
@@ -4,12 +4,12 @@
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;
public class TupleHashTable extends AbstractHashTable
implements
- TupleMemory {
+ LeftTupleMemory {
public TupleHashTable() {
this( 16,
0.75f );
@@ -25,7 +25,7 @@
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 +38,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 +86,7 @@
return this.table[index];
}
- public boolean contains(final ReteTuple tuple) {
+ public boolean contains(final LeftTuple tuple) {
return (get( tuple ) != null);
}
Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/util/TupleIndexHashTable.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/util/TupleIndexHashTable.java 2008-03-20 12:55:29 UTC (rev 19137)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/util/TupleIndexHashTable.java 2008-03-20 13:28:04 UTC (rev 19138)
@@ -4,8 +4,8 @@
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 java.io.ObjectOutput;
import java.io.ObjectInput;
@@ -14,7 +14,7 @@
public class TupleIndexHashTable extends AbstractHashTable
implements
- TupleMemory {
+ LeftTupleMemory {
private static final long serialVersionUID = 400L;
@@ -241,18 +241,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,
@@ -266,7 +266,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 ) {
@@ -286,7 +286,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,
@@ -329,7 +329,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,
@@ -369,7 +369,7 @@
private static final long serialVersionUID = 400L;
private Entry next;
- private ReteTuple first;
+ private LeftTuple first;
private int hashCode;
private Index index;
@@ -384,7 +384,7 @@
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
next = (Entry)in.readObject();
- first = (ReteTuple)in.readObject();
+ first = (LeftTuple)in.readObject();
hashCode = in.readInt();
index = (Index)in.readObject();
}
@@ -404,31 +404,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;
@@ -450,7 +450,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 );
Modified: labs/jbossrules/trunk/drools-core/src/test/java/org/drools/reteoo/AccumulateNodeTest.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/test/java/org/drools/reteoo/AccumulateNodeTest.java 2008-03-20 12:55:29 UTC (rev 19137)
+++ labs/jbossrules/trunk/drools-core/src/test/java/org/drools/reteoo/AccumulateNodeTest.java 2008-03-20 13:28:04 UTC (rev 19138)
@@ -128,10 +128,10 @@
0,
this.sink.getAsserted().size() );
- this.node.assertTuple( new ReteTuple( this.workingMemory.getFactHandleFactory().newFactHandle( "cheese", false, null ) ),
+ this.node.assertLeftTuple( 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.assertLeftTuple( new LeftTuple( this.workingMemory.getFactHandleFactory().newFactHandle( "other cheese", false, null ) ),
this.context,
this.workingMemory );
@@ -152,14 +152,14 @@
}
/**
- * 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#assertLeftTuple(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,
+ this.node.assertLeftTuple( tuple0,
this.context,
this.workingMemory );
// check memories
@@ -173,8 +173,8 @@
// assert tuple, should add left memory
final DefaultFactHandle f1 = (DefaultFactHandle) this.workingMemory.getFactHandleFactory().newFactHandle( "other cheese", false, null );
- final ReteTuple tuple1 = new ReteTuple( f1 );
- this.node.assertTuple( tuple1,
+ final LeftTuple tuple1 = new LeftTuple( f1 );
+ this.node.assertLeftTuple( tuple1,
this.context,
this.workingMemory );
assertEquals( 2,
@@ -182,7 +182,7 @@
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.getTupleMemory();
assertTrue( memory.contains( tuple0 ) );
assertTrue( memory.contains( tuple1 ) );
@@ -192,13 +192,13 @@
}
/**
- * 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#assertLeftTuple(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.context,
@@ -208,7 +208,7 @@
this.workingMemory );
// assert tuple, should add one to left memory
- this.node.assertTuple( tuple0,
+ this.node.assertLeftTuple( tuple0,
this.context,
this.workingMemory );
// check memories
@@ -221,8 +221,8 @@
this.accumulator.getMatchingObjects().size() );
// assert tuple, should add left memory
- final ReteTuple tuple1 = new ReteTuple( f1 );
- this.node.assertTuple( tuple1,
+ final LeftTuple tuple1 = new LeftTuple( f1 );
+ this.node.assertLeftTuple( tuple1,
this.context,
this.workingMemory );
assertEquals( 2,
@@ -231,7 +231,7 @@
2,
this.accumulator.getMatchingObjects().size() );
- final TupleMemory memory = this.memory.getTupleMemory();
+ final LeftTupleMemory memory = this.memory.getTupleMemory();
assertTrue( memory.contains( tuple0 ) );
assertTrue( memory.contains( tuple1 ) );
@@ -241,15 +241,15 @@
}
/**
- * 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#retractLeftTuple(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,
+ this.node.assertLeftTuple( tuple0,
this.context,
this.workingMemory );
// check memories
@@ -260,7 +260,7 @@
Assert.assertTrue( "An empty matching objects list should be propagated",
this.accumulator.getMatchingObjects().isEmpty() );
- this.node.retractTuple( tuple0,
+ this.node.retractLeftTuple( tuple0,
this.context,
this.workingMemory );
assertEquals( 0,
@@ -278,10 +278,10 @@
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,
+ this.node.assertLeftTuple( tuple0,
this.context,
this.workingMemory );
@@ -323,7 +323,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 );
this.node.assertObject( f0,
this.context,
@@ -335,7 +335,7 @@
this.memory.getFactHandleMemory().size() );
// assert tuple, should add one to left memory
- this.node.assertTuple( tuple0,
+ this.node.assertLeftTuple( tuple0,
this.context,
this.workingMemory );
@@ -434,7 +434,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 );
this.node.assertObject( f0,
this.context,
@@ -444,7 +444,7 @@
this.workingMemory );
// assert tuple, should not add to left memory, since we are in sequential mode
- this.node.assertTuple( tuple0,
+ this.node.assertLeftTuple( tuple0,
this.context,
this.workingMemory );
// check memories
@@ -456,8 +456,8 @@
this.accumulator.getMatchingObjects().size() );
// assert tuple, should not add left memory
- final ReteTuple tuple1 = new ReteTuple( f1 );
- this.node.assertTuple( tuple1,
+ final LeftTuple tuple1 = new LeftTuple( f1 );
+ this.node.assertLeftTuple( tuple1,
this.context,
this.workingMemory );
assertNull( this.memory.getTupleMemory() );
Modified: labs/jbossrules/trunk/drools-core/src/test/java/org/drools/reteoo/AgendaTest.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/test/java/org/drools/reteoo/AgendaTest.java 2008-03-20 12:55:29 UTC (rev 19137)
+++ labs/jbossrules/trunk/drools-core/src/test/java/org/drools/reteoo/AgendaTest.java 2008-03-20 13:28:04 UTC (rev 19138)
@@ -87,7 +87,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,
@@ -143,11 +143,11 @@
rule1.setNoLoop( false );
rule2.setDuration( 5000 );
- node1.assertTuple( tuple,
+ node1.assertLeftTuple( tuple,
context1,
workingMemory );
- node2.assertTuple( tuple,
+ node2.assertLeftTuple( tuple,
context1,
workingMemory );
@@ -202,7 +202,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,
@@ -221,7 +221,7 @@
};
rule.setNoLoop( false );
- node.assertTuple( tuple,
+ node.assertLeftTuple( tuple,
context,
workingMemory );
@@ -250,7 +250,7 @@
};
rule.setNoLoop( false );
- node.assertTuple( tuple,
+ node.assertLeftTuple( tuple,
context,
workingMemory );
@@ -287,7 +287,7 @@
}
};
- final ReteTuple tuple = new ReteTuple( new DefaultFactHandle( 1,
+ final LeftTuple tuple = new LeftTuple( new DefaultFactHandle( 1,
"cheese" ) );
// create a rule for each agendaGroup
@@ -358,7 +358,7 @@
assertEquals( 0,
agenda.focusStackSize() );
- node0.assertTuple( tuple,
+ node0.assertLeftTuple( tuple,
context0,
workingMemory );
@@ -369,7 +369,7 @@
// check main got the tuple
assertEquals( 1,
agenda.getFocus().size() );
- node2.assertTuple( tuple,
+ node2.assertLeftTuple( tuple,
context2,
workingMemory );
@@ -386,7 +386,7 @@
agenda.agendaSize() );
// put another one on agendaGroup 2
- node2.assertTuple( tuple,
+ node2.assertLeftTuple( tuple,
context2,
workingMemory );
@@ -414,14 +414,14 @@
agenda.getFocus().size() );
// add to agendaGroup 3
- node3.assertTuple( tuple,
+ node3.assertLeftTuple( tuple,
context3,
workingMemory );
assertEquals( 1,
agenda.getFocus().size() );
- node3.assertTuple( tuple,
+ node3.assertLeftTuple( tuple,
context3,
workingMemory );
@@ -523,7 +523,7 @@
}
};
- final ReteTuple tuple = new ReteTuple( new DefaultFactHandle( 1,
+ final LeftTuple tuple = new LeftTuple( new DefaultFactHandle( 1,
"cheese" ) );
// create a rule for the agendaGroup
@@ -544,7 +544,7 @@
// as its agendaGroup does not have focus.
rule.setAutoFocus( false );
- node.assertTuple( tuple,
+ node.assertLeftTuple( tuple,
context,
workingMemory );
@@ -567,7 +567,7 @@
// agendaGroup gets the focus when the activation is created.
rule.setAutoFocus( true );
- node.assertTuple( tuple,
+ node.assertLeftTuple( tuple,
context,
workingMemory );
@@ -588,7 +588,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
@@ -608,7 +608,7 @@
// When both the rule is lock-on-active and the agenda group is active, activations should be ignored
rule.setLockOnActive( true );
agendaGroup.setActive( true );
- node.assertTuple( tuple,
+ node.assertLeftTuple( tuple,
context,
workingMemory );
// activation should be ignored
@@ -617,7 +617,7 @@
// lock-on-active is now false so activation should propagate
rule.setLockOnActive( false );
- node.assertTuple( tuple,
+ node.assertLeftTuple( tuple,
context,
workingMemory );
assertEquals( 1,
@@ -626,7 +626,7 @@
// even if lock-on-active is true, unless the agenda group is active the activation will still propagate
rule.setLockOnActive( true );
agendaGroup.setActive( false );
- node.assertTuple( tuple,
+ node.assertLeftTuple( tuple,
context,
workingMemory );
assertEquals( 2,
@@ -662,7 +662,7 @@
}
};
- final ReteTuple tuple = new ReteTuple( new DefaultFactHandle( 1,
+ final LeftTuple tuple = new LeftTuple( new DefaultFactHandle( 1,
"cheese" ) );
// create a rule for each agendaGroup
@@ -719,7 +719,7 @@
null );
// Assert the tuple and check it was added to activation-group-0
- node0.assertTuple( tuple,
+ node0.assertLeftTuple( tuple,
context0,
workingMemory );
final ActivationGroup activationGroup0 = agenda.getActivationGroup( "activation-group-0" );
@@ -727,21 +727,21 @@
activationGroup0.size() );
// Removing a tuple should remove the activation from the activation-group-0 again
- node0.retractTuple( tuple,
+ node0.retractLeftTuple( tuple,
context0,
workingMemory );
assertEquals( 0,
activationGroup0.size() );
// Assert the tuple again and check it was added to activation-group-0
- node0.assertTuple( tuple,
+ node0.assertLeftTuple( tuple,
context0,
workingMemory );
assertEquals( 1,
activationGroup0.size() );
// Assert another tuple and check it was added to activation-group-0
- node1.assertTuple( tuple,
+ node1.assertLeftTuple( tuple,
context1,
workingMemory );
assertEquals( 2,
@@ -772,16 +772,16 @@
//-------------------
// Now try a more complex scenario involving two Xor Groups and one rule not in a Group
- node0.assertTuple( tuple,
+ node0.assertLeftTuple( tuple,
context0,
workingMemory );
- node1.assertTuple( tuple,
+ node1.assertLeftTuple( tuple,
context1,
workingMemory );
- node2.assertTuple( tuple,
+ node2.assertLeftTuple( tuple,
context2,
workingMemory );
- node3.assertTuple( tuple,
+ node3.assertLeftTuple( tuple,
context3,
workingMemory );
@@ -900,27 +900,27 @@
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,
+ node0.assertLeftTuple( tuple0,
context0,
workingMemory );
- final ReteTuple tuple1 = new ReteTuple( new DefaultFactHandle( 1,
+ final LeftTuple tuple1 = new LeftTuple( new DefaultFactHandle( 1,
"cheese" ) );
- node0.assertTuple( tuple1,
+ node0.assertLeftTuple( tuple1,
context0,
workingMemory );
- final ReteTuple tuple2 = new ReteTuple( new DefaultFactHandle( 1,
+ final LeftTuple tuple2 = new LeftTuple( new DefaultFactHandle( 1,
"cheese" ) );
- node1.assertTuple( tuple2,
+ node1.assertLeftTuple( tuple2,
context0,
workingMemory );
- final ReteTuple tuple3 = new ReteTuple( new DefaultFactHandle( 1,
+ final LeftTuple tuple3 = new LeftTuple( new DefaultFactHandle( 1,
"cheese" ) );
- node2.assertTuple( tuple3,
+ node2.assertLeftTuple( tuple3,
context0,
workingMemory );
@@ -1039,9 +1039,9 @@
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,
+ node1.assertLeftTuple( tuple1,
context0,
workingMemory );
}
@@ -1067,9 +1067,9 @@
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,
+ node0.assertLeftTuple( tuple0,
context0,
workingMemory );
@@ -1145,7 +1145,7 @@
rule1,
null );
- final ReteTuple tuple1 = new ReteTuple( new DefaultFactHandle( 1,
+ final LeftTuple tuple1 = new LeftTuple( new DefaultFactHandle( 1,
"cheese" ) );
// create rule0
@@ -1155,7 +1155,7 @@
public void evaluate(KnowledgeHelper knowledgeHelper,
WorkingMemory w) {
// deactivate rule1
- node1.retractTuple( tuple1,
+ node1.retractLeftTuple( tuple1,
context0,
workingMemory );
}
@@ -1182,13 +1182,13 @@
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,
+ node0.assertLeftTuple( tuple0,
context0,
workingMemory );
- node1.assertTuple( tuple1,
+ node1.assertLeftTuple( tuple1,
context0,
workingMemory );
@@ -1263,14 +1263,14 @@
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,
+ node0.assertLeftTuple( tuple0,
context0,
workingMemory );
- final ReteTuple tuple1 = new ReteTuple( new DefaultFactHandle( 1,
+ final LeftTuple tuple1 = new LeftTuple( new DefaultFactHandle( 1,
"cheese" ) );
- node0.assertTuple( tuple1,
+ node0.assertLeftTuple( tuple1,
context0,
workingMemory );
@@ -1362,9 +1362,9 @@
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,
+ node0.assertLeftTuple( tuple0,
context0,
workingMemory );
@@ -1396,9 +1396,9 @@
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,
+ node0.assertLeftTuple( tuple1,
context0,
workingMemory );
agenda.activateRuleFlowGroup( "rule-flow-group-0" );
@@ -1418,9 +1418,9 @@
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,
+ node0.assertLeftTuple( tuple2,
context0,
workingMemory );
assertEquals( 1,
@@ -1493,7 +1493,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
@@ -1514,7 +1514,7 @@
rule.setLockOnActive( true );
ruleFlowGroup.setAutoDeactivate( false );
ruleFlowGroup.setActive( true );
- node.assertTuple( tuple,
+ node.assertLeftTuple( tuple,
context,
workingMemory );
// activation should be ignored
@@ -1523,7 +1523,7 @@
// lock-on-active is now false so activation should propagate
rule.setLockOnActive( false );
- node.assertTuple( tuple,
+ node.assertLeftTuple( tuple,
context,
workingMemory );
assertEquals( 1,
@@ -1532,7 +1532,7 @@
// even if lock-on-active is true, unless the agenda group is active the activation will still propagate
rule.setLockOnActive( true );
ruleFlowGroup.setActive( false );
- node.assertTuple( tuple,
+ node.assertLeftTuple( tuple,
context,
workingMemory );
assertEquals( 2,
@@ -1565,7 +1565,7 @@
}
};
- final ReteTuple tuple = new ReteTuple( new DefaultFactHandle( 1,
+ final LeftTuple tuple = new LeftTuple( new DefaultFactHandle( 1,
"cheese" ) );
// create a rule for each agendaGroup
@@ -1642,7 +1642,7 @@
assertEquals( 0,
agenda.focusStackSize() );
- node0.assertTuple( tuple,
+ node0.assertLeftTuple( tuple,
context0,
workingMemory );
@@ -1653,7 +1653,7 @@
// check main got the tuple
assertEquals( 1,
agenda.getFocus().size() );
- node2.assertTuple( tuple,
+ node2.assertLeftTuple( tuple,
context2,
workingMemory );
@@ -1670,7 +1670,7 @@
agenda.agendaSize() );
// put another one on agendaGroup 1
- node2.assertTuple( tuple,
+ node2.assertLeftTuple( tuple,
context2,
workingMemory );
@@ -1696,14 +1696,14 @@
agenda.getFocus().size() );
// add to agendaGroup2
- node3.assertTuple( tuple,
+ node3.assertLeftTuple( tuple,
context3,
workingMemory );
assertEquals( 1,
agenda.getFocus().size() );
- node3.assertTuple( tuple,
+ node3.assertLeftTuple( tuple,
context3,
workingMemory );
Modified: labs/jbossrules/trunk/drools-core/src/test/java/org/drools/reteoo/BetaNodeTest.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/test/java/org/drools/reteoo/BetaNodeTest.java 2008-03-20 12:55:29 UTC (rev 19137)
+++ labs/jbossrules/trunk/drools-core/src/test/java/org/drools/reteoo/BetaNodeTest.java 2008-03-20 13:28:04 UTC (rev 19138)
@@ -46,7 +46,7 @@
* Test method for {@link org.drools.reteoo.BetaNode#equals(java.lang.Object)}.
*/
public void testEqualsObject() {
- final TupleSource ts = new MockTupleSource( 1 );
+ final LeftTupleSource ts = new MockTupleSource( 1 );
final ObjectSource os = new MockObjectSource( 2 );
ReteooRuleBase ruleBase = ( ReteooRuleBase ) RuleBaseFactory.newRuleBase();
Modified: labs/jbossrules/trunk/drools-core/src/test/java/org/drools/reteoo/CollectNodeTest.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/test/java/org/drools/reteoo/CollectNodeTest.java 2008-03-20 12:55:29 UTC (rev 19137)
+++ labs/jbossrules/trunk/drools-core/src/test/java/org/drools/reteoo/CollectNodeTest.java 2008-03-20 13:28:04 UTC (rev 19138)
@@ -126,10 +126,10 @@
0,
this.sink.getAsserted().size() );
- this.node.assertTuple( new ReteTuple( this.workingMemory.getFactHandleFactory().newFactHandle( "cheese", false, null ) ),
+ this.node.assertLeftTuple( 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.assertLeftTuple( new LeftTuple( this.workingMemory.getFactHandleFactory().newFactHandle( "other cheese", false, null ) ),
this.contextAssert,
this.workingMemory );
@@ -151,10 +151,10 @@
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,
+ this.node.assertLeftTuple( tuple0,
this.contextAssert,
this.workingMemory );
// check memories
@@ -168,8 +168,8 @@
// assert tuple, should add left memory
final DefaultFactHandle f1 = (DefaultFactHandle) this.workingMemory.getFactHandleFactory().newFactHandle( "other cheese", false, null );
- final ReteTuple tuple1 = new ReteTuple( f1 );
- this.node.assertTuple( tuple1,
+ final LeftTuple tuple1 = new LeftTuple( f1 );
+ this.node.assertLeftTuple( tuple1,
this.contextAssert,
this.workingMemory );
assertEquals( 2,
@@ -189,7 +189,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 );
this.node.assertObject( f0,
this.contextAssert,
@@ -199,7 +199,7 @@
this.workingMemory );
// assert tuple, should add one to left memory
- this.node.assertTuple( tuple0,
+ this.node.assertLeftTuple( tuple0,
this.contextAssert,
this.workingMemory );
// check memories
@@ -212,8 +212,8 @@
((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 );
- this.node.assertTuple( tuple1,
+ final LeftTuple tuple1 = new LeftTuple( f1 );
+ this.node.assertLeftTuple( tuple1,
this.contextAssert,
this.workingMemory );
assertEquals( 2,
@@ -233,10 +233,10 @@
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,
+ this.node.assertLeftTuple( tuple0,
this.contextAssert,
this.workingMemory );
// check memories
@@ -247,7 +247,7 @@
Assert.assertTrue( "An empty collection should be propagated",
((Collection) ((DefaultFactHandle) ((Tuple) ((Object[]) this.sink.getAsserted().get( 0 ))[0]).get( 1 )).getObject()).isEmpty() );
- this.node.retractTuple( tuple0,
+ this.node.retractLeftTuple( tuple0,
this.contextRetract,
this.workingMemory );
assertEquals( 0,
@@ -262,10 +262,10 @@
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,
+ this.node.assertLeftTuple( tuple0,
this.contextAssert,
this.workingMemory );
@@ -306,7 +306,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 );
this.node.assertObject( f0,
this.contextAssert,
@@ -318,7 +318,7 @@
this.memory.betaMemory.getFactHandleMemory().size() );
// assert tuple, should add one to left memory
- this.node.assertTuple( tuple0,
+ this.node.assertLeftTuple( tuple0,
this.contextAssert,
this.workingMemory );
@@ -394,12 +394,12 @@
(ReteooRuleBase) RuleBaseFactory.newRuleBase( conf ) );
this.memory = (CollectMemory) this.workingMemory.getNodeMemory( this.node );
- this.node.setTupleMemoryEnabled( false );
+ this.node.setLeftTupleMemoryEnabled( false );
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.contextAssert,
@@ -409,7 +409,7 @@
this.workingMemory );
// assert tuple, should not add to left memory, since we are in sequential mode
- this.node.assertTuple( tuple0,
+ this.node.assertLeftTuple( tuple0,
this.contextAssert,
this.workingMemory );
// check memories
@@ -421,8 +421,8 @@
((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 );
- this.node.assertTuple( tuple1,
+ final LeftTuple tuple1 = new LeftTuple( f1 );
+ this.node.assertLeftTuple( tuple1,
this.contextAssert,
this.workingMemory );
assertNull( this.memory.betaMemory.getTupleMemory() );
Modified: labs/jbossrules/trunk/drools-core/src/test/java/org/drools/reteoo/CompositeObjectSinkAdapterTest.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/test/java/org/drools/reteoo/CompositeObjectSinkAdapterTest.java 2008-03-20 12:55:29 UTC (rev 19137)
+++ labs/jbossrules/trunk/drools-core/src/test/java/org/drools/reteoo/CompositeObjectSinkAdapterTest.java 2008-03-20 13:28:04 UTC (rev 19138)
@@ -471,7 +471,7 @@
static class MockBetaNode extends BetaNode {
MockBetaNode(final int id,
- final TupleSource leftInput,
+ final LeftTupleSource leftInput,
final ObjectSource rightInput) {
super( id,
leftInput,
@@ -480,21 +480,21 @@
// 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 assertLeftTuple(final LeftTuple tuple,
final PropagationContext context,
final InternalWorkingMemory workingMemory) {
// Auto-generated method stub
}
- public void retractTuple(final ReteTuple tuple,
+ public void retractLeftTuple(final LeftTuple tuple,
final PropagationContext context,
final InternalWorkingMemory workingMemory) {
// Auto-generated method stub
Modified: labs/jbossrules/trunk/drools-core/src/test/java/org/drools/reteoo/EvalConditionNodeTest.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/test/java/org/drools/reteoo/EvalConditionNodeTest.java 2008-03-20 12:55:29 UTC (rev 19137)
+++ labs/jbossrules/trunk/drools-core/src/test/java/org/drools/reteoo/EvalConditionNodeTest.java 2008-03-20 13:28:04 UTC (rev 19138)
@@ -106,20 +106,20 @@
// 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,
+ node.assertLeftTuple( tuple0,
this.context,
this.workingMemory );
// 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,
+ node.assertLeftTuple( tuple1,
this.context,
this.workingMemory );
@@ -152,10 +152,10 @@
// 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,
+ node.assertLeftTuple( tuple0,
this.context,
this.workingMemory );
@@ -163,10 +163,10 @@
// 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,
+ node.assertLeftTuple( tuple1,
this.context,
this.workingMemory );
@@ -183,7 +183,7 @@
sink.getAsserted().size() );
// Now test that the fact is retracted correctly
- node.retractTuple( tuple0,
+ node.retractLeftTuple( tuple0,
this.context,
this.workingMemory );
@@ -198,7 +198,7 @@
sink.getRetracted().size() );
// Now test that the fact is retracted correctly
- node.retractTuple( tuple1,
+ node.retractLeftTuple( tuple1,
this.context,
this.workingMemory );
@@ -226,20 +226,20 @@
// 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,
+ node.assertLeftTuple( tuple0,
this.context,
this.workingMemory );
// 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,
+ node.assertLeftTuple( tuple1,
this.context,
this.workingMemory );
@@ -281,9 +281,9 @@
final DefaultFactHandle f0 = new DefaultFactHandle( 0,
"string0" );
- final ReteTuple tuple1 = new ReteTuple( f0 );
+ final LeftTuple tuple1 = new LeftTuple( f0 );
- node.assertTuple( tuple1,
+ node.assertLeftTuple( tuple1,
this.context,
workingMemory );
Modified: labs/jbossrules/trunk/drools-core/src/test/java/org/drools/reteoo/ExistsNodeTest.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/test/java/org/drools/reteoo/ExistsNodeTest.java 2008-03-20 12:55:29 UTC (rev 19137)
+++ labs/jbossrules/trunk/drools-core/src/test/java/org/drools/reteoo/ExistsNodeTest.java 2008-03-20 13:28:04 UTC (rev 19138)
@@ -94,9 +94,9 @@
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.node.assertLeftTuple( tuple1,
this.context,
this.workingMemory );
@@ -123,14 +123,14 @@
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 );
- this.node.assertTuple( tuple2,
+ final LeftTuple tuple2 = new LeftTuple( f2 );
+ this.node.assertLeftTuple( tuple2,
this.context,
this.workingMemory );
@@ -173,9 +173,9 @@
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.node.assertLeftTuple( tuple1,
this.context,
this.workingMemory );
@@ -205,8 +205,8 @@
// 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 );
- this.node.assertTuple( tuple2,
+ final LeftTuple tuple2 = new LeftTuple( f2 );
+ this.node.assertLeftTuple( tuple2,
this.context,
this.workingMemory );
@@ -228,9 +228,9 @@
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.node.assertLeftTuple( tuple1,
this.context,
this.workingMemory );
@@ -273,15 +273,15 @@
this.memory.getTupleMemory().size() );
// simulate modify
- this.node.retractTuple( tuple1,
+ this.node.retractLeftTuple( tuple1,
this.context,
this.workingMemory );
- this.node.assertTuple( tuple1,
+ this.node.assertLeftTuple( tuple1,
this.context,
this.workingMemory );
assertEquals( 1,
this.memory.getTupleMemory().size() );
- this.node.retractTuple( tuple1,
+ this.node.retractLeftTuple( tuple1,
this.context,
this.workingMemory );
assertEquals( 0,
Modified: labs/jbossrules/trunk/drools-core/src/test/java/org/drools/reteoo/FromNodeTest.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/test/java/org/drools/reteoo/FromNodeTest.java 2008-03-20 12:55:29 UTC (rev 19137)
+++ labs/jbossrules/trunk/drools-core/src/test/java/org/drools/reteoo/FromNodeTest.java 2008-03-20 13:28:04 UTC (rev 19138)
@@ -77,8 +77,8 @@
final Person person1 = new Person( "xxx1",
30 );
final FactHandle person1Handle = workingMemory.insert( person1 );
- final ReteTuple tuple1 = new ReteTuple( (DefaultFactHandle) person1Handle );
- from.assertTuple( tuple1,
+ final LeftTuple tuple1 = new LeftTuple( (DefaultFactHandle) person1Handle );
+ from.assertLeftTuple( tuple1,
context,
workingMemory );
@@ -91,8 +91,8 @@
final Person person2 = new Person( "xxx2",
30 );
final FactHandle person2Handle = workingMemory.insert( person2 );
- final ReteTuple tuple2 = new ReteTuple( (DefaultFactHandle) person2Handle );
- from.assertTuple( tuple2,
+ final LeftTuple tuple2 = new LeftTuple( (DefaultFactHandle) person2Handle );
+ from.assertLeftTuple( tuple2,
context,
workingMemory );
@@ -109,8 +109,8 @@
final Person person3 = new Person( "xxx2",
30 );
final FactHandle person3Handle = workingMemory.insert( person3 );
- final ReteTuple tuple3 = new ReteTuple( (DefaultFactHandle) person3Handle );
- from.assertTuple( tuple3,
+ final LeftTuple tuple3 = new LeftTuple( (DefaultFactHandle) person3Handle );
+ from.assertLeftTuple( tuple3,
context,
workingMemory );
@@ -184,8 +184,8 @@
final Person person1 = new Person( "xxx1",
30 );
final FactHandle person1Handle = workingMemory.insert( person1 );
- final ReteTuple tuple1 = new ReteTuple( (DefaultFactHandle) person1Handle );
- from.assertTuple( tuple1,
+ final LeftTuple tuple1 = new LeftTuple( (DefaultFactHandle) person1Handle );
+ from.assertLeftTuple( tuple1,
context,
workingMemory );
@@ -198,8 +198,8 @@
final Person person2 = new Person( "xxx2",
30 );
final FactHandle person2Handle = workingMemory.insert( person2 );
- final ReteTuple tuple2 = new ReteTuple( (DefaultFactHandle) person2Handle );
- from.assertTuple( tuple2,
+ final LeftTuple tuple2 = new LeftTuple( (DefaultFactHandle) person2Handle );
+ from.assertLeftTuple( tuple2,
context,
workingMemory );
@@ -216,8 +216,8 @@
final Person person3 = new Person( "xxx2",
30 );
final FactHandle person3Handle = workingMemory.insert( person3 );
- final ReteTuple tuple3 = new ReteTuple( (DefaultFactHandle) person3Handle );
- from.assertTuple( tuple3,
+ final LeftTuple tuple3 = new LeftTuple( (DefaultFactHandle) person3Handle );
+ from.assertLeftTuple( tuple3,
context,
workingMemory );
@@ -276,8 +276,8 @@
final Person person1 = new Person( "xxx2",
30 );
final FactHandle person1Handle = workingMemory.insert( person1 );
- final ReteTuple tuple = new ReteTuple( (DefaultFactHandle) person1Handle );
- from.assertTuple( tuple,
+ final LeftTuple tuple = new LeftTuple( (DefaultFactHandle) person1Handle );
+ from.assertLeftTuple( tuple,
context,
workingMemory );
@@ -298,7 +298,7 @@
assertEquals( handle2.getObject(),
cheese2 );
- from.retractTuple( tuple,
+ from.retractLeftTuple( tuple,
context,
workingMemory );
assertEquals( 0,
Modified: labs/jbossrules/trunk/drools-core/src/test/java/org/drools/reteoo/InstrumentedReteTuple.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/test/java/org/drools/reteoo/InstrumentedReteTuple.java 2008-03-20 12:55:29 UTC (rev 19137)
+++ labs/jbossrules/trunk/drools-core/src/test/java/org/drools/reteoo/InstrumentedReteTuple.java 2008-03-20 13:28:04 UTC (rev 19138)
@@ -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/trunk/drools-core/src/test/java/org/drools/reteoo/JoinNodeTest.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/test/java/org/drools/reteoo/JoinNodeTest.java 2008-03-20 12:55:29 UTC (rev 19137)
+++ labs/jbossrules/trunk/drools-core/src/test/java/org/drools/reteoo/JoinNodeTest.java 2008-03-20 13:28:04 UTC (rev 19138)
@@ -93,9 +93,9 @@
objectFfield.setAccessible( true );
ObjectSinkPropagator objectSink = (ObjectSinkPropagator) 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() );
@@ -106,7 +106,7 @@
this.node.attach();
objectSink = (ObjectSinkPropagator) objectFfield.get( this.objectSource );
- tupleSink = (TupleSinkPropagator) tupleField.get( this.tupleSource );
+ tupleSink = (LeftTupleSinkPropagator) tupleField.get( this.tupleSource );
assertEquals( 1,
objectSink.getSinks().length );
@@ -149,10 +149,10 @@
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,
+ this.node.assertLeftTuple( tuple0,
this.context,
this.workingMemory );
// check memories, left memory is populated, right memory is emptys
@@ -164,8 +164,8 @@
// assert tuple, should add left memory should be 2
final DefaultFactHandle f1 = new DefaultFactHandle( 1,
"cheese" );
- final ReteTuple tuple1 = new ReteTuple( f1 );
- this.node.assertTuple( tuple1,
+ final LeftTuple tuple1 = new LeftTuple( f1 );
+ this.node.assertLeftTuple( tuple1,
this.context,
this.workingMemory );
assertEquals( 2,
@@ -209,14 +209,14 @@
final DefaultFactHandle f0 = new DefaultFactHandle( 0,
"cheese" );
- final ReteTuple tuple0 = new ReteTuple( f0 );
+ final LeftTuple tuple0 = new LeftTuple( f0 );
this.node.assertObject( f0,
this.context,
this.workingMemory );
// assert tuple
- this.node.assertTuple( tuple0,
+ this.node.assertLeftTuple( tuple0,
this.context,
this.workingMemory );
@@ -228,7 +228,7 @@
assertEquals( 1,
this.memory.getFactHandleMemory().size() );
- assertEquals( new ReteTuple( tuple0,
+ assertEquals( new LeftTuple( tuple0,
f0 ),
((Object[]) this.sink.getAsserted().get( 0 ))[0] );
}
@@ -258,7 +258,7 @@
assertEquals( 2,
this.memory.getFactHandleMemory().size() );
- final Iterator it = this.memory.getFactHandleMemory().iterator( new ReteTuple( f0 ) );
+ final Iterator it = this.memory.getFactHandleMemory().iterator( new LeftTuple( f0 ) );
final InternalFactHandle rf0 = ((FactEntry) it.next()).getFactHandle();
final InternalFactHandle rf1 = ((FactEntry) it.next()).getFactHandle();
@@ -284,28 +284,28 @@
// assert tuple, should add left memory should be 2
final DefaultFactHandle f1 = new DefaultFactHandle( 1,
"cheese" );
- final ReteTuple tuple1 = new ReteTuple( f1 );
- this.node.assertTuple( tuple1,
+ final LeftTuple tuple1 = new LeftTuple( f1 );
+ this.node.assertLeftTuple( tuple1,
this.context,
this.workingMemory );
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 );
- this.node.assertTuple( tuple2,
+ final LeftTuple tuple2 = new LeftTuple( f2 );
+ this.node.assertLeftTuple( 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] );
@@ -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 ) ) );
}
@@ -341,14 +341,14 @@
this.workingMemory );
final DefaultFactHandle f1 = (DefaultFactHandle) this.workingMemory.insert( "test1" );
- final ReteTuple tuple1 = new ReteTuple( f1 );
- this.node.assertTuple( tuple1,
+ final LeftTuple tuple1 = new LeftTuple( f1 );
+ this.node.assertLeftTuple( tuple1,
this.context,
this.workingMemory );
final DefaultFactHandle f2 = (DefaultFactHandle) this.workingMemory.insert( "test2" );
- final ReteTuple tuple2 = new ReteTuple( f2 );
- this.node.assertTuple( tuple2,
+ final LeftTuple tuple2 = new LeftTuple( f2 );
+ this.node.assertLeftTuple( tuple2,
this.context,
this.workingMemory );
@@ -380,15 +380,15 @@
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 ) );
- this.node.retractTuple( tuple2,
+ this.node.retractLeftTuple( tuple2,
this.context,
this.workingMemory );
assertEquals( 4,
@@ -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 ) ) );
}
@@ -415,8 +415,8 @@
// assert tuple, should add left memory should be 2
final DefaultFactHandle f1 = new DefaultFactHandle( 1,
"cheese" );
- final ReteTuple tuple1 = new ReteTuple( f1 );
- this.node.assertTuple( tuple1,
+ final LeftTuple tuple1 = new LeftTuple( f1 );
+ this.node.assertLeftTuple( tuple1,
this.context,
this.workingMemory );
@@ -452,9 +452,9 @@
final DefaultFactHandle f0 = new DefaultFactHandle( 0,
"string0" );
- final ReteTuple tuple1 = new ReteTuple( f0 );
+ final LeftTuple tuple1 = new LeftTuple( f0 );
- joinNode.assertTuple( tuple1,
+ joinNode.assertLeftTuple( tuple1,
this.context,
workingMemory );
Modified: labs/jbossrules/trunk/drools-core/src/test/java/org/drools/reteoo/LogicalAssertionTest.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/test/java/org/drools/reteoo/LogicalAssertionTest.java 2008-03-20 12:55:29 UTC (rev 19137)
+++ labs/jbossrules/trunk/drools-core/src/test/java/org/drools/reteoo/LogicalAssertionTest.java 2008-03-20 13:28:04 UTC (rev 19138)
@@ -101,7 +101,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,
@@ -109,7 +109,7 @@
null );
// Test single activation for a single logical assertions
- node.assertTuple( tuple1,
+ node.assertLeftTuple( tuple1,
context1,
workingMemory );
@@ -120,7 +120,7 @@
rule1,
tuple1.getActivation() );
// Retract the tuple and test the logically asserted fact was also retracted
- node.retractTuple( tuple1,
+ node.retractLeftTuple( tuple1,
context1,
workingMemory );
@@ -137,7 +137,7 @@
// Test single activation for a single logical assertions. This also
// tests that logical assertions live on after the related Activation
// has fired.
- node.assertTuple( tuple1,
+ node.assertLeftTuple( tuple1,
context1,
workingMemory );
logicalHandle = workingMemory.insert( logicalString,
@@ -148,7 +148,7 @@
agenda.fireNextItem( null );
- node.retractTuple( tuple1,
+ node.retractLeftTuple( tuple1,
context1,
workingMemory );
@@ -211,7 +211,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,
@@ -219,7 +219,7 @@
null );
// Test single activation for a single logical assertions
- node.assertTuple( tuple1,
+ node.assertLeftTuple( tuple1,
context1,
workingMemory );
@@ -308,7 +308,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,
@@ -316,7 +316,7 @@
null );
// Test that a STATED assertion overrides a logical assertion
- node.assertTuple( tuple1,
+ node.assertLeftTuple( tuple1,
context1,
workingMemory );
@@ -332,7 +332,7 @@
String logicalString2 = new String( "logical" );
FactHandle logicalHandle2 = workingMemory.insert( logicalString2 );
- node.retractTuple( tuple1,
+ node.retractLeftTuple( tuple1,
context1,
workingMemory );
@@ -351,7 +351,7 @@
workingMemory.getObject( logicalHandle2 ) );
// Test that a logical assertion cannot override a STATED assertion
- node.assertTuple( tuple1,
+ node.assertLeftTuple( tuple1,
context1,
workingMemory );
@@ -380,7 +380,7 @@
assertSame( logicalHandle2,
logicalHandle1 );
- node.retractTuple( tuple1,
+ node.retractLeftTuple( tuple1,
context1,
workingMemory );
@@ -462,7 +462,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,
@@ -470,7 +470,7 @@
null );
// Test that a STATED assertion overrides a logical assertion
- node.assertTuple( tuple1,
+ node.assertLeftTuple( tuple1,
context1,
workingMemory );
@@ -486,7 +486,7 @@
String logicalString2 = new String( "logical" );
FactHandle logicalHandle2 = workingMemory.insert( logicalString2 );
- node.retractTuple( tuple1,
+ node.retractLeftTuple( tuple1,
context1,
workingMemory );
@@ -505,7 +505,7 @@
workingMemory.getObject( logicalHandle2 ) );
// Test that a logical assertion cannot override a STATED assertion
- node.assertTuple( tuple1,
+ node.assertLeftTuple( tuple1,
context1,
workingMemory );
@@ -559,14 +559,14 @@
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,
null,
null );
- node.assertTuple( tuple1,
+ node.assertLeftTuple( tuple1,
context,
workingMemory );
@@ -589,13 +589,13 @@
final DefaultFactHandle handle2 = new DefaultFactHandle( 2,
"cheese" );
- final ReteTuple tuple2 = new ReteTuple( handle2 );
+ final LeftTuple tuple2 = new LeftTuple( handle2 );
- node.assertTuple( tuple2,
+ node.assertLeftTuple( tuple2,
context,
workingMemory );
- node2.assertTuple( tuple2,
+ node2.assertLeftTuple( tuple2,
context,
workingMemory );
@@ -668,14 +668,14 @@
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,
null,
null );
// get the activation onto the agenda
- node.assertTuple( tuple1,
+ node.assertLeftTuple( tuple1,
context1,
workingMemory );
@@ -690,7 +690,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,
@@ -698,7 +698,7 @@
null );
// get the activations onto the agenda
- node2.assertTuple( tuple2,
+ node2.assertLeftTuple( tuple2,
context2,
workingMemory );
@@ -723,7 +723,7 @@
workingMemory.getTruthMaintenanceSystem().getJustifiedMap().values() );
// Now lets cancel the first activation
- node2.retractTuple( tuple2,
+ node2.retractLeftTuple( tuple2,
context2,
workingMemory );
@@ -738,7 +738,7 @@
workingMemory.getTruthMaintenanceSystem().getJustifiedMap().values() );
// now remove that final justification
- node.retractTuple( tuple1,
+ node.retractLeftTuple( tuple1,
context1,
workingMemory );
@@ -805,7 +805,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,
@@ -813,7 +813,7 @@
null );
// Assert multiple stated objects
- node.assertTuple( tuple1,
+ node.assertLeftTuple( tuple1,
context1,
workingMemory );
@@ -913,7 +913,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,
@@ -921,7 +921,7 @@
null );
// Test that a STATED assertion overrides a logical assertion
- node.assertTuple( tuple1,
+ node.assertLeftTuple( tuple1,
context1,
workingMemory );
Modified: labs/jbossrules/trunk/drools-core/src/test/java/org/drools/reteoo/MockTupleSink.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/test/java/org/drools/reteoo/MockTupleSink.java 2008-03-20 12:55:29 UTC (rev 19137)
+++ labs/jbossrules/trunk/drools-core/src/test/java/org/drools/reteoo/MockTupleSink.java 2008-03-20 13:28:04 UTC (rev 19138)
@@ -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 assertLeftTuple(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 retractLeftTuple(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 getPreviousLeftTupleSinkNode() {
return this.previousTupleSinkNode;
}
@@ -145,16 +145,16 @@
* @param previous
* The previous TupleSinkNode
*/
- public void setPreviousTupleSinkNode(final TupleSinkNode previous) {
+ public void setPreviousLeftTupleSinkNode(final LeftTupleSinkNode previous) {
this.previousTupleSinkNode = previous;
}
- public boolean isTupleMemoryEnabled() {
+ public boolean isLeftTupleMemoryEnabled() {
// TODO Auto-generated method stub
return false;
}
- public void setTupleMemoryEnabled(boolean tupleMemoryEnabled) {
+ public void setLeftTupleMemoryEnabled(boolean tupleMemoryEnabled) {
// TODO Auto-generated method stub
}
Modified: labs/jbossrules/trunk/drools-core/src/test/java/org/drools/reteoo/MockTupleSource.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/test/java/org/drools/reteoo/MockTupleSource.java 2008-03-20 12:55:29 UTC (rev 19137)
+++ labs/jbossrules/trunk/drools-core/src/test/java/org/drools/reteoo/MockTupleSource.java 2008-03-20 13:28:04 UTC (rev 19138)
@@ -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/trunk/drools-core/src/test/java/org/drools/reteoo/NotNodeTest.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/test/java/org/drools/reteoo/NotNodeTest.java 2008-03-20 12:55:29 UTC (rev 19137)
+++ labs/jbossrules/trunk/drools-core/src/test/java/org/drools/reteoo/NotNodeTest.java 2008-03-20 13:28:04 UTC (rev 19138)
@@ -100,9 +100,9 @@
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.node.assertLeftTuple( tuple1,
this.context,
this.workingMemory );
@@ -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
@@ -132,14 +132,14 @@
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 );
- this.node.assertTuple( tuple2,
+ final LeftTuple tuple2 = new LeftTuple( f2 );
+ this.node.assertLeftTuple( tuple2,
this.context,
this.workingMemory );
@@ -182,9 +182,9 @@
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.node.assertLeftTuple( tuple1,
this.context,
this.workingMemory );
@@ -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
@@ -217,8 +217,8 @@
// 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 );
- this.node.assertTuple( tuple2,
+ final LeftTuple tuple2 = new LeftTuple( f2 );
+ this.node.assertLeftTuple( tuple2,
this.context,
this.workingMemory );
@@ -241,9 +241,9 @@
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.node.assertLeftTuple( tuple1,
this.context,
this.workingMemory );
@@ -286,15 +286,15 @@
this.memory.getTupleMemory().size() );
// simulate modify
- this.node.retractTuple( tuple1,
+ this.node.retractLeftTuple( tuple1,
this.context,
this.workingMemory );
- this.node.assertTuple( tuple1,
+ this.node.assertLeftTuple( tuple1,
this.context,
this.workingMemory );
assertEquals( 1,
this.memory.getTupleMemory().size() );
- this.node.retractTuple( tuple1,
+ this.node.retractLeftTuple( tuple1,
this.context,
this.workingMemory );
assertEquals( 0,
@@ -355,14 +355,14 @@
final DefaultFactHandle f0 = new DefaultFactHandle( 0,
"cheese" );
- final ReteTuple tuple0 = new ReteTuple( f0 );
+ final LeftTuple tuple0 = new LeftTuple( f0 );
this.node.assertObject( f0,
this.context,
this.workingMemory );
// assert tuple
- this.node.assertTuple( tuple0,
+ this.node.assertLeftTuple( tuple0,
this.context,
this.workingMemory );
Modified: labs/jbossrules/trunk/drools-core/src/test/java/org/drools/reteoo/RuleFlowGroupTest.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/test/java/org/drools/reteoo/RuleFlowGroupTest.java 2008-03-20 12:55:29 UTC (rev 19137)
+++ labs/jbossrules/trunk/drools-core/src/test/java/org/drools/reteoo/RuleFlowGroupTest.java 2008-03-20 13:28:04 UTC (rev 19138)
@@ -208,33 +208,33 @@
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,
+ node0.assertLeftTuple( tuple0,
context0,
workingMemory );
- final ReteTuple tuple1 = new ReteTuple( new DefaultFactHandle( 1,
+ final LeftTuple tuple1 = new LeftTuple( new DefaultFactHandle( 1,
"cheese" ) );
- node0.assertTuple( tuple1,
+ node0.assertLeftTuple( tuple1,
context0,
workingMemory );
- final ReteTuple tuple2 = new ReteTuple( new DefaultFactHandle( 1,
+ final LeftTuple tuple2 = new LeftTuple( new DefaultFactHandle( 1,
"cheese" ) );
- node1.assertTuple( tuple2,
+ node1.assertLeftTuple( tuple2,
context0,
workingMemory );
- final ReteTuple tuple3 = new ReteTuple( new DefaultFactHandle( 1,
+ final LeftTuple tuple3 = new LeftTuple( new DefaultFactHandle( 1,
"cheese" ) );
- node2.assertTuple( tuple3,
+ node2.assertLeftTuple( tuple3,
context0,
workingMemory );
- final ReteTuple tuple4 = new ReteTuple( new DefaultFactHandle( 1,
+ final LeftTuple tuple4 = new LeftTuple( new DefaultFactHandle( 1,
"cheese" ) );
- node3.assertTuple( tuple4,
+ node3.assertLeftTuple( tuple4,
context0,
workingMemory );
@@ -497,45 +497,45 @@
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,
+ node0.assertLeftTuple( tuple0,
context0,
workingMemory );
- final ReteTuple tuple1 = new ReteTuple( new DefaultFactHandle( 1,
+ final LeftTuple tuple1 = new LeftTuple( new DefaultFactHandle( 1,
"cheese" ) );
- node0.assertTuple( tuple1,
+ node0.assertLeftTuple( tuple1,
context0,
workingMemory );
- final ReteTuple tuple2 = new ReteTuple( new DefaultFactHandle( 1,
+ final LeftTuple tuple2 = new LeftTuple( new DefaultFactHandle( 1,
"cheese" ) );
- node1.assertTuple( tuple2,
+ node1.assertLeftTuple( tuple2,
context0,
workingMemory );
- final ReteTuple tuple3 = new ReteTuple( new DefaultFactHandle( 1,
+ final LeftTuple tuple3 = new LeftTuple( new DefaultFactHandle( 1,
"cheese" ) );
- node2.assertTuple( tuple3,
+ node2.assertLeftTuple( tuple3,
context0,
workingMemory );
- final ReteTuple tuple4 = new ReteTuple( new DefaultFactHandle( 1,
+ final LeftTuple tuple4 = new LeftTuple( new DefaultFactHandle( 1,
"cheese" ) );
- node3.assertTuple( tuple4,
+ node3.assertLeftTuple( tuple4,
context0,
workingMemory );
- final ReteTuple splitTuple1 = new ReteTuple( new DefaultFactHandle( 1,
+ final LeftTuple splitTuple1 = new LeftTuple( new DefaultFactHandle( 1,
"cheese" ) );
- splitNode1.assertTuple( splitTuple1,
+ splitNode1.assertLeftTuple( splitTuple1,
context0,
workingMemory );
- final ReteTuple splitTuple2 = new ReteTuple( new DefaultFactHandle( 1,
+ final LeftTuple splitTuple2 = new LeftTuple( new DefaultFactHandle( 1,
"cheese" ) );
- splitNode2.assertTuple( splitTuple2,
+ splitNode2.assertLeftTuple( splitTuple2,
context0,
workingMemory );
Modified: labs/jbossrules/trunk/drools-core/src/test/java/org/drools/reteoo/SchedulerTest.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/test/java/org/drools/reteoo/SchedulerTest.java 2008-03-20 12:55:29 UTC (rev 19137)
+++ labs/jbossrules/trunk/drools-core/src/test/java/org/drools/reteoo/SchedulerTest.java 2008-03-20 13:28:04 UTC (rev 19138)
@@ -103,13 +103,13 @@
null,
null );
- final ReteTuple tuple = new ReteTuple( new DefaultFactHandle( 1,
+ final LeftTuple tuple = new LeftTuple( new DefaultFactHandle( 1,
"cheese" ) );
assertEquals( 0,
data.size() );
- node.assertTuple( tuple,
+ node.assertLeftTuple( tuple,
context,
workingMemory );
@@ -165,9 +165,9 @@
0,
rule,
knowledgeHelper.getActivation() );
- final ReteTuple tuple2 = new ReteTuple( new DefaultFactHandle( 2,
+ final LeftTuple tuple2 = new LeftTuple( new DefaultFactHandle( 2,
"cheese" ) );
- node.assertTuple( tuple2,
+ node.assertLeftTuple( tuple2,
context2,
(ReteooWorkingMemory) workingMemory );
}
@@ -187,10 +187,10 @@
null,
null );
- final ReteTuple tuple1 = new ReteTuple( new DefaultFactHandle( 1,
+ final LeftTuple tuple1 = new LeftTuple( new DefaultFactHandle( 1,
"cheese" ) );
- node.assertTuple( tuple1,
+ node.assertLeftTuple( tuple1,
context1,
workingMemory );
@@ -253,9 +253,9 @@
0,
rule,
knowledgeHelper.getActivation() );
- final ReteTuple tuple2 = new ReteTuple( new DefaultFactHandle( 2,
+ final LeftTuple tuple2 = new LeftTuple( new DefaultFactHandle( 2,
"cheese" ) );
- node.assertTuple( tuple2,
+ node.assertLeftTuple( tuple2,
context2,
(ReteooWorkingMemory) workingMemory );
}
@@ -275,9 +275,9 @@
null,
null );
- final ReteTuple tuple1 = new ReteTuple( new DefaultFactHandle( 1,
+ final LeftTuple tuple1 = new LeftTuple( new DefaultFactHandle( 1,
"cheese" ) );
- node.assertTuple( tuple1,
+ node.assertLeftTuple( tuple1,
context1,
workingMemory );
assertEquals( 0,
Modified: labs/jbossrules/trunk/drools-core/src/test/java/org/drools/reteoo/TupleSourceTest.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/test/java/org/drools/reteoo/TupleSourceTest.java 2008-03-20 12:55:29 UTC (rev 19137)
+++ labs/jbossrules/trunk/drools-core/src/test/java/org/drools/reteoo/TupleSourceTest.java 2008-03-20 13:28:04 UTC (rev 19138)
@@ -32,16 +32,16 @@
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(),
sink );
final MockTupleSink sink1 = new MockTupleSink();
source.addTupleSink( sink1 );
- sink = (TupleSinkPropagator) field.get( source );
+ sink = (LeftTupleSinkPropagator) field.get( source );
assertSame( SingleTupleSinkAdapter.class,
sink.getClass() );
assertEquals( 1,
@@ -49,7 +49,7 @@
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,14 +69,14 @@
sink.getSinks().length );
source.removeTupleSink( sink1 );
- sink = (TupleSinkPropagator) field.get( source );
+ sink = (LeftTupleSinkPropagator) field.get( source );
assertSame( SingleTupleSinkAdapter.class,
sink.getClass() );
assertEquals( 1,
sink.getSinks().length );
source.removeTupleSink( sink3 );
- sink = (TupleSinkPropagator) field.get( source );
+ sink = (LeftTupleSinkPropagator) field.get( source );
assertSame( EmptyTupleSinkAdapter.getInstance(),
sink );
assertEquals( 0,
Modified: labs/jbossrules/trunk/drools-core/src/test/java/org/drools/spi/MockConstraint.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/test/java/org/drools/spi/MockConstraint.java 2008-03-20 12:55:29 UTC (rev 19137)
+++ labs/jbossrules/trunk/drools-core/src/test/java/org/drools/spi/MockConstraint.java 2008-03-20 13:28:04 UTC (rev 19138)
@@ -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;
@@ -86,7 +86,7 @@
}
public void updateFromTuple(final InternalWorkingMemory workingMemory,
- final ReteTuple tuple) {
+ final LeftTuple tuple) {
}
public void resetFactHandle() {
@@ -111,7 +111,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/trunk/drools-core/src/test/java/org/drools/util/FieldIndexHashTableTest.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/test/java/org/drools/util/FieldIndexHashTableTest.java 2008-03-20 12:55:29 UTC (rev 19137)
+++ labs/jbossrules/trunk/drools-core/src/test/java/org/drools/util/FieldIndexHashTableTest.java 2008-03-20 13:28:04 UTC (rev 19138)
@@ -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