|
From: <jbo...@li...> - 2006-06-22 02:28:22
|
Author: tirelli
Date: 2006-06-21 22:27:59 -0400 (Wed, 21 Jun 2006)
New Revision: 4803
Added:
labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/integrationtests/test_exists.drl
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/common/InstanceNotEqualsConstraint.java
Modified:
labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/integrationtests/IntegrationCases.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/common/InstanceEqualsConstraint.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/ReteooBuilder.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/beta/BooleanConstrainedLeftMemory.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/beta/BooleanConstrainedRightMemory.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/beta/DefaultLeftMemory.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/beta/DefaultRightMemory.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/beta/ObjectEqualConstrLeftMemory.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/beta/ObjectEqualConstrRightMemory.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/beta/ObjectNotEqualConstrLeftMemory.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/beta/ObjectNotEqualConstrRightMemory.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/util/BaseMultiLinkedListNode.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/util/MultiLinkedList.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/util/MultiLinkedListNode.java
Log:
JBRULES-317:
* Fixing 'exists' problem reported in JBRULES-317
* Added integration test for it
* Refactored MultiLinkedListNode to avoid attribute shadowing
Modified: labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/integrationtests/IntegrationCases.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/integrationtests/IntegrationCases.java 2006-06-22 01:09:52 UTC (rev 4802)
+++ labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/integrationtests/IntegrationCases.java 2006-06-22 02:27:59 UTC (rev 4803)
@@ -705,6 +705,45 @@
list.size() );
}
+ public void testExists2() throws Exception {
+ final PackageBuilder builder = new PackageBuilder();
+ builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_exists.drl" ) ) );
+ final Package pkg = builder.getPackage();
+
+ final RuleBase ruleBase = getRuleBase();
+ ruleBase.addPackage( pkg );
+ final WorkingMemory workingMemory = ruleBase.newWorkingMemory();
+
+ final List list = new ArrayList();
+ workingMemory.setGlobal( "list",
+ list );
+
+ final Cheese cheddar = new Cheese( "cheddar", 7 );
+ final Cheese provolone = new Cheese( "provolone", 5);
+ final Person edson = new Person("Edson", "cheddar");
+ final Person bob = new Person("Bob", "muzzarela");
+
+ workingMemory.assertObject( cheddar );
+ workingMemory.fireAllRules();
+ assertEquals( 0,
+ list.size() );
+
+ workingMemory.assertObject( provolone );
+ workingMemory.fireAllRules();
+ assertEquals( 0,
+ list.size() );
+
+ workingMemory.assertObject( edson );
+ workingMemory.fireAllRules();
+ assertEquals( 1,
+ list.size() );
+
+ workingMemory.assertObject( bob );
+ workingMemory.fireAllRules();
+ assertEquals( 1,
+ list.size() );
+ }
+
public void testWithInvalidRule() throws Exception {
final PackageBuilder builder = new PackageBuilder();
builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "invalid_rule.drl" ) ) );
Added: labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/integrationtests/test_exists.drl
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/integrationtests/test_exists.drl 2006-06-22 01:09:52 UTC (rev 4802)
+++ labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/integrationtests/test_exists.drl 2006-06-22 02:27:59 UTC (rev 4803)
@@ -0,0 +1,14 @@
+package org.drools.examples;
+
+import org.drools.Person;
+import org.drools.Cheese;
+
+global java.util.List list;
+
+rule "Buy cheese"
+when
+ $cheese: Cheese($type : type);
+ exists Person(likes == $type);
+then
+ list.add($cheese);
+end
Property changes on: labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/integrationtests/test_exists.drl
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:eol-style
+ native
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 2006-06-22 01:09:52 UTC (rev 4802)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/common/InstanceEqualsConstraint.java 2006-06-22 02:27:59 UTC (rev 4803)
@@ -1,5 +1,3 @@
-package org.drools.common;
-
/*
* Copyright 2005 JBoss Inc
*
@@ -16,19 +14,28 @@
* limitations under the License.
*/
+package org.drools.common;
+
import org.drools.WorkingMemory;
import org.drools.rule.Declaration;
import org.drools.spi.FieldConstraint;
import org.drools.spi.Tuple;
+/**
+ * InstanceEqualsConstraint
+ *
+ * Created: 21/06/2006
+ * @author <a href="mailto:ti...@po...">Edson Tirelli</a>
+ *
+ * @version $Id$
+ */
+
public class InstanceEqualsConstraint
implements
- FieldConstraint {
- /**
- *
- */
- private static final long serialVersionUID = -4913836428340400997L;
+ FieldConstraint {
+ private static final long serialVersionUID = 2986814365490743953L;
+
private final Declaration[] declarations = new Declaration[0];
private int otherColumn;
@@ -44,7 +51,7 @@
public boolean isAllowed(final InternalFactHandle handle,
final Tuple tuple,
final WorkingMemory workingMemory) {
- return !(tuple.get( this.otherColumn ).getObject() == handle.getObject());
+ return (tuple.get( this.otherColumn ).getObject() == handle.getObject());
}
public String toString() {
@@ -68,4 +75,4 @@
return this.otherColumn == other.otherColumn;
}
-}
\ No newline at end of file
+}
Added: 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 2006-06-22 01:09:52 UTC (rev 4802)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/common/InstanceNotEqualsConstraint.java 2006-06-22 02:27:59 UTC (rev 4803)
@@ -0,0 +1,71 @@
+package org.drools.common;
+
+/*
+ * Copyright 2005 JBoss Inc
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import org.drools.WorkingMemory;
+import org.drools.rule.Declaration;
+import org.drools.spi.FieldConstraint;
+import org.drools.spi.Tuple;
+
+public class InstanceNotEqualsConstraint
+ implements
+ FieldConstraint {
+ /**
+ *
+ */
+ private static final long serialVersionUID = -4913836428340400997L;
+
+ private final Declaration[] declarations = new Declaration[0];
+
+ private int otherColumn;
+
+ public InstanceNotEqualsConstraint(final int otherColumn) {
+ this.otherColumn = otherColumn;
+ }
+
+ public Declaration[] getRequiredDeclarations() {
+ return this.declarations;
+ }
+
+ public boolean isAllowed(final InternalFactHandle handle,
+ final Tuple tuple,
+ final WorkingMemory workingMemory) {
+ return !(tuple.get( this.otherColumn ).getObject() == handle.getObject());
+ }
+
+ public String toString() {
+ return "[InstanceNotEqualsConstraint otherColumn=" + this.otherColumn + " ]";
+ }
+
+ public int hashCode() {
+ return this.otherColumn;
+ }
+
+ public boolean equals(final Object object) {
+ if ( this == object ) {
+ return true;
+ }
+
+ if ( object == null || getClass() != object.getClass() ) {
+ return false;
+ }
+
+ final InstanceNotEqualsConstraint other = (InstanceNotEqualsConstraint) object;
+ return this.otherColumn == other.otherColumn;
+ }
+
+}
\ No newline at end of file
Property changes on: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/common/InstanceNotEqualsConstraint.java
___________________________________________________________________
Name: svn:keywords
+ id author date revision
Name: svn:eol-style
+ native
Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/ReteooBuilder.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/ReteooBuilder.java 2006-06-22 01:09:52 UTC (rev 4802)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/ReteooBuilder.java 2006-06-22 02:27:59 UTC (rev 4803)
@@ -33,6 +33,7 @@
import org.drools.base.FieldFactory;
import org.drools.common.BetaNodeBinder;
import org.drools.common.InstanceEqualsConstraint;
+import org.drools.common.InstanceNotEqualsConstraint;
import org.drools.rule.And;
import org.drools.rule.Column;
import org.drools.rule.Declaration;
@@ -410,7 +411,7 @@
final Map.Entry entry = (Map.Entry) it.next();
final Class previousClass = ((ClassObjectType) entry.getKey()).getClassType();
if ( thisClass.isAssignableFrom( previousClass ) ) {
- predicateConstraints.add( new InstanceEqualsConstraint( ((Integer) entry.getValue()).intValue() ) );
+ predicateConstraints.add( new InstanceNotEqualsConstraint( ((Integer) entry.getValue()).intValue() ) );
}
}
@@ -490,10 +491,12 @@
RightInputAdapterNode adapter = (RightInputAdapterNode) attachNode( new RightInputAdapterNode( this.id++,
column.getFactIndex(),
notNode ) );
+
+ BetaNodeBinder identityBinder = new BetaNodeBinder( new InstanceEqualsConstraint( column.getFactIndex() ) );
notNode = (NotNode) attachNode( new NotNode( this.id++,
tupleSource,
adapter,
- new BetaNodeBinder() ) );
+ identityBinder ) );
if ( exists.getChild() instanceof Not ) {
adapter = (RightInputAdapterNode) attachNode( new RightInputAdapterNode( this.id++,
Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/beta/BooleanConstrainedLeftMemory.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/beta/BooleanConstrainedLeftMemory.java 2006-06-22 01:09:52 UTC (rev 4802)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/beta/BooleanConstrainedLeftMemory.java 2006-06-22 02:27:59 UTC (rev 4803)
@@ -105,7 +105,7 @@
this.innerMemory.remove( workingMemory,
(MultiLinkedListNodeWrapper) tuple.getChild() );
}
- tuple.getLinkedList().remove( tuple );
+ tuple.getOuterList().remove( tuple );
}
/**
@@ -139,7 +139,7 @@
this.innerMemory.remove( workingMemory,
(MultiLinkedListNodeWrapper) tuple.getChild() );
}
- tuple.getLinkedList().remove( tuple );
+ tuple.getOuterList().remove( tuple );
}
/**
@@ -299,7 +299,7 @@
* @see org.drools.reteoo.beta.BetaLeftMemory#isPossibleMatch(org.drools.util.MultiLinkedListNodeWrapper)
*/
public final boolean isPossibleMatch(final MultiLinkedListNodeWrapper tuple) {
- boolean isPossible = ((this.selectedList != null) && (tuple.getLinkedList() == this.selectedList));
+ boolean isPossible = ((this.selectedList != null) && (tuple.getOuterList() == this.selectedList));
if ( (isPossible) && (this.innerMemory != null) ) {
isPossible = this.innerMemory.isPossibleMatch( (MultiLinkedListNodeWrapper) tuple.getChild() );
}
Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/beta/BooleanConstrainedRightMemory.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/beta/BooleanConstrainedRightMemory.java 2006-06-22 01:09:52 UTC (rev 4802)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/beta/BooleanConstrainedRightMemory.java 2006-06-22 02:27:59 UTC (rev 4803)
@@ -107,7 +107,7 @@
this.innerMemory.remove( workingMemory,
(MultiLinkedListNodeWrapper) matches.getChild() );
}
- matches.getLinkedList().remove( matches );
+ matches.getOuterList().remove( matches );
}
/**
@@ -142,7 +142,7 @@
this.innerMemory.remove( workingMemory,
(MultiLinkedListNodeWrapper) wrapper.getChild() );
}
- wrapper.getLinkedList().remove( wrapper );
+ wrapper.getOuterList().remove( wrapper );
}
/**
@@ -233,7 +233,7 @@
public final boolean isPossibleMatch(final MultiLinkedListNodeWrapper matches) {
boolean ret = false;
if ( this.selectedList != null ) {
- ret = matches.getLinkedList() == this.selectedList;
+ ret = matches.getOuterList() == this.selectedList;
if ( ret && (this.innerMemory != null) ) {
ret = this.innerMemory.isPossibleMatch( (MultiLinkedListNodeWrapper) matches.getChild() );
}
Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/beta/DefaultLeftMemory.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/beta/DefaultLeftMemory.java 2006-06-22 01:09:52 UTC (rev 4802)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/beta/DefaultLeftMemory.java 2006-06-22 02:27:59 UTC (rev 4803)
@@ -113,7 +113,7 @@
* @inheritDoc
*/
public final boolean isPossibleMatch(final MultiLinkedListNodeWrapper tuple) {
- return tuple.getLinkedList() == this.memory;
+ return tuple.getOuterList() == this.memory;
}
/**
Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/beta/DefaultRightMemory.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/beta/DefaultRightMemory.java 2006-06-22 01:09:52 UTC (rev 4802)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/beta/DefaultRightMemory.java 2006-06-22 02:27:59 UTC (rev 4803)
@@ -63,7 +63,7 @@
*/
public final void remove(final WorkingMemory workingMemory,
final ObjectMatches matches) {
- matches.getLinkedList().remove( matches );
+ matches.getOuterList().remove( matches );
}
/**
@@ -85,7 +85,7 @@
*/
public final void remove(final WorkingMemory workingMemory,
final MultiLinkedListNodeWrapper wrapper) {
- wrapper.getLinkedList().remove( wrapper );
+ wrapper.getOuterList().remove( wrapper );
}
/**
@@ -125,7 +125,7 @@
* @see org.drools.reteoo.beta.BetaRightMemory#isPossibleMatch(org.drools.util.MultiLinkedListNodeWrapper)
*/
public final boolean isPossibleMatch(final MultiLinkedListNodeWrapper matches) {
- return matches.getLinkedList() == this.memory;
+ return matches.getOuterList() == this.memory;
}
/**
Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/beta/ObjectEqualConstrLeftMemory.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/beta/ObjectEqualConstrLeftMemory.java 2006-06-22 01:09:52 UTC (rev 4802)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/beta/ObjectEqualConstrLeftMemory.java 2006-06-22 02:27:59 UTC (rev 4803)
@@ -106,7 +106,7 @@
this.innerMemory.remove( workingMemory,
(MultiLinkedListNodeWrapper) tuple.getChild() );
}
- final LinkedList list = tuple.getLinkedList();
+ final LinkedList list = tuple.getOuterList();
list.remove( tuple );
this.size--;
if ( list.isEmpty() ) {
@@ -147,7 +147,7 @@
(MultiLinkedListNodeWrapper) tuple.getChild() );
}
- final LinkedList list = tuple.getLinkedList();
+ final LinkedList list = tuple.getOuterList();
list.remove( tuple );
this.size--;
@@ -272,7 +272,7 @@
* @see org.drools.reteoo.beta.BetaLeftMemory#isPossibleMatch(org.drools.util.MultiLinkedListNodeWrapper)
*/
public final boolean isPossibleMatch(final MultiLinkedListNodeWrapper tuple) {
- return ((this.selectedList != null) && (tuple != null) && (tuple.getLinkedList() == this.selectedList));
+ return ((this.selectedList != null) && (tuple != null) && (tuple.getOuterList() == this.selectedList));
}
/**
Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/beta/ObjectEqualConstrRightMemory.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/beta/ObjectEqualConstrRightMemory.java 2006-06-22 01:09:52 UTC (rev 4802)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/beta/ObjectEqualConstrRightMemory.java 2006-06-22 02:27:59 UTC (rev 4803)
@@ -110,7 +110,7 @@
this.innerMemory.remove( workingMemory,
(MultiLinkedListNodeWrapper) matches.getChild() );
}
- final KeyMultiLinkedList list = (KeyMultiLinkedList) matches.getLinkedList();
+ final KeyMultiLinkedList list = (KeyMultiLinkedList) matches.getOuterList();
list.remove( matches );
this.memorySize--;
if ( list.isEmpty() ) {
@@ -152,7 +152,7 @@
this.innerMemory.remove( workingMemory,
(MultiLinkedListNodeWrapper) matches.getChild() );
}
- final KeyMultiLinkedList list = (KeyMultiLinkedList) matches.getLinkedList();
+ final KeyMultiLinkedList list = (KeyMultiLinkedList) matches.getOuterList();
list.remove( matches );
this.memorySize--;
if ( list.isEmpty() ) {
@@ -245,7 +245,7 @@
public final boolean isPossibleMatch(final MultiLinkedListNodeWrapper wrapper) {
boolean ret = false;
if ( this.selectedList != null ) {
- ret = wrapper.getLinkedList() == this.selectedList;
+ ret = wrapper.getOuterList() == this.selectedList;
if ( ret && (this.innerMemory != null) ) {
ret = this.innerMemory.isPossibleMatch( (MultiLinkedListNodeWrapper) wrapper.getChild() );
}
Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/beta/ObjectNotEqualConstrLeftMemory.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/beta/ObjectNotEqualConstrLeftMemory.java 2006-06-22 01:09:52 UTC (rev 4802)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/beta/ObjectNotEqualConstrLeftMemory.java 2006-06-22 02:27:59 UTC (rev 4803)
@@ -108,7 +108,7 @@
this.innerMemory.remove( workingMemory,
(MultiLinkedListNodeWrapper) tuple.getChild().getChild() );
}
- final LinkedList list = tuple.getChild().getLinkedList();
+ final LinkedList list = tuple.getChild().getOuterList();
list.remove( tuple.getChild() );
if ( list.isEmpty() ) {
removeMemoryEntry( list );
@@ -153,7 +153,7 @@
(MultiLinkedListNodeWrapper) tuple.getChild().getChild() );
}
- final LinkedList list = tuple.getChild().getLinkedList();
+ final LinkedList list = tuple.getChild().getOuterList();
list.remove( tuple.getChild() );
if ( list.isEmpty() ) {
@@ -189,7 +189,7 @@
boolean hasnext = false;
if ( this.next == null ) {
while ( this.candidate != null ) {
- if ( this.candidate.getChild().getLinkedList() != ObjectNotEqualConstrLeftMemory.this.noMatchList ) {
+ if ( this.candidate.getChild().getOuterList() != ObjectNotEqualConstrLeftMemory.this.noMatchList ) {
if ( (ObjectNotEqualConstrLeftMemory.this.innerMemory == null) || (ObjectNotEqualConstrLeftMemory.this.innerMemory.isPossibleMatch( (MultiLinkedListNodeWrapper) this.candidate.getChild().getChild() )) ) {
hasnext = true;
this.next = this.candidate;
@@ -261,8 +261,8 @@
*/
public final boolean isPossibleMatch(final MultiLinkedListNodeWrapper tuple) {
boolean ret = false;
- if ( (tuple != null) && (tuple.getChild() != null) && (tuple.getChild().getLinkedList() != null) ) {
- ret = (tuple.getChild().getLinkedList() != this.noMatchList);
+ if ( (tuple != null) && (tuple.getChild() != null) && (tuple.getChild().getOuterList() != null) ) {
+ ret = (tuple.getChild().getOuterList() != this.noMatchList);
if ( ret && (this.innerMemory != null) ) {
ret = this.innerMemory.isPossibleMatch( (MultiLinkedListNodeWrapper) tuple.getChild().getChild() );
}
Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/beta/ObjectNotEqualConstrRightMemory.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/beta/ObjectNotEqualConstrRightMemory.java 2006-06-22 01:09:52 UTC (rev 4802)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/beta/ObjectNotEqualConstrRightMemory.java 2006-06-22 02:27:59 UTC (rev 4803)
@@ -118,11 +118,11 @@
}
// removing from indexed list
- matches.getChild().getLinkedList().remove( matches.getChild() );
+ matches.getChild().getOuterList().remove( matches.getChild() );
- if ( matches.getChild().getLinkedList().isEmpty() ) {
+ if ( matches.getChild().getOuterList().isEmpty() ) {
// removing index map entry
- this.removeMemoryEntry( (MultiLinkedList) matches.getChild().getLinkedList() );
+ this.removeMemoryEntry( (MultiLinkedList) matches.getChild().getOuterList() );
}
matches.setChild( null );
@@ -176,11 +176,11 @@
}
// removing from indexed list
- matches.getChild().getLinkedList().remove( matches.getChild() );
+ matches.getChild().getOuterList().remove( matches.getChild() );
- if ( matches.getChild().getLinkedList().isEmpty() ) {
+ if ( matches.getChild().getOuterList().isEmpty() ) {
// removing index map entry
- this.removeMemoryEntry( (MultiLinkedList) matches.getChild().getLinkedList() );
+ this.removeMemoryEntry( (MultiLinkedList) matches.getChild().getOuterList() );
}
matches.setChild( null );
@@ -207,7 +207,7 @@
boolean hasnext = false;
if ( this.next == null ) {
while ( this.candidate != null ) {
- if ( this.candidate.getChild().getLinkedList() != ObjectNotEqualConstrRightMemory.this.noMatchList ) {
+ if ( this.candidate.getChild().getOuterList() != ObjectNotEqualConstrRightMemory.this.noMatchList ) {
if ( (ObjectNotEqualConstrRightMemory.this.innerMemory == null) || (ObjectNotEqualConstrRightMemory.this.innerMemory.isPossibleMatch( (MultiLinkedListNodeWrapper) this.candidate.getChild().getChild() )) ) {
hasnext = true;
this.next = this.candidate;
@@ -276,8 +276,8 @@
*/
public final boolean isPossibleMatch(final MultiLinkedListNodeWrapper matches) {
boolean ret = false;
- if ( (matches != null) && (matches.getChild() != null) && (matches.getChild().getLinkedList() != null) ) {
- ret = (matches.getChild().getLinkedList() != this.noMatchList);
+ if ( (matches != null) && (matches.getChild() != null) && (matches.getChild().getOuterList() != null) ) {
+ ret = (matches.getChild().getOuterList() != this.noMatchList);
if ( ret && (this.innerMemory != null) ) {
ret = this.innerMemory.isPossibleMatch( (MultiLinkedListNodeWrapper) matches.getChild().getChild() );
Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/util/BaseMultiLinkedListNode.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/util/BaseMultiLinkedListNode.java 2006-06-22 01:09:52 UTC (rev 4802)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/util/BaseMultiLinkedListNode.java 2006-06-22 02:27:59 UTC (rev 4803)
@@ -30,7 +30,7 @@
MultiLinkedListNode {
private MultiLinkedListNode child = null;
- private LinkedList list = null;
+ private LinkedList outerList = null;
public BaseMultiLinkedListNode() {
}
@@ -56,19 +56,19 @@
/**
* @inheritDoc
*
- * @see org.drools.util.MultiLinkedListNode#getLinkedList()
+ * @see org.drools.util.MultiLinkedListNode#getOuterList()
*/
- public LinkedList getLinkedList() {
- return this.list;
+ public LinkedList getOuterList() {
+ return this.outerList;
}
/**
* @inheritDoc
*
- * @see org.drools.util.MultiLinkedListNode#setLinkedList(org.drools.util.LinkedList)
+ * @see org.drools.util.MultiLinkedListNode#setOuterList(org.drools.util.LinkedList)
*/
- public void setLinkedList(final LinkedList list) {
- this.list = list;
+ public void setOuterList(final LinkedList list) {
+ this.outerList = list;
}
}
Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/util/MultiLinkedList.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/util/MultiLinkedList.java 2006-06-22 01:09:52 UTC (rev 4802)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/util/MultiLinkedList.java 2006-06-22 02:27:59 UTC (rev 4803)
@@ -40,7 +40,7 @@
*/
public void add(final MultiLinkedListNode node) {
super.add( node );
- node.setLinkedList( this );
+ node.setOuterList( this );
}
/**
@@ -55,6 +55,6 @@
*/
public void remove(final MultiLinkedListNode node) {
super.remove( node );
- node.setLinkedList( null );
+ node.setOuterList( null );
}
}
Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/util/MultiLinkedListNode.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/util/MultiLinkedListNode.java 2006-06-22 01:09:52 UTC (rev 4802)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/util/MultiLinkedListNode.java 2006-06-22 02:27:59 UTC (rev 4803)
@@ -49,13 +49,13 @@
* @return
* The containing LinkedList
*/
- public LinkedList getLinkedList();
+ public LinkedList getOuterList();
/**
* Sets the containing LinkedList
* @param list
* The containing LinkedListNode
*/
- public void setLinkedList(LinkedList list);
+ public void setOuterList(LinkedList list);
}
|