[jboss-svn-commits] JBL Code SVN: r6642 - in labs/jbossrules/trunk/drools-core/src/main/java/org/drools: common leaps reteoo
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Fri Oct 6 07:36:18 EDT 2006
Author: /services/svn/bin/commit-email.pl: `/opt/subversion/bin/svnlook info /services/jbf-svn/code -r 6642' failed with this output:
Date: svnlook: Inconsistent line ending style
New Revision: 6642
Modified:
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/common/AbstractWorkingMemory.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/leaps/LeapsWorkingMemory.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/ReteooWorkingMemory.java
Log:
2006-10-06 07:36:15 -0400 (Fri, 06 Oct 2006)
Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/common/AbstractWorkingMemory.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/common/AbstractWorkingMemory.java 2006-10-06 11:22:41 UTC (rev 6641)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/common/AbstractWorkingMemory.java 2006-10-06 11:36:15 UTC (rev 6642)
@@ -802,13 +802,80 @@
}
/**
+ * modify is implemented as half way retract / assert due to the truth
+ * maintenance issues.
+ *
* @see WorkingMemory
*/
- public abstract void modifyObject(FactHandle factHandle,
- Object object,
- Rule rule,
- Activation activation) throws FactException;
+ public void modifyObject( final FactHandle factHandle,
+ final Object object,
+ final Rule rule,
+ final Activation activation ) throws FactException {
+ try {
+ this.lock.lock();
+ final int status = ((InternalFactHandle) factHandle).getEqualityKey().getStatus();
+ final InternalFactHandle handle = (InternalFactHandle) factHandle;
+ final Object originalObject = handle.getObject();
+ if ( handle.getId() == -1 || object == null ) {
+ // the handle is invalid, most likely already retracted, so return
+ // and we cannot assert a null object
+ return;
+ }
+
+ // set anyway, so that it updates the hashCodes
+ handle.setObject( object );
+
+ // We only need to put objects, if its a new object
+ if ( originalObject != object ) {
+ this.assertMap.put( handle,
+ handle );
+ }
+
+ // the hashCode and equality has changed, so we must update the EqualityKey
+ EqualityKey key = handle.getEqualityKey();
+ key.removeFactHandle( handle );
+
+ // If the equality key is now empty, then remove it
+ if ( key.isEmpty() ) {
+ this.tms.remove( key );
+ }
+
+ // now use an existing EqualityKey, if it exists, else create a new one
+ key = this.tms.get( object );
+ if ( key == null ) {
+ key = new EqualityKey( handle,
+ status );
+ this.tms.put( key );
+ } else {
+ key.addFactHandle( handle );
+ }
+
+ handle.setEqualityKey( key );
+
+ final PropagationContext propagationContext = new PropagationContextImpl( this.propagationIdCounter++,
+ PropagationContext.MODIFICATION,
+ rule,
+ activation );
+ doRetract( handle, propagationContext );
+
+ this.handleFactory.increaseFactHandleRecency( handle );
+
+ doAssertObject( handle, object, propagationContext );
+
+ this.workingMemoryEventSupport.fireObjectModified( propagationContext,
+ factHandle,
+ originalObject,
+ object );
+
+ if ( !this.factQueue.isEmpty() ) {
+ propagateQueuedActions();
+ }
+ } finally {
+ this.lock.unlock();
+ }
+ }
+
public void propagateQueuedActions() {
for ( final Iterator it = this.factQueue.iterator(); it.hasNext(); ) {
final WorkingMemoryAction action = (WorkingMemoryAction) it.next();
Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/leaps/LeapsWorkingMemory.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/leaps/LeapsWorkingMemory.java 2006-10-06 11:22:41 UTC (rev 6641)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/leaps/LeapsWorkingMemory.java 2006-10-06 11:36:15 UTC (rev 6642)
@@ -275,81 +275,6 @@
}
/**
- * modify is implemented as half way retract / assert due to the truth
- * maintenance issues.
- *
- * @see WorkingMemory
- */
- public void modifyObject( final FactHandle factHandle,
- final Object object,
- final Rule rule,
- final Activation activation ) throws FactException {
- try {
- this.lock.lock();
- final int status = ((InternalFactHandle) factHandle).getEqualityKey().getStatus();
- final InternalFactHandle handle = (InternalFactHandle) factHandle;
- final Object originalObject = handle.getObject();
-
- if ( handle.getId() == -1 || object == null ) {
- // the handle is invalid, most likely already retracted, so return
- // and we cannot assert a null object
- return;
- }
-
- // set anyway, so that it updates the hashCodes
- handle.setObject( object );
-
- // We only need to put objects, if its a new object
- if ( originalObject != object ) {
- this.assertMap.put( handle,
- handle );
- }
-
- // the hashCode and equality has changed, so we must update the EqualityKey
- EqualityKey key = handle.getEqualityKey();
- key.removeFactHandle( handle );
-
- // If the equality key is now empty, then remove it
- if ( key.isEmpty() ) {
- this.tms.remove( key );
- }
-
- // now use an existing EqualityKey, if it exists, else create a new one
- key = this.tms.get( object );
- if ( key == null ) {
- key = new EqualityKey( handle,
- status );
- this.tms.put( key );
- } else {
- key.addFactHandle( handle );
- }
-
- handle.setEqualityKey( key );
-
- final PropagationContext propagationContext = new PropagationContextImpl( this.propagationIdCounter++,
- PropagationContext.MODIFICATION,
- rule,
- activation );
- doRetract( handle, propagationContext );
-
- this.handleFactory.increaseFactHandleRecency( handle );
-
- doAssertObject( handle, object, propagationContext );
-
- this.workingMemoryEventSupport.fireObjectModified( propagationContext,
- factHandle,
- originalObject,
- object );
-
- if ( !this.factQueue.isEmpty() ) {
- propagateQueuedActions();
- }
- } finally {
- this.lock.unlock();
- }
- }
-
- /**
* ************* leaps section *********************
*/
private long idLastFireAllAt = -1;
Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/ReteooWorkingMemory.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/ReteooWorkingMemory.java 2006-10-06 11:22:41 UTC (rev 6641)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/ReteooWorkingMemory.java 2006-10-06 11:36:15 UTC (rev 6642)
@@ -80,79 +80,6 @@
this );
}
- /**
- * @see WorkingMemory
- */
- public void modifyObject(final FactHandle factHandle,
- final Object object,
- final Rule rule,
- final Activation activation) throws FactException {
- try {
- this.lock.lock();
- final int status = ((InternalFactHandle) factHandle).getEqualityKey().getStatus();
- final InternalFactHandle handle = (InternalFactHandle) factHandle;
- final Object originalObject = handle.getObject();
-
- if ( handle.getId() == -1 || object == null ) {
- // the handle is invalid, most likely already retracted, so return
- // and we cannot assert a null object
- return;
- }
-
- // set anyway, so that it updates the hashCodes
- handle.setObject( object );
-
- // We only need to put objects, if its a new object
- if ( originalObject != object ) {
- this.assertMap.put( handle,
- handle );
- }
-
- // the hashCode and equality has changed, so we must update the EqualityKey
- EqualityKey key = handle.getEqualityKey();
- key.removeFactHandle( handle );
-
- // If the equality key is now empty, then remove it
- if ( key.isEmpty() ) {
- this.tms.remove( key );
- }
-
- // now use an existing EqualityKey, if it exists, else create a new one
- key = this.tms.get( object );
- if ( key == null ) {
- key = new EqualityKey( handle,
- status );
- this.tms.put( key );
- } else {
- key.addFactHandle( handle );
- }
-
- handle.setEqualityKey( key );
-
- this.handleFactory.increaseFactHandleRecency( handle );
-
- final PropagationContext propagationContext = new PropagationContextImpl( this.propagationIdCounter++,
- PropagationContext.MODIFICATION,
- rule,
- activation );
-
- this.ruleBase.modifyObject( factHandle,
- propagationContext,
- this );
-
- this.workingMemoryEventSupport.fireObjectModified( propagationContext,
- factHandle,
- originalObject,
- object );
-
- if ( !this.factQueue.isEmpty() ) {
- propagateQueuedActions();
- }
- } finally {
- this.lock.unlock();
- }
- }
-
public QueryResults getQueryResults(final String query) {
final FactHandle handle = assertObject( new DroolsQuery( query ) );
final QueryTerminalNode node = (QueryTerminalNode) this.queryResults.remove( query );
More information about the jboss-svn-commits
mailing list