@Test public void checkBoundsExceededTest() { Bounds parentBounds = Bounds.create(50d, 50d, 200d, 200d); Bounds childBounds = Bounds.create(51d, 51d, 199d, 199d); assertTrue(GraphUtils.checkBoundsExceeded(parentBounds, childBounds)); childBounds = Bounds.create(51d, 51d, 200d, 200d); assertTrue(GraphUtils.checkBoundsExceeded(parentBounds, childBounds)); childBounds = Bounds.create(50d, 50d, 199d, 199d); assertTrue(GraphUtils.checkBoundsExceeded(parentBounds, childBounds)); childBounds = Bounds.create(50d, 50d, 200d, 200d); assertTrue(GraphUtils.checkBoundsExceeded(parentBounds, childBounds)); childBounds = Bounds.create(49d, 49d, 201d, 201d); assertFalse(GraphUtils.checkBoundsExceeded(parentBounds, childBounds)); childBounds = Bounds.create(49d, 49d, 200d, 200d); assertFalse(GraphUtils.checkBoundsExceeded(parentBounds, childBounds)); childBounds = Bounds.create(49d, 49d, 199d, 199d); assertFalse(GraphUtils.checkBoundsExceeded(parentBounds, childBounds)); childBounds = Bounds.create(49d, 49d, 201d, 201d); assertFalse(GraphUtils.checkBoundsExceeded(parentBounds, childBounds)); childBounds = Bounds.create(50d, 49d, 201d, 201d); assertFalse(GraphUtils.checkBoundsExceeded(parentBounds, childBounds)); childBounds = Bounds.create(50d, 49d, 201d, 201d); assertFalse(GraphUtils.checkBoundsExceeded(parentBounds, childBounds)); }
public static boolean checkBoundsExceeded(final Bounds parentBounds, final Bounds bounds) { if (null == parentBounds) { return true; } if (parentBounds.hasUpperLeft()) { if ((bounds.getUpperLeft().getX() < parentBounds.getUpperLeft().getX()) || (bounds.getUpperLeft().getY() < parentBounds.getUpperLeft().getY())) { return false; } } if (parentBounds.hasLowerRight()) { if ((bounds.getLowerRight().getX() > parentBounds.getLowerRight().getX()) || (bounds.getLowerRight().getY() > parentBounds.getLowerRight().getY())) { return false; } } return true; }
GraphUtils { public static boolean checkBoundsExceeded(final Bounds parentBounds, final Bounds bounds) { if (null == parentBounds) { return true; } if (parentBounds.hasUpperLeft()) { if ((bounds.getUpperLeft().getX() < parentBounds.getUpperLeft().getX()) || (bounds.getUpperLeft().getY() < parentBounds.getUpperLeft().getY())) { return false; } } if (parentBounds.hasLowerRight()) { if ((bounds.getLowerRight().getX() > parentBounds.getLowerRight().getX()) || (bounds.getLowerRight().getY() > parentBounds.getLowerRight().getY())) { return false; } } return true; } }
GraphUtils { public static boolean checkBoundsExceeded(final Bounds parentBounds, final Bounds bounds) { if (null == parentBounds) { return true; } if (parentBounds.hasUpperLeft()) { if ((bounds.getUpperLeft().getX() < parentBounds.getUpperLeft().getX()) || (bounds.getUpperLeft().getY() < parentBounds.getUpperLeft().getY())) { return false; } } if (parentBounds.hasLowerRight()) { if ((bounds.getLowerRight().getX() > parentBounds.getLowerRight().getX()) || (bounds.getLowerRight().getY() > parentBounds.getLowerRight().getY())) { return false; } } return true; }  }
GraphUtils { public static boolean checkBoundsExceeded(final Bounds parentBounds, final Bounds bounds) { if (null == parentBounds) { return true; } if (parentBounds.hasUpperLeft()) { if ((bounds.getUpperLeft().getX() < parentBounds.getUpperLeft().getX()) || (bounds.getUpperLeft().getY() < parentBounds.getUpperLeft().getY())) { return false; } } if (parentBounds.hasLowerRight()) { if ((bounds.getLowerRight().getX() > parentBounds.getLowerRight().getX()) || (bounds.getLowerRight().getY() > parentBounds.getLowerRight().getY())) { return false; } } return true; }  static int countEdges(final DefinitionManager definitionManager,
                                 final String edgeId,
                                 final Collection<? extends Edge> edges); static Map<String, Integer> getLabelsCount(final Graph<?, ? extends Node> target,
                                                      final Set<String> roleFilter); @SuppressWarnings("unchecked") static Map<String, Integer> getLabelsCount(final Graph<?, ? extends Node> target,
                                                      final Predicate<Element<?>> elementFilter,
                                                      final Set<String> roleFilter); @SuppressWarnings("unchecked") static void computeLabelsCount(final Node node,
                                          final Map<String, Integer> labelsCount,
                                          final Set<String> roleFilter); static CardinalityCountState computeCardinalityState(final Diagram diagram); static Set<String> getLabels(final Element<? extends Definition<?>> element); @SuppressWarnings("unchecked") static Element<?> getParent(final Node<?, ? extends Edge> element); @SuppressWarnings("unchecked") static Optional<Element<? extends Definition>> getParentByDefinitionId(final DefinitionManager definitionManager,
                                                                                  final Function<Node, Element> parentSupplier,
                                                                                  final Node<?, ? extends Edge> candidate,
                                                                                  final Predicate<String> parentDefIdFilter); @SuppressWarnings("unchecked") static Optional<Element<? extends Definition>> getParentByDefinitionId(final DefinitionManager definitionManager,
                                                                                  final Function<Node, Element> parentSupplier,
                                                                                  final Node<?, ? extends Edge> candidate,
                                                                                  final String parentDefId); static Point2D getPosition(final View element); static Point2D getComputedPosition(final Node<?, ? extends Edge> element); static double[] getNodeSize(final View element); static boolean isRootNode(Element<? extends View<?>> element, final Graph<DefinitionSet, Node> graph); static boolean checkBoundsExceeded(final Bounds parentBounds,
                                              final Bounds bounds); @SuppressWarnings("unchecked") static Node<Definition<C>, ?> getFirstNode(final Graph<?, Node> graph,
                                                          final Class<?> type); @SuppressWarnings("unchecked") static boolean hasChildren(final Node<?, ? extends Edge> element); static boolean hasDockedNodes(final Node<?, ? extends Edge> element); static boolean hasConnections(Node<? extends Definition<?>, ? extends Edge> node); static boolean hasTargetConnections(Node<? extends Definition<?>, ? extends Edge> node); static Predicate<Element> isContentSomeDefinition(); static List<Node> getDockedNodes(final Node<?, ? extends Edge> element); static List<Node> getChildNodes(final Node<?, ? extends Edge> element); static List<Edge<? extends ViewConnector<?>, Node>> getSourceConnections(
            final Node<?, ? extends Edge> element); static List<Edge<? extends ViewConnector<?>, Node>> getTargetConnections(
            final Node<?, ? extends Edge> element); static boolean isDockedNode(final Node<?, ? extends Edge> element); static Optional<Node> getDockParent(final Node<?, ? extends Edge> element); @SuppressWarnings("unchecked") static Long countChildren(final Node<?, ? extends Edge> element); static OptionalInt getChildIndex(final Element element,
                                            final String uuid); }
