}
public void delete(LogicalDependency<SimpleMode> node,
BeliefSet<SimpleMode> beliefSet,
PropagationContext context) {
SimpleBeliefSet sBeliefSet = (SimpleBeliefSet) beliefSet;
beliefSet.remove( node.getMode() );
InternalFactHandle bfh = beliefSet.getFactHandle();
if ( beliefSet.isEmpty() &&
!((context.getType() == PropagationContext.DELETION || context.getType() == PropagationContext.MODIFICATION) // retract and modifies clean up themselves
&&
context.getFactHandle() == bfh) ) {
if ( sBeliefSet.getWorkingMemoryAction() == null ) {
WorkingMemoryAction action = new BeliefSystemLogicalCallback( bfh,
context,
node.getJustifier(),
false,
true );
ep.enQueueWorkingMemoryAction( action );
sBeliefSet.setWorkingMemoryAction( action );
} else {
// was previous scheduled, so make sure it's a full retract and not an update
BeliefSystemLogicalCallback callback = ( BeliefSystemLogicalCallback ) sBeliefSet.getWorkingMemoryAction();
callback.setUpdate( false );
callback.setFullyRetract( true );
}
} else if ( !beliefSet.isEmpty() && beliefSet.getFactHandle().getObject() == node.getObject() ) {
// prime has changed, to update new object
// Equality might have changed on the object, so remove (which uses the handle id) and add back in
((NamedEntryPoint)bfh.getEntryPoint()).getObjectStore().updateHandle( bfh, ((SimpleMode) beliefSet.getFirst()).getObject().getObject() );
if ( sBeliefSet.getWorkingMemoryAction() == null ) {
// Only schedule if we don't already have one scheduled
WorkingMemoryAction action = new BeliefSystemLogicalCallback( bfh,
context,
node.getJustifier(),
true,
false );
ep.enQueueWorkingMemoryAction( action );
sBeliefSet.setWorkingMemoryAction( action );
}
}
}