3, e0.inverse().transform(new Position(0), null).getOrdinatePosition(), 0);
Assert.assertEquals(p0.transform(new Position(0.5), null).getOrdinatePosition(), 0.5, 0.0); Assert.assertEquals( p0.inverse().transform(new Position(0.5), null).getOrdinatePosition(), 0.5, 0.0); p1.transform(new Position(123.5), null).getOrdinatePosition(), 123.5, 0.0); Assert.assertEquals( p1.inverse().transform(new Position(657.5), null).getOrdinatePosition(), 657.5, 0.0);
t0.transform(new Position(0.5), null).getOrdinatePosition(), 200.5, 0.0); Assert.assertEquals( t0.inverse().transform(new Position(200.5), null).getOrdinatePosition(), 0.5, 0.0); t0.transform(new Position(0.5), null).getOrdinatePosition(), 200.5, 0.0); Assert.assertEquals( t0.inverse().transform(new Position(200.5), null).getOrdinatePosition(), 0.5, 0.0);
/** * 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"); }
Assert.assertEquals(p0.inverse(), SingleDimensionTransformation.IDENTITY); Assert.assertEquals(p0.transform(0.5), 0.5, 0.0); Assert.assertEquals(p0.inverse().transform(0.5), 0.5, 0.0); Assert.assertTrue(p0.transform(0.6) == 0.6); Assert.assertEquals(p1.transform(111.5), 111.5, 0.0); Assert.assertEquals(p1.transform(123.5), 123.5, 0.0); Assert.assertEquals(p1.inverse().transform(657.5), 657.5, 0.0); Assert.assertTrue(p1.transform(0.6) == 0.6);
Assert.assertEquals(3, e0.inverse().transform(new Position(0), null).getOrdinatePosition(), 0);
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); RangeFactory.create(200, true, 202, true)))); Assert.assertEquals(t0.transform(0.5), 200.5, 0.0); Assert.assertEquals(t0.inverse().transform(200.5), 0.5, 0.0);