예제 #1
0
 private List<Node> getAllAncestors(Node a, Predicate<Node> stop) {
   Set<Node> all = new LinkedHashSet<Node>();
   Queue<Node> queue = new ArrayDeque<Node>();
   queue.add(a);
   while (!queue.isEmpty()) {
     Node aNode = queue.remove();
     all.add(aNode);
     if (stop.apply(aNode)) {
       return new ArrayList<Node>(all);
     }
     for (Edge edge : aNode.getDownEdges()) {
       queue.add(edge.getDownNode());
     }
   }
   return new ArrayList<Node>(all);
 }
 @Nullable
 private Node arrowToNode(MouseEvent e) {
   int y = PositionUtil.getYInsideRow(e);
   int x = e.getX();
   GraphPrintCell row = getGraphPrintCell(e);
   if (row == null) {
     return null;
   }
   SpecialPrintElement printElement = myGraphPainter.mouseOverArrow(row, x, y);
   if (printElement == null) {
     return null;
   }
   Edge edge = printElement.getGraphElement().getEdge();
   if (edge == null) {
     return null;
   }
   return printElement.getType() == SpecialPrintElement.Type.DOWN_ARROW
       ? edge.getDownNode()
       : edge.getUpNode();
 }