public static void unlinkAndDeleteChildLeftTuple(
     LeftTuple childLeftTuple,
     TupleSets<LeftTuple> trgLeftTuples,
     TupleSets<LeftTuple> stagedLeftTuples) {
   childLeftTuple.unlinkFromRightParent();
   childLeftTuple.unlinkFromLeftParent();
   deleteChildLeftTuple(childLeftTuple, trgLeftTuples, stagedLeftTuples);
 }
Example #2
0
  public static LeftTuple deleteRightChild(
      LeftTuple childLeftTuple, LeftTupleSets trgLeftTuples, LeftTupleSets stagedLeftTuples) {
    switch (childLeftTuple.getStagedType()) {
        // handle clash with already staged entries
      case LeftTuple.INSERT:
        stagedLeftTuples.removeInsert(childLeftTuple);
        break;
      case LeftTuple.UPDATE:
        stagedLeftTuples.removeUpdate(childLeftTuple);
        break;
    }

    LeftTuple next = childLeftTuple.getRightParentNext();

    trgLeftTuples.addDelete(childLeftTuple);
    childLeftTuple.unlinkFromRightParent();
    childLeftTuple.unlinkFromLeftParent();

    return next;
  }
  public void removeMemory(InternalWorkingMemory workingMemory) {
    BetaNode betaNode = (BetaNode) this.sink.getSinks()[0];

    Memory betaMemory = workingMemory.getNodeMemory(betaNode);
    BetaMemory bm;
    if (betaNode.getType() == NodeTypeEnums.AccumulateNode) {
      bm = ((AccumulateMemory) betaMemory).getBetaMemory();
    } else {
      bm = (BetaMemory) betaMemory;
    }

    if (bm.getRightTupleMemory().size() > 0) {
      final Iterator it = bm.getRightTupleMemory().iterator();
      for (RightTuple entry = (RightTuple) it.next();
          entry != null;
          entry = (RightTuple) it.next()) {
        LeftTuple leftTuple = (LeftTuple) entry.getFactHandle().getObject();
        leftTuple.unlinkFromLeftParent();
        leftTuple.unlinkFromRightParent();
      }
    }
    workingMemory.clearNodeMemory(this);
  }