@Test public void testGetVisibleShape() { when(shape1.getAlpha()).thenReturn(0d); when(shape2.getAlpha()).thenReturn(0.1d); ShapeView<?> visibleShape = SVGViewUtils.getVisibleShape(shape1, shape2); assertEquals(shape2, visibleShape); when(shape1.getAlpha()).thenReturn(0.1d); when(shape2.getAlpha()).thenReturn(0d); visibleShape = SVGViewUtils.getVisibleShape(shape1, shape2); assertEquals(shape1, visibleShape); }
@SuppressWarnings("unchecked") public static <V extends ShapeView<?>> V getVisibleShape(final ShapeView<?>... views) { for (ShapeView<?> view : views) { if (view.getAlpha() > 0) { return (V) view; } } return null; }
SVGViewUtils { @SuppressWarnings("unchecked") public static <V extends ShapeView<?>> V getVisibleShape(final ShapeView<?>... views) { for (ShapeView<?> view : views) { if (view.getAlpha() > 0) { return (V) view; } } return null; } }
SVGViewUtils { @SuppressWarnings("unchecked") public static <V extends ShapeView<?>> V getVisibleShape(final ShapeView<?>... views) { for (ShapeView<?> view : views) { if (view.getAlpha() > 0) { return (V) view; } } return null; }  }
SVGViewUtils { @SuppressWarnings("unchecked") public static <V extends ShapeView<?>> V getVisibleShape(final ShapeView<?>... views) { for (ShapeView<?> view : views) { if (view.getAlpha() > 0) { return (V) view; } } return null; }  static void switchVisibility(final SVGShapeView<?> view,
                                        final String visibleId,
                                        final String nonVisibleId); @SuppressWarnings("unchecked") static V getVisibleShape(final ShapeView<?>... views); static Optional<SVGPrimitive> getPrimitive(final SVGShapeView<?> view,
                                                      final String id); static SVGPrimitive getPrimitive(final SVGContainer container,
                                            final String id); static SVGPrimitive getPrimitive(final Collection<SVGPrimitive<?>> primitives,
                                            final String id); static SVGPrimitive getPrimitive(final SVGPrimitive<?> primitive,
                                            final String id); static void setFillAndStroke(final SVGShapeView<?> view, final String id, final double fill, final double stroke); }
SVGViewUtils { @SuppressWarnings("unchecked") public static <V extends ShapeView<?>> V getVisibleShape(final ShapeView<?>... views) { for (ShapeView<?> view : views) { if (view.getAlpha() > 0) { return (V) view; } } return null; }  static void switchVisibility(final SVGShapeView<?> view,
                                        final String visibleId,
                                        final String nonVisibleId); @SuppressWarnings("unchecked") static V getVisibleShape(final ShapeView<?>... views); static Optional<SVGPrimitive> getPrimitive(final SVGShapeView<?> view,
                                                      final String id); static SVGPrimitive getPrimitive(final SVGContainer container,
                                            final String id); static SVGPrimitive getPrimitive(final Collection<SVGPrimitive<?>> primitives,
                                            final String id); static SVGPrimitive getPrimitive(final SVGPrimitive<?> primitive,
                                            final String id); static void setFillAndStroke(final SVGShapeView<?> view, final String id, final double fill, final double stroke);  }