@Test public void testStaticClosure() { final Interval<Integer> interval1 = new Interval<Integer>(2, 4); final Interval<Integer> interval2 = new Interval<Integer>(-3, -2); final Interval<Integer> interval3 = new Interval<Integer>(5, 7); final Interval<Integer> interval4 = new Interval<Integer>(-1, 8); final Interval<Integer> interval5 = new Interval<Integer>(-7, -2); @SuppressWarnings("unchecked") final List<Interval<Integer>> intervals = Arrays.asList(interval1, interval2, interval3, interval4, interval5); Assert.assertEquals(new Interval<Integer>(-7, 8), Interval.closureOf(intervals)); }
public static <T extends Number> Interval<T> closureOf(final Interval<T> interval1, final Interval<T> interval2) { if (interval1 == null && interval2 == null) { return null; } else if (interval1 == null) { return interval2; } else if (interval2 == null) { return interval1; } else { return interval1.closure(interval2); } }
Interval { public static <T extends Number> Interval<T> closureOf(final Interval<T> interval1, final Interval<T> interval2) { if (interval1 == null && interval2 == null) { return null; } else if (interval1 == null) { return interval2; } else if (interval2 == null) { return interval1; } else { return interval1.closure(interval2); } } }
Interval { public static <T extends Number> Interval<T> closureOf(final Interval<T> interval1, final Interval<T> interval2) { if (interval1 == null && interval2 == null) { return null; } else if (interval1 == null) { return interval2; } else if (interval2 == null) { return interval1; } else { return interval1.closure(interval2); } } Interval(final Interval<NUMBER_TYPE> original);  Interval(final NUMBER_TYPE leftBoundary, final NUMBER_TYPE rightBoundary);  Interval(
        final NUMBER_TYPE leftBoundary,
        final boolean leftOpen,
        final NUMBER_TYPE rightBoundary,
        final boolean rightOpen); }
Interval { public static <T extends Number> Interval<T> closureOf(final Interval<T> interval1, final Interval<T> interval2) { if (interval1 == null && interval2 == null) { return null; } else if (interval1 == null) { return interval2; } else if (interval2 == null) { return interval1; } else { return interval1.closure(interval2); } } Interval(final Interval<NUMBER_TYPE> original);  Interval(final NUMBER_TYPE leftBoundary, final NUMBER_TYPE rightBoundary);  Interval(
        final NUMBER_TYPE leftBoundary,
        final boolean leftOpen,
        final NUMBER_TYPE rightBoundary,
        final boolean rightOpen); Interval<NUMBER_TYPE> createCopy(); NUMBER_TYPE getLeftBoundary(); boolean isLeftOpen(); NUMBER_TYPE getRightBoundary(); boolean isRightOpen(); Interval<NUMBER_TYPE> intersect(final Interval<NUMBER_TYPE> interval); Interval<NUMBER_TYPE> intersect(final Iterable<Interval<NUMBER_TYPE>> intervals); Interval<NUMBER_TYPE> closure(final Interval<NUMBER_TYPE> interval); Interval<NUMBER_TYPE> closure(final Iterable<Interval<NUMBER_TYPE>> intervals); static Interval<T> closureOf(final Interval<T> interval1, final Interval<T> interval2); static Interval<T> closureOf(final Iterable<Interval<T>> intervals); Interval<NUMBER_TYPE> union(final Interval<NUMBER_TYPE> interval); boolean contains(final NUMBER_TYPE number); boolean contains(final Interval<NUMBER_TYPE> other); @Override int hashCode(); @Override boolean equals(final Object obj); @Override String toString(); }
Interval { public static <T extends Number> Interval<T> closureOf(final Interval<T> interval1, final Interval<T> interval2) { if (interval1 == null && interval2 == null) { return null; } else if (interval1 == null) { return interval2; } else if (interval2 == null) { return interval1; } else { return interval1.closure(interval2); } } Interval(final Interval<NUMBER_TYPE> original);  Interval(final NUMBER_TYPE leftBoundary, final NUMBER_TYPE rightBoundary);  Interval(
        final NUMBER_TYPE leftBoundary,
        final boolean leftOpen,
        final NUMBER_TYPE rightBoundary,
        final boolean rightOpen); Interval<NUMBER_TYPE> createCopy(); NUMBER_TYPE getLeftBoundary(); boolean isLeftOpen(); NUMBER_TYPE getRightBoundary(); boolean isRightOpen(); Interval<NUMBER_TYPE> intersect(final Interval<NUMBER_TYPE> interval); Interval<NUMBER_TYPE> intersect(final Iterable<Interval<NUMBER_TYPE>> intervals); Interval<NUMBER_TYPE> closure(final Interval<NUMBER_TYPE> interval); Interval<NUMBER_TYPE> closure(final Iterable<Interval<NUMBER_TYPE>> intervals); static Interval<T> closureOf(final Interval<T> interval1, final Interval<T> interval2); static Interval<T> closureOf(final Iterable<Interval<T>> intervals); Interval<NUMBER_TYPE> union(final Interval<NUMBER_TYPE> interval); boolean contains(final NUMBER_TYPE number); boolean contains(final Interval<NUMBER_TYPE> other); @Override int hashCode(); @Override boolean equals(final Object obj); @Override String toString();  }