code: public void applyToAncestorsUpTo( Type stopType,
                                        Operation operation ) {
          PlanNode ancestor = getParent();
          while (ancestor != null) {
              if (ancestor.getType() == stopType) return;
              operation.apply(ancestor);
              ancestor = ancestor.getParent();
          }
      }
docs: Apply the operation to all ancestor nodes below a node of the given type.
  
  @param stopType the type of node that should not be included in the results; may not be null
  @param operation the operation to apply to each of the ancestor nodes below the given type; may not be null