@NotNull
  JBIterable<InspectionTreeNode> traverseFrom(InspectionTreeNode node, boolean direction) {
    return JBIterable.generate(node, n -> getParent(n)).filter(n -> getParent(n) != null).flatMap(n1 -> {
      InspectionTreeNode p = getParent(n1);
      int idx = getIndexOfChild(p, n1);
      if (idx < 0) return JBIterable.empty();
      assert p != null;
      InspectionTreeNode.Children children = p.myChildren;
      if (children == null) return JBIterable.empty();
      InspectionTreeNode[] arr = children.myChildren;
      List<? extends InspectionTreeNode> sublist;
      if (direction) {
        sublist = Arrays.asList(arr).subList(idx + (n1 == node ? 0 : 1), arr.length);
      }
      else {
        sublist = ContainerUtil.reverse(Arrays.asList(arr).subList(0, idx));
      }
      return TreeTraversal.PRE_ORDER_DFS.traversal(sublist, (InspectionTreeNode n) -> direction ? getChildren(n) : ContainerUtil.reverse(getChildren(n)));
    });
  }
@NotNull
  JBIterable<InspectionTreeNode> traverseFrom(InspectionTreeNode node, boolean direction)