graphLayout/jetbrains.mps.graphLayout.orthogonalLayout/source_gen/jetbrains/mps/graphLayout/flowOrthogonalLayout/ConstraintsGraph.java [268:340]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
          System.out.println("hor ends: " + Arrays.toString(horEnds));
          System.out.println("ver ends: " + Arrays.toString(verEnds));
        }
        boolean isSeparated = false;
        isSeparated |= hasPath(myHorConstraintsGraph, horSeg, verEnds);
        isSeparated |= hasPath(myVerConstraintsGraph, verSeg, horEnds);
        if (!(isSeparated)) {
          throw new RuntimeException("pair is not separated in constraints graph!!!");
        }
      }
    }
  }
  private boolean hasPath(Graph graph, Node node, Node[] ends) {
    if (ShortestPath.getPath(graph, node, ends[0], Edge.Direction.FRONT) != null) {
      return true;
    }
    if (ShortestPath.getPath(graph, ends[1], node, Edge.Direction.FRONT) != null) {
      return true;
    }
    return false;
  }
  private boolean isSegmentsIntersect(final Node horSegment, final Node verSegment) {
    Iterable<Node> horNodes = SetSequence.fromSet(MapSequence.fromMap(myHorNodeMap).keySet()).where(new IWhereFilter<Node>() {
      public boolean accept(Node key) {
        return MapSequence.fromMap(myHorNodeMap).get(key) == horSegment;
      }
    });
    Iterable<Node> verNodes = SetSequence.fromSet(MapSequence.fromMap(myVerNodeMap).keySet()).where(new IWhereFilter<Node>() {
      public boolean accept(Node key) {
        return MapSequence.fromMap(myVerNodeMap).get(key) == verSegment;
      }
    });
    boolean intersects = false;
    for (Node node : Sequence.fromIterable(horNodes)) {
      intersects |= Sequence.fromIterable(verNodes).contains(node);
    }
    return intersects;
  }
  private Node[] getSegmentEndSegments(Node segment, Direction2D direction) {
    Node[] ends = getSegmentEnds(segment, direction);
    Map<Node, Node> nodeMap;
    if (direction.isHorizontal()) {
      nodeMap = myVerNodeMap;
    } else {
      nodeMap = myHorNodeMap;
    }
    for (int i = 0; i < ends.length; i++) {
      ends[i] = MapSequence.fromMap(nodeMap).get(ends[i]);
    }
    return ends;
  }
  private Node[] getSegmentEnds(final Node segment, final Direction2D direction) {
    final Wrappers._T<Map<Node, Node>> nodeMap = new Wrappers._T<Map<Node, Node>>();
    if (direction.isHorizontal()) {
      nodeMap.value = myHorNodeMap;
    } else {
      nodeMap.value = myVerNodeMap;
    }
    Iterable<Node> nodes = SetSequence.fromSet(MapSequence.fromMap(nodeMap.value).keySet()).where(new IWhereFilter<Node>() {
      public boolean accept(Node key) {
        return MapSequence.fromMap(nodeMap.value).get(key) == segment;
      }
    });
    Set<Node> firstCandidates = SetSequence.fromSet(new HashSet<Node>());
    SetSequence.fromSet(firstCandidates).addSequence(Sequence.fromIterable(nodes));
    Node[] ends = new Node[2];
    for (Node node : Sequence.fromIterable(nodes)) {
      Dart dart = ListSequence.fromList(myEmbeddedGraph.getDartWithSource(node)).findFirst(new IWhereFilter<Dart>() {
        public boolean accept(Dart it) {
          return MapSequence.fromMap(myDirections).get(it) == direction;
        }
      });
      if (dart == null) {
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



graphLayout/jetbrains.mps.graphLayout.orthogonalLayout/source_gen/jetbrains/mps/graphLayout/internal/flowOrthogonalLayout/ConstraintsGraphProcessor.java [439:511]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
          System.out.println("hor ends: " + Arrays.toString(horEnds));
          System.out.println("ver ends: " + Arrays.toString(verEnds));
        }
        boolean isSeparated = false;
        isSeparated |= hasPath(myHorConstraintsGraph, horSeg, verEnds);
        isSeparated |= hasPath(myVerConstraintsGraph, verSeg, horEnds);
        if (!(isSeparated)) {
          throw new RuntimeException("pair is not separated in constraints graph!!!");
        }
      }
    }
  }
  private boolean hasPath(Graph graph, Node node, Node[] ends) {
    if (ShortestPath.getPath(graph, node, ends[0], Edge.Direction.FRONT) != null) {
      return true;
    }
    if (ShortestPath.getPath(graph, ends[1], node, Edge.Direction.FRONT) != null) {
      return true;
    }
    return false;
  }
  private boolean isSegmentsIntersect(final Node horSegment, final Node verSegment) {
    Iterable<Node> horNodes = SetSequence.fromSet(MapSequence.fromMap(myHorNodeMap).keySet()).where(new IWhereFilter<Node>() {
      public boolean accept(Node key) {
        return MapSequence.fromMap(myHorNodeMap).get(key) == horSegment;
      }
    });
    Iterable<Node> verNodes = SetSequence.fromSet(MapSequence.fromMap(myVerNodeMap).keySet()).where(new IWhereFilter<Node>() {
      public boolean accept(Node key) {
        return MapSequence.fromMap(myVerNodeMap).get(key) == verSegment;
      }
    });
    boolean intersects = false;
    for (Node node : Sequence.fromIterable(horNodes)) {
      intersects |= Sequence.fromIterable(verNodes).contains(node);
    }
    return intersects;
  }
  private Node[] getSegmentEndSegments(Node segment, Direction2D direction) {
    Node[] ends = getSegmentEnds(segment, direction);
    Map<Node, Node> nodeMap;
    if (direction.isHorizontal()) {
      nodeMap = myVerNodeMap;
    } else {
      nodeMap = myHorNodeMap;
    }
    for (int i = 0; i < ends.length; i++) {
      ends[i] = MapSequence.fromMap(nodeMap).get(ends[i]);
    }
    return ends;
  }
  private Node[] getSegmentEnds(final Node segment, final Direction2D direction) {
    final Wrappers._T<Map<Node, Node>> nodeMap = new Wrappers._T<Map<Node, Node>>();
    if (direction.isHorizontal()) {
      nodeMap.value = myHorNodeMap;
    } else {
      nodeMap.value = myVerNodeMap;
    }
    Iterable<Node> nodes = SetSequence.fromSet(MapSequence.fromMap(nodeMap.value).keySet()).where(new IWhereFilter<Node>() {
      public boolean accept(Node key) {
        return MapSequence.fromMap(nodeMap.value).get(key) == segment;
      }
    });
    Set<Node> firstCandidates = SetSequence.fromSet(new HashSet<Node>());
    SetSequence.fromSet(firstCandidates).addSequence(Sequence.fromIterable(nodes));
    Node[] ends = new Node[2];
    for (Node node : Sequence.fromIterable(nodes)) {
      Dart dart = ListSequence.fromList(myEmbeddedGraph.getDartWithSource(node)).findFirst(new IWhereFilter<Dart>() {
        public boolean accept(Dart it) {
          return MapSequence.fromMap(myDirections).get(it) == direction;
        }
      });
      if (dart == null) {
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



