RangeFactory.create(200, 201))); Assert.assertEquals(t0.transform(0.5), 200.5, 0.0); Assert.assertTrue(t0.contains(0.5)); Assert.assertTrue(t0.contains(RangeFactory.create(0.1, 0.9))); Assert.assertFalse(t0.contains(1.5)); Assert.assertFalse(t0.contains(RangeFactory.create(0.1, 1.9))); Assert.assertTrue(t0.equals(t0)); Assert.assertEquals(
/** * Transforms the specified value. * * @param value The value to transform. * @return the transformed value. * @throws TransformationException if the value can't be transformed. */ public synchronized double transform(double value) throws TransformationException { if (transform == null) throw new IllegalStateException(); if (contains(value)) return transform.transform(value); throw new IllegalArgumentException("Provided value is not contained in this domain"); }
/** * Transforms the specified value. * * @param value The value to transform. * @return the transformed value. * @throws TransformationException if the value can't be transformed. */ public synchronized double transform(double value) throws TransformationException { if (transform == null) throw new IllegalStateException(); if (contains(value)) return transform.transform(value); throw new IllegalArgumentException("Provided value is not contained in this domain"); }
RangeFactory.create(200, true, 201, true))); Assert.assertEquals(t0.transform(0.5), 200.5, 0.0); Assert.assertTrue(t0.contains(0.5)); Assert.assertTrue(t0.contains(RangeFactory.create(0.1, true, 0.9, true, false))); Assert.assertFalse(t0.contains(1.5)); Assert.assertFalse(t0.contains(RangeFactory.create(0.1, true, 1.9, true, false))); Assert.assertTrue(t0.equals(t0)); Assert.assertEquals(t0.inverse().transform(200.5), 0.5, 0.0);