public void execute(InternalWorkingMemory workingMemory) { InternalFactHandle factHandle = (InternalFactHandle) leftTuple.getObject(); if ( node.isOpenQuery() ) { // iterate to the query terminal node, as the child leftTuples will get picked up there workingMemory.getEntryPointNode().retractObject( factHandle, context, workingMemory.getObjectTypeConfigurationRegistry().getObjectTypeConf( workingMemory.getEntryPoint(), factHandle.getObject() ), workingMemory ); //workingMemory.getFactHandleFactory().destroyFactHandle( factHandle ); } else { // get child left tuples, as there is no open query if ( leftTuple.getFirstChild() != null ) { node.getSinkPropagator().propagateRetractLeftTuple( leftTuple, context, workingMemory ); } } }
public static void readTruthMaintenanceSystem( MarshallerReaderContext context ) throws IOException { ObjectInputStream stream = context.stream; TruthMaintenanceSystem tms = context.wm.getTruthMaintenanceSystem(); while (stream.readShort() == PersisterEnums.EQUALITY_KEY) { int status = stream.readInt(); int factHandleId = stream.readInt(); InternalFactHandle handle = (InternalFactHandle) context.handles.get( factHandleId ); // ObjectTypeConf state is not marshalled, so it needs to be re-determined ObjectTypeConf typeConf = context.wm.getObjectTypeConfigurationRegistry().getObjectTypeConf( context.wm.getEntryPoint(), handle.getObject() ); if (!typeConf.isTMSEnabled()) { typeConf.enableTMS(); } EqualityKey key = new EqualityKey( handle, status ); handle.setEqualityKey( key ); while (stream.readShort() == PersisterEnums.FACT_HANDLE) { factHandleId = stream.readInt(); handle = (InternalFactHandle) context.handles.get( factHandleId ); key.addFactHandle( handle ); handle.setEqualityKey( key ); } tms.put( key ); } }
confEP = ((InternalWorkingMemoryEntryPoint) entryPoint).getEntryPoint(); } else { confEP = context.wm.getEntryPoint();
public boolean addActivation(final AgendaItem activation) { if ( declarativeAgenda ) { if ( activationObjectTypeConf == null ) { EntryPoint ep = workingMemory.getEntryPoint(); activationObjectTypeConf = ((InternalWorkingMemoryEntryPoint) workingMemory.getWorkingMemoryEntryPoint( ep.getEntryPointId() )).getObjectTypeConfigurationRegistry().getObjectTypeConf( ep, activation ); } InternalFactHandle factHandle = workingMemory.getFactHandleFactory().newFactHandle( activation, activationObjectTypeConf, workingMemory, workingMemory ); workingMemory.getEntryPointNode().assertActivation( factHandle, activation.getPropagationContext(), workingMemory ); activation.setFactHandle( factHandle ); if ( !activation.isCanceled() && ( activation.getBlockers() == null || activation.getBlockers().isEmpty() ) ) { // All activations started off staged, they are unstaged if they are blocked or // allowed to move onto the actual agenda for firing. getStageActivationsGroup().addActivation( activation ); } return true; } else { addActivation( activation, true ); return true; } }
if ( objectTypeConf == null ) { objectTypeConf = new ClassObjectTypeConf( workingMemory.getEntryPoint(), resultClass, (InternalRuleBase) workingMemory.getRuleBase() );