Esempio n. 1
0
    public void execute(InternalWorkingMemory workingMemory) {

      final PropagationContext context =
          new PropagationContextImpl(
              workingMemory.getNextPropagationIdCounter(),
              PropagationContext.INSERTION,
              this.ruleOrigin,
              this.leftTuple,
              this.factHandle);
      ReteooRuleBase ruleBase = (ReteooRuleBase) workingMemory.getRuleBase();
      ruleBase.assertObject(this.factHandle, this.factHandle.getObject(), context, workingMemory);
      context.evaluateActionQueue(workingMemory);
    }
  public static PropagationContext createPropagationContextForFact(
      InternalWorkingMemory workingMemory, InternalFactHandle factHandle, int propagationType) {
    PropagationContextFactory pctxFactory =
        workingMemory
            .getKnowledgeBase()
            .getConfiguration()
            .getComponentFactory()
            .getPropagationContextFactory();

    // if the fact is still in the working memory (since it may have been previously retracted
    // already
    return pctxFactory.createPropagationContext(
        workingMemory.getNextPropagationIdCounter(), propagationType, null, null, factHandle);
  }
Esempio n. 3
0
    public void execute(InternalWorkingMemory workingMemory) {
      if (this.factHandle.isValid()) {
        // if the fact is still in the working memory (since it may have been previously retracted
        // already
        final PropagationContext context =
            new PropagationContextImpl(
                workingMemory.getNextPropagationIdCounter(),
                PropagationContext.EXPIRATION,
                null,
                null,
                this.factHandle);
        ((EventFactHandle) factHandle).setExpired(true);
        this.node.retractObject(factHandle, context, workingMemory);

        context.evaluateActionQueue(workingMemory);
        // if no activations for this expired event
        if (((EventFactHandle) factHandle).getActivationsCount() == 0) {
          // remove it from the object store and clean up resources
          ((EventFactHandle) factHandle).getEntryPoint().retract(factHandle);
        }
        context.evaluateActionQueue(workingMemory);
      }
    }