@Test public void testCombine() { Range r1 = new Range(1.0, 2.0); Range r2 = new Range(1.5, 2.5); assertNull(Range.combine(null, null)); assertEquals(r1, Range.combine(r1, null)); assertEquals(r2, Range.combine(null, r2)); assertEquals(new Range(1.0, 2.5), Range.combine(r1, r2)); Range r3 = new Range(Double.NaN, 1.3); Range rr = Range.combine(r1, r3); assertTrue(Double.isNaN(rr.getLowerBound())); assertEquals(2.0, rr.getUpperBound(), EPSILON); Range r4 = new Range(1.7, Double.NaN); rr = Range.combine(r4, r1); assertEquals(1.0, rr.getLowerBound(), EPSILON); assertTrue(Double.isNaN(rr.getUpperBound())); }
public static Range combine(Range range1, Range range2) { if (range1 == null) { return range2; } if (range2 == null) { return range1; } double l = Math.min(range1.getLowerBound(), range2.getLowerBound()); double u = Math.max(range1.getUpperBound(), range2.getUpperBound()); return new Range(l, u); }
Range implements Serializable { public static Range combine(Range range1, Range range2) { if (range1 == null) { return range2; } if (range2 == null) { return range1; } double l = Math.min(range1.getLowerBound(), range2.getLowerBound()); double u = Math.max(range1.getUpperBound(), range2.getUpperBound()); return new Range(l, u); } }
Range implements Serializable { public static Range combine(Range range1, Range range2) { if (range1 == null) { return range2; } if (range2 == null) { return range1; } double l = Math.min(range1.getLowerBound(), range2.getLowerBound()); double u = Math.max(range1.getUpperBound(), range2.getUpperBound()); return new Range(l, u); } Range(double lower, double upper); }
Range implements Serializable { public static Range combine(Range range1, Range range2) { if (range1 == null) { return range2; } if (range2 == null) { return range1; } double l = Math.min(range1.getLowerBound(), range2.getLowerBound()); double u = Math.max(range1.getUpperBound(), range2.getUpperBound()); return new Range(l, u); } Range(double lower, double upper); double getLowerBound(); double getUpperBound(); double getLength(); double getCentralValue(); boolean contains(double value); boolean intersects(double b0, double b1); boolean intersects(Range range); double constrain(double value); static Range combine(Range range1, Range range2); static Range combineIgnoringNaN(Range range1, Range range2); static Range expandToInclude(Range range, double value); static Range expand(Range range,
                               double lowerMargin, double upperMargin); static Range shift(Range base, double delta); static Range shift(Range base, double delta,
                              boolean allowZeroCrossing); static Range scale(Range base, double factor); @Override boolean equals(Object obj); boolean isNaNRange(); @Override int hashCode(); @Override String toString(); }
Range implements Serializable { public static Range combine(Range range1, Range range2) { if (range1 == null) { return range2; } if (range2 == null) { return range1; } double l = Math.min(range1.getLowerBound(), range2.getLowerBound()); double u = Math.max(range1.getUpperBound(), range2.getUpperBound()); return new Range(l, u); } Range(double lower, double upper); double getLowerBound(); double getUpperBound(); double getLength(); double getCentralValue(); boolean contains(double value); boolean intersects(double b0, double b1); boolean intersects(Range range); double constrain(double value); static Range combine(Range range1, Range range2); static Range combineIgnoringNaN(Range range1, Range range2); static Range expandToInclude(Range range, double value); static Range expand(Range range,
                               double lowerMargin, double upperMargin); static Range shift(Range base, double delta); static Range shift(Range base, double delta,
                              boolean allowZeroCrossing); static Range scale(Range base, double factor); @Override boolean equals(Object obj); boolean isNaNRange(); @Override int hashCode(); @Override String toString();  }