Example #1
0
 private void restoreList(final LeftTuple parent, final LeftTuple[] matchings) {
   // concatenate matchings list at the end of the children list
   if (parent.getFirstChild() == null) {
     parent.setFirstChild(matchings[0]);
     parent.setLastChild(matchings[1]);
   } else if (matchings[0] != null) {
     parent.getLastChild().setLeftParentNext(matchings[0]);
     matchings[0].setLeftParentPrevious(parent.getLastChild());
     parent.setLastChild(matchings[1]);
   }
 }
Example #2
0
  protected LeftTuple[] splitList(
      final LeftTuple parent, final AccumulateContext accctx, final boolean isUpdatingSink) {
    LeftTuple[] matchings = new LeftTuple[2];

    // save the matchings list
    matchings[0] = getFirstMatch(parent, accctx, isUpdatingSink);
    matchings[1] = matchings[0] != null ? parent.getLastChild() : null;

    // update the tuple for the actual propagations
    if (matchings[0] != null) {
      if (parent.getFirstChild() == matchings[0]) {
        parent.setFirstChild(null);
      }
      parent.setLastChild(matchings[0].getLeftParentPrevious());
      if (parent.getLastChild() != null) {
        parent.getLastChild().setLeftParentNext(null);
        matchings[0].setLeftParentPrevious(null);
      }
    }

    return matchings;
  }