@Test public void testContinuousNumberRange() { final ContinuousRange<Double> range1 = new ContinuousRange<Double>(Double.class, 0.0d, 100.0d, true, true); assertTrue(range1.inRange(3.0)); assertTrue(range1.inRange(0.0)); assertTrue(range1.inRange(100.0)); assertFalse(range1.inRange(200.0)); assertFalse(range1.inRange(100.001)); assertFalse(range1.inRange(-1.2)); final ContinuousRange<Double> range2 = new ContinuousRange<Double>(Double.class, 0.0d, 100.0d, false, false); assertFalse(range2.inRange(0.0)); assertFalse(range2.inRange(100.0)); final ContinuousRange<Double> range3 = new ContinuousRange<Double>(Double.class, 0.0d, 100.0d, false, true); assertFalse(range3.inRange(0.0)); assertTrue(range3.inRange(100.0)); final ContinuousRange<Double> range4 = new ContinuousRange<Double>(Double.class, 0.0d, 100.0d, true, false); assertTrue(range4.inRange(0.0)); assertFalse(range4.inRange(100.0)); final ContinuousRange<Color> colorRange = new ContinuousRange<Color>(Color.class, Color.BLACK, Color.yellow, false, false); assertTrue(colorRange.inRange(new Color(10, 100, 10))); }
@Override public boolean inRange(T value) { if(value instanceof Number && min instanceof Number && max instanceof Number) { return validateNumber((Number)value, (Number)min, (Number)max); } else { return true; } }
ContinuousRange implements Range<T> { @Override public boolean inRange(T value) { if(value instanceof Number && min instanceof Number && max instanceof Number) { return validateNumber((Number)value, (Number)min, (Number)max); } else { return true; } } }
ContinuousRange implements Range<T> { @Override public boolean inRange(T value) { if(value instanceof Number && min instanceof Number && max instanceof Number) { return validateNumber((Number)value, (Number)min, (Number)max); } else { return true; } } ContinuousRange(final Class<T> type, final T min, final T max, final Boolean includeMin, final Boolean includeMax); }
ContinuousRange implements Range<T> { @Override public boolean inRange(T value) { if(value instanceof Number && min instanceof Number && max instanceof Number) { return validateNumber((Number)value, (Number)min, (Number)max); } else { return true; } } ContinuousRange(final Class<T> type, final T min, final T max, final Boolean includeMin, final Boolean includeMax); @Override Class<T> getType(); @Override boolean isDiscrete(); T getMin(); T getMax(); boolean includeMin(); boolean includeMax(); @Override boolean inRange(T value); }
ContinuousRange implements Range<T> { @Override public boolean inRange(T value) { if(value instanceof Number && min instanceof Number && max instanceof Number) { return validateNumber((Number)value, (Number)min, (Number)max); } else { return true; } } ContinuousRange(final Class<T> type, final T min, final T max, final Boolean includeMin, final Boolean includeMax); @Override Class<T> getType(); @Override boolean isDiscrete(); T getMin(); T getMax(); boolean includeMin(); boolean includeMax(); @Override boolean inRange(T value);  }