[jboss-svn-commits] JBL Code SVN: r6282 - labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Mon Sep 18 14:51:37 EDT 2006


Author: tirelli
Date: 2006-09-18 14:51:32 -0400 (Mon, 18 Sep 2006)
New Revision: 6282

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/EvalConditionNode.java
Log:
JBRULES-484: fixing compilation problems

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	2006-09-18 16:42:58 UTC (rev 6281)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/AccumulateNode.java	2006-09-18 18:51:32 UTC (rev 6282)
@@ -314,6 +314,7 @@
      */
     public List getPropagatedTuples(InternalWorkingMemory workingMemory,
                                     TupleSink sink) {
+        // FIXME
         final BetaMemory memory = (BetaMemory) workingMemory.getNodeMemory( this );
         final List propagatedTuples = new ArrayList();
 
@@ -332,6 +333,7 @@
      */
     public void updateNewNode(InternalWorkingMemory workingMemory,
                               PropagationContext context) {
+        // FIXME
         this.attachingNewNode = true;
 
         final BetaMemory memory = (BetaMemory) workingMemory.getNodeMemory( this );

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	2006-09-18 16:42:58 UTC (rev 6281)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/EvalConditionNode.java	2006-09-18 18:51:32 UTC (rev 6282)
@@ -97,7 +97,7 @@
         attach();
 
         for ( int i = 0, length = workingMemories.length; i < length; i++ ) {
-            final ReteooWorkingMemory workingMemory = workingMemories[i];
+            final InternalWorkingMemory workingMemory = workingMemories[i];
             final PropagationContext propagationContext = new PropagationContextImpl( workingMemory.getNextPropagationIdCounter(),
                                                                                       PropagationContext.RULE_ADDITION,
                                                                                       null,
@@ -136,7 +136,7 @@
      */
     public void assertTuple(final ReteTuple tuple,
                             final PropagationContext context,
-                            final ReteooWorkingMemory workingMemory) {
+                            final InternalWorkingMemory workingMemory) {
 
         final boolean allowed = this.condition.isAllowed( tuple,
                                                           workingMemory );
@@ -145,32 +145,31 @@
             final LinkedList memory = (LinkedList) workingMemory.getNodeMemory( this );
             memory.add( tuple );
 
-            propagateAssertTuple( tuple,
-                                  context,
-                                  workingMemory );
+            this.sink.propagateAssertTuple( tuple,
+                                            context,
+                                            workingMemory );
         }
     }
 
     public void retractTuple(final ReteTuple tuple,
                              final PropagationContext context,
-                             final ReteooWorkingMemory workingMemory) {
+                             final InternalWorkingMemory workingMemory) {
         final LinkedList memory = (LinkedList) workingMemory.getNodeMemory( this );
 
         // checks if the tuple is attach to tuple
-        if ( tuple.getLinkedTuples() != null && !tuple.getLinkedTuples().isEmpty() ) {
+        if ( tuple.getChildEntries() != null && !tuple.getChildEntries().isEmpty() ) {
             memory.remove( tuple );
 
-            propagateRetractTuple( tuple,
-                                   context,
-                                   workingMemory );
+            tuple.retractChildEntries( context,
+                                       workingMemory );
         }
     }
 
     public void modifyTuple(final ReteTuple tuple,
                             final PropagationContext context,
-                            final ReteooWorkingMemory workingMemory) {
+                            final InternalWorkingMemory workingMemory) {
         final LinkedList memory = (LinkedList) workingMemory.getNodeMemory( this );
-        boolean exists = (tuple.getLinkedTuples() != null && !tuple.getLinkedTuples().isEmpty());
+        boolean exists = (tuple.getChildEntries() != null && !tuple.getChildEntries().isEmpty());
 
         if ( exists ) {
             // Remove the tuple so it can be readded to the top of the list
@@ -183,18 +182,14 @@
         if ( allowed ) {
             memory.add( tuple );
             if ( !exists ) {
-                propagateAssertTuple( tuple,
+                this.sink.propagateAssertTuple( tuple,
                                       context,
                                       workingMemory );
             } else {
-                propagateModifyTuple( tuple,
-                                      context,
-                                      workingMemory );
+                tuple.modifyChildEntries( context, workingMemory );
             }
         } else {
-            propagateRetractTuple( tuple,
-                                   context,
-                                   workingMemory );
+            tuple.retractChildEntries( context, workingMemory );
         }
     }
 
@@ -206,14 +201,10 @@
 
         for ( final Iterator it = memory.iterator(); it.hasNext(); ) {
             final ReteTuple tuple = (ReteTuple) it.next();
-            final ReteTuple child = new ReteTuple( tuple );
-            // no TupleMatch so instead add as a linked tuple
-            tuple.addLinkedTuple( new LinkedListEntry( child ) );
-            ((TupleSink) getTupleSinks().get( getTupleSinks().size() - 1 )).assertTuple( child,
-                                                                                         context,
-                                                                                         workingMemory );
+            this.sink.propagateNewTupleSink( (ReteTuple) tuple.getChildEntries().getFirst(),
+                                             context,
+                                             workingMemory );
         }
-
         this.attachingNewNode = false;
     }
 
@@ -244,21 +235,6 @@
         return this.tupleSource.equals( other.tupleSource ) && this.condition.equals( other.condition );
     }
 
-    public void remove(final BaseNode node,
-                       final InternalWorkingMemory[] workingMemories) {
-        if( !node.isInUse() ) {
-            getTupleSinks().remove( node );
-        }
-        removeShare();
-        if ( !this.isInUse() ) {
-            for ( int i = 0, length = workingMemories.length; i < length; i++ ) {
-                workingMemories[i].clearNodeMemory( this );
-            }
-        }
-        this.tupleSource.remove( this,
-                                 workingMemories );
-    }
-
     public Object createMemory(final RuleBaseConfiguration config) {
         return new LinkedList();
     }
@@ -266,23 +242,25 @@
     /**
      * @inheritDoc
      */
-    public List getPropagatedTuples(final ReteooWorkingMemory workingMemory,
+    public List getPropagatedTuples(final InternalWorkingMemory workingMemory,
                                     final TupleSink sink) {
+        // FIXME
         final LinkedList memory = (LinkedList) workingMemory.getNodeMemory( this );
-        final int index = this.getTupleSinks().indexOf( sink );
         final List propagatedTuples = new ArrayList();
 
         for ( final Iterator it = memory.iterator(); it.hasNext(); ) {
             final ReteTuple leftTuple = (ReteTuple) it.next();
-            final LinkedList linkedTuples = leftTuple.getLinkedTuples();
+            final LinkedList linkedTuples = leftTuple.getChildEntries();
 
             LinkedListEntry wrapper = (LinkedListEntry) linkedTuples.getFirst();
-            for ( int i = 0; i < index; i++ ) {
-                wrapper = (LinkedListEntry) wrapper.getNext();
-            }
             propagatedTuples.add( wrapper.getObject() );
         }
         return propagatedTuples;
     }
 
+    public void remove(BaseNode node,
+                       InternalWorkingMemory[] workingMemories) {
+        // FIXME
+    }
+
 }




More information about the jboss-svn-commits mailing list