[jboss-svn-commits] JBL Code SVN: r21446 - labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/builder.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Mon Aug 11 18:25:06 EDT 2008
Author: tirelli
Date: 2008-08-11 18:25:05 -0400 (Mon, 11 Aug 2008)
New Revision: 21446
Modified:
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/builder/ReteooRuleBuilder.java
Log:
Isolating labeling code
Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/builder/ReteooRuleBuilder.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/builder/ReteooRuleBuilder.java 2008-08-11 21:46:27 UTC (rev 21445)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/builder/ReteooRuleBuilder.java 2008-08-11 22:25:05 UTC (rev 21446)
@@ -176,32 +176,40 @@
// adds the terminal no to the list of nodes created/added by this sub-rule
context.getNodes().add((BaseNode) terminal );
-
- if( context.getRuleBase().getConfiguration().isPartitionsEnabled() ) {
- org.drools.common.RuleBasePartitionId partitionId = null;
- if( context.getPartitionId() != null ) {
- // it means it shares nodes with an existing partition, so
- // assign the first id to the newly added nodes
- partitionId = context.getPartitionId();
- } else {
- // nodes are independent of existing nodes, so create a new
- // partition ID for them
- partitionId = context.getRuleBase().createNewPartitionId();
- }
- for( BaseNode node : context.getNodes() ) {
- node.setPartitionId( partitionId );
- }
- }
-
+
+ // assigns partition IDs to the new nodes
+ assignPartitionId(context);
+
return terminal;
}
/**
+ * Assigns the current partition ID to the list of created nodes
+ *
+ * @param context
+ */
+ private void assignPartitionId(BuildContext context) {
+ org.drools.common.RuleBasePartitionId partitionId = null;
+ if( context.getPartitionId() != null ) {
+ // it means it shares nodes with an existing partition, so
+ // assign the first id to the newly added nodes
+ partitionId = context.getPartitionId();
+ } else {
+ // nodes are independent of existing nodes, so create a new
+ // partition ID for them
+ partitionId = context.getRuleBase().createNewPartitionId();
+ }
+ for( BaseNode node : context.getNodes() ) {
+ node.setPartitionId( partitionId );
+ }
+ }
+
+ /**
* Adds a query pattern to the given subrule
*
* @param context
* @param subrule
- * @param query
+ * @param rule
*/
private void addInitialFactPattern(final BuildContext context,
final GroupElement subrule,
More information about the jboss-svn-commits
mailing list