@Test public void testAddOutEdges() { final LayeredGraph layeredGraph = mock(LayeredGraph.class); final Node node = mock(Node.class); final Edge edge = mock(Edge.class); final Node targetNode = mock(Node.class); final List outEdges = Arrays.asList(edge); final String fromId = "from"; final String toId = "to"; final int width = 10; final int height = 20; when(node.getOutEdges()).thenReturn(outEdges); when(edge.getTargetNode()).thenReturn(targetNode); doReturn(fromId).when(layoutService).getId(node); doReturn(toId).when(layoutService).getId(targetNode); doReturn(width).when(layoutService).getWidth(node); doReturn(height).when(layoutService).getHeight(node); layoutService.addOutEdges(layeredGraph, node); verify(layeredGraph).addEdge(fromId, toId); verify(layeredGraph).setVertexSize(fromId, width, height); }
void addOutEdges(final LayeredGraph layeredGraph, final Node n) { for (final Object e : n.getOutEdges()) { if (e instanceof Edge) { final Edge edge = (Edge) e; final String to = getId(edge.getTargetNode()); final String from = getId(n); layeredGraph.addEdge(from, to); layeredGraph.setVertexSize(getId(n), getWidth(n), getHeight(n)); } } }
SugiyamaLayoutService extends AbstractLayoutService { void addOutEdges(final LayeredGraph layeredGraph, final Node n) { for (final Object e : n.getOutEdges()) { if (e instanceof Edge) { final Edge edge = (Edge) e; final String to = getId(edge.getTargetNode()); final String from = getId(n); layeredGraph.addEdge(from, to); layeredGraph.setVertexSize(getId(n), getWidth(n), getHeight(n)); } } } }
SugiyamaLayoutService extends AbstractLayoutService { void addOutEdges(final LayeredGraph layeredGraph, final Node n) { for (final Object e : n.getOutEdges()) { if (e instanceof Edge) { final Edge edge = (Edge) e; final String to = getId(edge.getTargetNode()); final String from = getId(n); layeredGraph.addEdge(from, to); layeredGraph.setVertexSize(getId(n), getWidth(n), getHeight(n)); } } } @Inject  SugiyamaLayoutService(final CycleBreaker cycleBreaker,
                                 final VertexLayerer vertexLayerer,
                                 final VertexOrdering vertexOrdering,
                                 final VertexPositioning vertexPositioning,
                                 final GraphProcessor graphProcessor); }
SugiyamaLayoutService extends AbstractLayoutService { void addOutEdges(final LayeredGraph layeredGraph, final Node n) { for (final Object e : n.getOutEdges()) { if (e instanceof Edge) { final Edge edge = (Edge) e; final String to = getId(edge.getTargetNode()); final String from = getId(n); layeredGraph.addEdge(from, to); layeredGraph.setVertexSize(getId(n), getWidth(n), getHeight(n)); } } } @Inject  SugiyamaLayoutService(final CycleBreaker cycleBreaker,
                                 final VertexLayerer vertexLayerer,
                                 final VertexOrdering vertexOrdering,
                                 final VertexPositioning vertexPositioning,
                                 final GraphProcessor graphProcessor); @Override Layout createLayout(final Graph<?, ?> graph); }
SugiyamaLayoutService extends AbstractLayoutService { void addOutEdges(final LayeredGraph layeredGraph, final Node n) { for (final Object e : n.getOutEdges()) { if (e instanceof Edge) { final Edge edge = (Edge) e; final String to = getId(edge.getTargetNode()); final String from = getId(n); layeredGraph.addEdge(from, to); layeredGraph.setVertexSize(getId(n), getWidth(n), getHeight(n)); } } } @Inject  SugiyamaLayoutService(final CycleBreaker cycleBreaker,
                                 final VertexLayerer vertexLayerer,
                                 final VertexOrdering vertexOrdering,
                                 final VertexPositioning vertexPositioning,
                                 final GraphProcessor graphProcessor); @Override Layout createLayout(final Graph<?, ?> graph);  }