code: private int findPartnerNodeId( Tree<Row> current, Type type ){
          switch( type ) {
              case JOIN_FIRST:
              case JOIN_ALL:
              case WHILE_DO_END:
                  // The partner is the previous sibling which is the SPLIT or WHILE_DO_BEGIN
                  return current.getPrevious().getContent().getId();
              case DO_WHILE_BEGIN:
                  // The partner is the next sibling which is the DO_WHILE_END
                  return current.getNext().getContent().getMainElement().getId();
              case END_IF:
                  // The partner is the first previous IF (there may be ELSE_IF and ELSE siblings between IF and this END_IF)
                  Tree<Row> if_ = current;
                  while( !Type.IF.equals( if_.getContent().getType() ) ){
                      if_ = if_.getPrevious();
                  }
                  return if_.getContent().getId();
              default :
                  throw new IllegalStateException();
          }
      }
docs: Some node producing elements do not define an id themselves but deduce their id based
  on their block-opening or block-closing partner. E.g. a WHILE_DO_END deduces its id
  based on its WHILE_DO_BEGIN partner.