diff --git a/src/org/jetuml/diagram/ControlFlow.java b/src/org/jetuml/diagram/ControlFlow.java index bfbee2f5e..b83624919 100644 --- a/src/org/jetuml/diagram/ControlFlow.java +++ b/src/org/jetuml/diagram/ControlFlow.java @@ -93,20 +93,6 @@ public Optional getCaller(Node pNode) .findFirst(); } - /** - * @return True if there is at least one call node in the diagram. - */ - public boolean hasEntryPoint() - { - return aDiagram.rootNodes().stream().anyMatch(ControlFlow::hasCallNode); - } - - private static boolean hasCallNode(Node pNode) - { - return pNode.getClass() == ImplicitParameterNode.class && - !pNode.getChildren().isEmpty(); - } - /** * @param pNode The node to check. * @return True if pNode is a CallNode and is at the end of a ConstructorEdge. diff --git a/src/org/jetuml/diagram/builder/constraints/SequenceDiagramEdgeConstraints.java b/src/org/jetuml/diagram/builder/constraints/SequenceDiagramEdgeConstraints.java index 40c9470fc..18bff82ac 100644 --- a/src/org/jetuml/diagram/builder/constraints/SequenceDiagramEdgeConstraints.java +++ b/src/org/jetuml/diagram/builder/constraints/SequenceDiagramEdgeConstraints.java @@ -124,7 +124,7 @@ public static Constraint singleEntryPoint() { return !(pEdge.getClass() == CallEdge.class && pStart.getClass() == ImplicitParameterNode.class && - new ControlFlow(pRenderer.diagram()).hasEntryPoint()); + ((SequenceDiagramRenderer)pRenderer).hasEntryPoint()); }; } } diff --git a/src/org/jetuml/rendering/SequenceDiagramRenderer.java b/src/org/jetuml/rendering/SequenceDiagramRenderer.java index f1f5000a5..2e6e505a1 100644 --- a/src/org/jetuml/rendering/SequenceDiagramRenderer.java +++ b/src/org/jetuml/rendering/SequenceDiagramRenderer.java @@ -379,4 +379,18 @@ private int getDropDistance() return DROP_MIN + 10; } } + + /** + * @return True if there is at least one call node in the diagram. + */ + public boolean hasEntryPoint() + { + return diagram().rootNodes().stream().anyMatch(SequenceDiagramRenderer::hasCallNode); + } + + private static boolean hasCallNode(Node pNode) + { + return pNode.getClass() == ImplicitParameterNode.class && + !pNode.getChildren().isEmpty(); + } } diff --git a/test/org/jetuml/diagram/TestControlFlow.java b/test/org/jetuml/diagram/TestControlFlow.java index 8a16f61cc..3d2079ca7 100644 --- a/test/org/jetuml/diagram/TestControlFlow.java +++ b/test/org/jetuml/diagram/TestControlFlow.java @@ -98,18 +98,6 @@ private void createSampleDiagram1() aDiagramAccessor.connectAndAdd(aCallEdge3, aCall2, aCall5); } - @Test - void testHasEntryPoint_No() - { - assertFalse(new ControlFlow(new Diagram(DiagramType.SEQUENCE)).hasEntryPoint()); - } - - @Test - void testHasEntryPoint_Yes() - { - assertTrue(aFlow.hasEntryPoint()); - } - @Test void testGetCallerNoCaller() {