[jboss-svn-commits] JBL Code SVN: r5459 - 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
Thu Aug 3 20:32:59 EDT 2006
Author: mark.proctor at jboss.com
Date: 2006-08-03 20:32:58 -0400 (Thu, 03 Aug 2006)
New Revision: 5459
Modified:
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/ReteooBuilder.java
Log:
JBRULES-328 FactTemplates
-Identity removal only works for classes, not for FactTemplates.
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-08-04 00:25:33 UTC (rev 5458)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/ReteooBuilder.java 2006-08-04 00:32:58 UTC (rev 5459)
@@ -35,6 +35,7 @@
import org.drools.common.BetaNodeBinder;
import org.drools.common.InstanceEqualsConstraint;
import org.drools.common.InstanceNotEqualsConstraint;
+import org.drools.facttemplates.FactTemplateObjectType;
import org.drools.rule.And;
import org.drools.rule.Column;
import org.drools.rule.Declaration;
@@ -399,8 +400,6 @@
final boolean removeIdentities) throws InvalidPatternException {
final List constraints = column.getConstraints();
-// final Class thisClass = ((ClassObjectType) column.getObjectType()).getClassType();
-
this.objectSource = attachNode( new ObjectTypeNode( this.id++,
this.sinklistFactory.newObjectSinkList( ObjectTypeNode.class ),
column.getObjectType(),
@@ -408,16 +407,17 @@
final List predicateConstraints = new ArrayList();
- if ( removeIdentities ) {
-// // Check if this object type exists before
-// // If it does we need stop instance equals cross product
-// for ( final Iterator it = this.objectType.entrySet().iterator(); it.hasNext(); ) {
-// final Map.Entry entry = (Map.Entry) it.next();
-// final Class previousClass = ((ClassObjectType) entry.getKey()).getClassType();
-// if ( thisClass.isAssignableFrom( previousClass ) ) {
-// predicateConstraints.add( new InstanceNotEqualsConstraint( ((Integer) entry.getValue()).intValue() ) );
-// }
-// }
+ if ( removeIdentities && column.getObjectType().getClass() != FactTemplateObjectType.class ) {
+ // Check if this object type exists before
+ // If it does we need stop instance equals cross product
+ final Class thisClass = ((ClassObjectType) column.getObjectType()).getClassType();
+ for ( final Iterator it = this.objectType.entrySet().iterator(); it.hasNext(); ) {
+ final Map.Entry entry = (Map.Entry) it.next();
+ final Class previousClass = ((ClassObjectType) entry.getKey()).getClassType();
+ if ( thisClass.isAssignableFrom( previousClass ) ) {
+ predicateConstraints.add( new InstanceNotEqualsConstraint( ((Integer) entry.getValue()).intValue() ) );
+ }
+ }
// Must be added after the checking, otherwise it matches against itself
this.objectType.put( column.getObjectType(),
More information about the jboss-svn-commits
mailing list