@Test public void testGetCanvasNewChildIndex_withStage() { setupForStage(); assertEquals(2, CaseManagementCommandUtil.getNewChildCanvasIndex(parent)); }
@SuppressWarnings("unchecked") public static int getNewChildCanvasIndex(final Node<View<?>, Edge> parent) { Predicate<Node> predicate = Objects.isNull(parent.getContent()) || !(parent.getContent().getDefinition() instanceof CaseManagementDiagram) ? CaseManagementCommandUtil::isSubStageNode : CaseManagementCommandUtil::isStageNode; return (int) parent.getOutEdges().stream() .filter(childPredicate()) .filter(edge -> predicate.test(edge.getTargetNode())).count(); }
CaseManagementCommandUtil { @SuppressWarnings("unchecked") public static int getNewChildCanvasIndex(final Node<View<?>, Edge> parent) { Predicate<Node> predicate = Objects.isNull(parent.getContent()) || !(parent.getContent().getDefinition() instanceof CaseManagementDiagram) ? CaseManagementCommandUtil::isSubStageNode : CaseManagementCommandUtil::isStageNode; return (int) parent.getOutEdges().stream() .filter(childPredicate()) .filter(edge -> predicate.test(edge.getTargetNode())).count(); } }
CaseManagementCommandUtil { @SuppressWarnings("unchecked") public static int getNewChildCanvasIndex(final Node<View<?>, Edge> parent) { Predicate<Node> predicate = Objects.isNull(parent.getContent()) || !(parent.getContent().getDefinition() instanceof CaseManagementDiagram) ? CaseManagementCommandUtil::isSubStageNode : CaseManagementCommandUtil::isStageNode; return (int) parent.getOutEdges().stream() .filter(childPredicate()) .filter(edge -> predicate.test(edge.getTargetNode())).count(); }  }
CaseManagementCommandUtil { @SuppressWarnings("unchecked") public static int getNewChildCanvasIndex(final Node<View<?>, Edge> parent) { Predicate<Node> predicate = Objects.isNull(parent.getContent()) || !(parent.getContent().getDefinition() instanceof CaseManagementDiagram) ? CaseManagementCommandUtil::isSubStageNode : CaseManagementCommandUtil::isStageNode; return (int) parent.getOutEdges().stream() .filter(childPredicate()) .filter(edge -> predicate.test(edge.getTargetNode())).count(); }  @SuppressWarnings("unchecked") static Node<Definition<CaseManagementDiagram>, ?> getFirstDiagramNode(final Graph<?, Node> graph); @SuppressWarnings("unchecked") static int getChildGraphIndex(final Node parent,
                                         final Node child); @SuppressWarnings("unchecked") static int getChildCanvasIndex(final Node<View<?>, Edge> parent,
                                          final Node<View<?>, Edge> child); static boolean isStage(final Node<View<?>, Edge> parent, final Node<View<?>, Edge> child); static boolean isStageNode(final Node<View<?>, Edge> node); static boolean isSubStageNode(final Node<View<?>, Edge> node); static Predicate<Edge> childPredicate(); static Predicate<Edge> sequencePredicate(); @SuppressWarnings("unchecked") static int getNewChildCanvasIndex(final Node<View<?>, Edge> parent); @SuppressWarnings("unchecked") static int getNewChildGraphIndex(final Node<View<?>, Edge> parent); }
CaseManagementCommandUtil { @SuppressWarnings("unchecked") public static int getNewChildCanvasIndex(final Node<View<?>, Edge> parent) { Predicate<Node> predicate = Objects.isNull(parent.getContent()) || !(parent.getContent().getDefinition() instanceof CaseManagementDiagram) ? CaseManagementCommandUtil::isSubStageNode : CaseManagementCommandUtil::isStageNode; return (int) parent.getOutEdges().stream() .filter(childPredicate()) .filter(edge -> predicate.test(edge.getTargetNode())).count(); }  @SuppressWarnings("unchecked") static Node<Definition<CaseManagementDiagram>, ?> getFirstDiagramNode(final Graph<?, Node> graph); @SuppressWarnings("unchecked") static int getChildGraphIndex(final Node parent,
                                         final Node child); @SuppressWarnings("unchecked") static int getChildCanvasIndex(final Node<View<?>, Edge> parent,
                                          final Node<View<?>, Edge> child); static boolean isStage(final Node<View<?>, Edge> parent, final Node<View<?>, Edge> child); static boolean isStageNode(final Node<View<?>, Edge> node); static boolean isSubStageNode(final Node<View<?>, Edge> node); static Predicate<Edge> childPredicate(); static Predicate<Edge> sequencePredicate(); @SuppressWarnings("unchecked") static int getNewChildCanvasIndex(final Node<View<?>, Edge> parent); @SuppressWarnings("unchecked") static int getNewChildGraphIndex(final Node<View<?>, Edge> parent);  }