@Test public void testGetCanvasChildIndex_withSubStage() { setupForSubStage(); assertEquals(1, CaseManagementCommandUtil.getChildCanvasIndex(parent, child)); }
@SuppressWarnings("unchecked") public static int getChildCanvasIndex(final Node<View<?>, Edge> parent, final Node<View<?>, Edge> child) { if (parent != null && child != null) { List<Edge> outEdges = parent.getOutEdges(); if (null != outEdges && !outEdges.isEmpty()) { Predicate<Node> predicate = (Objects.isNull(parent.getContent()) || !(parent.getContent().getDefinition() instanceof CaseManagementDiagram)) ? CaseManagementCommandUtil::isSubStageNode : CaseManagementCommandUtil::isStageNode; for (int i = 0, c = 0, n = outEdges.size(); i < n; i++) { final Node cNode = outEdges.get(i).getTargetNode(); if (child.equals(cNode)) { return c; } if (predicate.test(cNode)) { c++; } } } } return -1; }
CaseManagementCommandUtil { @SuppressWarnings("unchecked") public static int getChildCanvasIndex(final Node<View<?>, Edge> parent, final Node<View<?>, Edge> child) { if (parent != null && child != null) { List<Edge> outEdges = parent.getOutEdges(); if (null != outEdges && !outEdges.isEmpty()) { Predicate<Node> predicate = (Objects.isNull(parent.getContent()) || !(parent.getContent().getDefinition() instanceof CaseManagementDiagram)) ? CaseManagementCommandUtil::isSubStageNode : CaseManagementCommandUtil::isStageNode; for (int i = 0, c = 0, n = outEdges.size(); i < n; i++) { final Node cNode = outEdges.get(i).getTargetNode(); if (child.equals(cNode)) { return c; } if (predicate.test(cNode)) { c++; } } } } return -1; } }
CaseManagementCommandUtil { @SuppressWarnings("unchecked") public static int getChildCanvasIndex(final Node<View<?>, Edge> parent, final Node<View<?>, Edge> child) { if (parent != null && child != null) { List<Edge> outEdges = parent.getOutEdges(); if (null != outEdges && !outEdges.isEmpty()) { Predicate<Node> predicate = (Objects.isNull(parent.getContent()) || !(parent.getContent().getDefinition() instanceof CaseManagementDiagram)) ? CaseManagementCommandUtil::isSubStageNode : CaseManagementCommandUtil::isStageNode; for (int i = 0, c = 0, n = outEdges.size(); i < n; i++) { final Node cNode = outEdges.get(i).getTargetNode(); if (child.equals(cNode)) { return c; } if (predicate.test(cNode)) { c++; } } } } return -1; }  }
CaseManagementCommandUtil { @SuppressWarnings("unchecked") public static int getChildCanvasIndex(final Node<View<?>, Edge> parent, final Node<View<?>, Edge> child) { if (parent != null && child != null) { List<Edge> outEdges = parent.getOutEdges(); if (null != outEdges && !outEdges.isEmpty()) { Predicate<Node> predicate = (Objects.isNull(parent.getContent()) || !(parent.getContent().getDefinition() instanceof CaseManagementDiagram)) ? CaseManagementCommandUtil::isSubStageNode : CaseManagementCommandUtil::isStageNode; for (int i = 0, c = 0, n = outEdges.size(); i < n; i++) { final Node cNode = outEdges.get(i).getTargetNode(); if (child.equals(cNode)) { return c; } if (predicate.test(cNode)) { c++; } } } } return -1; }  @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 getChildCanvasIndex(final Node<View<?>, Edge> parent, final Node<View<?>, Edge> child) { if (parent != null && child != null) { List<Edge> outEdges = parent.getOutEdges(); if (null != outEdges && !outEdges.isEmpty()) { Predicate<Node> predicate = (Objects.isNull(parent.getContent()) || !(parent.getContent().getDefinition() instanceof CaseManagementDiagram)) ? CaseManagementCommandUtil::isSubStageNode : CaseManagementCommandUtil::isStageNode; for (int i = 0, c = 0, n = outEdges.size(); i < n; i++) { final Node cNode = outEdges.get(i).getTargetNode(); if (child.equals(cNode)) { return c; } if (predicate.test(cNode)) { c++; } } } } return -1; }  @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);  }