Esempio n. 1
0
  @Override
  public void insertAndStageActivation(final AgendaItem activation) {
    if (activationObjectTypeConf == null) {
      EntryPointId 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);
    }
  }
Esempio n. 2
0
 /**
  * This is the entry point into the network for all asserted Facts. Iterates a cache of matching
  * <code>ObjectTypdeNode</code>s asserting the Fact. If the cache does not exist it first iteraes
  * and builds the cache.
  *
  * @param factHandle The FactHandle of the fact to assert
  * @param context The <code>PropagationContext</code> of the <code>WorkingMemory</code> action
  * @param workingMemory The working memory session.
  */
 public void assertObject(
     final InternalFactHandle factHandle,
     final PropagationContext context,
     final InternalWorkingMemory workingMemory) {
   EntryPointId entryPoint = context.getEntryPoint();
   EntryPointNode node = this.entryPoints.get(entryPoint);
   ObjectTypeConf typeConf =
       ((InternalWorkingMemoryEntryPoint)
               workingMemory.getWorkingMemoryEntryPoint(entryPoint.getEntryPointId()))
           .getObjectTypeConfigurationRegistry()
           .getObjectTypeConf(entryPoint, factHandle.getObject());
   node.assertObject(factHandle, context, typeConf, workingMemory);
 }