GraphUtils { public static boolean checkBoundsExceeded(final Bounds parentBounds, final Bounds bounds) { if (null == parentBounds) { return true; } if (parentBounds.hasUpperLeft()) { if ((bounds.getUpperLeft().getX() < parentBounds.getUpperLeft().getX()) || (bounds.getUpperLeft().getY() < parentBounds.getUpperLeft().getY())) { return false; } } if (parentBounds.hasLowerRight()) { if ((bounds.getLowerRight().getX() > parentBounds.getLowerRight().getX()) || (bounds.getLowerRight().getY() > parentBounds.getLowerRight().getY())) { return false; } } return true; }  static int countEdges(final DefinitionManager definitionManager,
                                 final String edgeId,
                                 final Collection<? extends Edge> edges); static Map<String, Integer> getLabelsCount(final Graph<?, ? extends Node> target,
                                                      final Set<String> roleFilter); @SuppressWarnings("unchecked") static Map<String, Integer> getLabelsCount(final Graph<?, ? extends Node> target,
                                                      final Predicate<Element<?>> elementFilter,
                                                      final Set<String> roleFilter); @SuppressWarnings("unchecked") static void computeLabelsCount(final Node node,
                                          final Map<String, Integer> labelsCount,
                                          final Set<String> roleFilter); static CardinalityCountState computeCardinalityState(final Diagram diagram); static Set<String> getLabels(final Element<? extends Definition<?>> element); @SuppressWarnings("unchecked") static Element<?> getParent(final Node<?, ? extends Edge> element); @SuppressWarnings("unchecked") static Optional<Element<? extends Definition>> getParentByDefinitionId(final DefinitionManager definitionManager,
                                                                                  final Function<Node, Element> parentSupplier,
                                                                                  final Node<?, ? extends Edge> candidate,
                                                                                  final Predicate<String> parentDefIdFilter); @SuppressWarnings("unchecked") static Optional<Element<? extends Definition>> getParentByDefinitionId(final DefinitionManager definitionManager,
                                                                                  final Function<Node, Element> parentSupplier,
                                                                                  final Node<?, ? extends Edge> candidate,
                                                                                  final String parentDefId); static Point2D getPosition(final View element); static Point2D getComputedPosition(final Node<?, ? extends Edge> element); static double[] getNodeSize(final View element); static boolean isRootNode(Element<? extends View<?>> element, final Graph<DefinitionSet, Node> graph); static boolean checkBoundsExceeded(final Bounds parentBounds,
                                              final Bounds bounds); @SuppressWarnings("unchecked") static Node<Definition<C>, ?> getFirstNode(final Graph<?, Node> graph,
                                                          final Class<?> type); @SuppressWarnings("unchecked") static boolean hasChildren(final Node<?, ? extends Edge> element); static boolean hasDockedNodes(final Node<?, ? extends Edge> element); static boolean hasConnections(Node<? extends Definition<?>, ? extends Edge> node); static boolean hasTargetConnections(Node<? extends Definition<?>, ? extends Edge> node); static Predicate<Element> isContentSomeDefinition(); static List<Node> getDockedNodes(final Node<?, ? extends Edge> element); static List<Node> getChildNodes(final Node<?, ? extends Edge> element); static List<Edge<? extends ViewConnector<?>, Node>> getSourceConnections(
            final Node<?, ? extends Edge> element); static List<Edge<? extends ViewConnector<?>, Node>> getTargetConnections(
            final Node<?, ? extends Edge> element); static boolean isDockedNode(final Node<?, ? extends Edge> element); static Optional<Node> getDockParent(final Node<?, ? extends Edge> element); @SuppressWarnings("unchecked") static Long countChildren(final Node<?, ? extends Edge> element); static OptionalInt getChildIndex(final Element element,
                                            final String uuid);  }