Example #1
0
  public static void findLeftTupleBlocker(
      BetaNode betaNode,
      RightTupleMemory rtm,
      ContextEntry[] contextEntry,
      BetaConstraints constraints,
      LeftTuple leftTuple,
      FastIterator it,
      PropagationContext context,
      boolean useLeftMemory) {
    // This method will also remove rightTuples that are from subnetwork where no leftmemory use
    // used

    for (RightTuple rightTuple = betaNode.getFirstRightTuple(leftTuple, rtm, null, it);
        rightTuple != null; ) {
      RightTuple nextRight = (RightTuple) it.next(rightTuple);
      if (constraints.isAllowedCachedLeft(contextEntry, rightTuple.getFactHandle())) {
        leftTuple.setBlocker(rightTuple);

        if (useLeftMemory) {
          rightTuple.addBlocked(leftTuple);
          break;
        } else if (betaNode.isRightInputIsRiaNode()) {
          // If we aren't using leftMemory and the right input is a RIAN, then we must iterate and
          // find all subetwork right tuples and remove them
          // so we don't break
          rtm.remove(rightTuple);
        } else {
          break;
        }
      }
      rightTuple = nextRight;
    }
  }