object );
}
this.handleFactory.increaseFactHandleRecency( handle );
Rule rule = activation == null ? null : activation.getRule();
final PropagationContext propagationContext = new PropagationContextImpl( this.wm.getNextPropagationIdCounter(),
PropagationContext.MODIFICATION,
rule,
(activation == null) ? null : activation.getTuple(),
handle,
this.wm.agenda.getActiveActivations(),
this.wm.agenda.getDormantActivations(),
entryPoint,
mask );
if ( typeConf.isTMSEnabled() ) {
EqualityKey newKey = tms.get( object );
EqualityKey oldKey = handle.getEqualityKey();
if ( newKey == null ) {
if ( oldKey.getStatus() == EqualityKey.JUSTIFIED ) {
// new target key is JUSTFIED, updates are always STATED
TruthMaintenanceSystemHelper.removeLogicalDependencies( oldKey.getFactHandle(), propagationContext );
}
oldKey.removeFactHandle( handle );
// If the equality key is now empty, then remove it
if ( oldKey.isEmpty() ) {
getTruthMaintenanceSystem().remove( oldKey );
}
newKey = new EqualityKey( handle,
EqualityKey.STATED ); // updates are always stated
handle.setEqualityKey( newKey );
getTruthMaintenanceSystem().put( newKey );
} else if ( newKey != oldKey ) {
oldKey.removeFactHandle( handle );
// If the equality key is now empty, then remove it
if ( oldKey.isEmpty() ) {
getTruthMaintenanceSystem().remove( oldKey );
}
if ( newKey.getStatus() == EqualityKey.JUSTIFIED ) {
// new target key is JUSTITIED, updates are always STATED
TruthMaintenanceSystemHelper.removeLogicalDependencies( newKey.getFactHandle(), propagationContext );
newKey.setStatus( EqualityKey.STATED );
}
// the caller needs the new handle
handle = newKey.getFactHandle();
} else if ( !updateLogical && oldKey.getStatus() == EqualityKey.JUSTIFIED ) {
// new target key is JUSTIFIED, updates are always STATED
TruthMaintenanceSystemHelper.removeLogicalDependencies( oldKey.getFactHandle(), propagationContext );
}
}
this.entryPointNode.modifyObject( handle,
propagationContext,
typeConf,
this.wm );
propagationContext.evaluateActionQueue( this.wm );
this.wm.workingMemoryEventSupport.fireObjectUpdated( propagationContext,
handle,
originalObject,
object,