Package javax.measure.converter

Examples of javax.measure.converter.UnitConverter.inverse()


            final double expected, final Unit<Q> unitExpected,
            final double actual,   final Unit<Q> unitActual)
    {
        UnitConverter converter = unitActual.getConverterTo(unitExpected);
        assertEquals(expected, converter.convert(actual), 1E-6);
        converter = converter.inverse();
        assertEquals(actual, converter.convert(expected), 1E-6);
    }

    /**
     * Checks the conversions using {@link Units#SEXAGESIMAL_DMS}.
View Full Code Here


        UnitConverter candidate = INTEGER;
        for (int i=0; i<4; i++) {
            switch (i) {
                case 0break; // Do nothing since candidate is already set to INTEGER.
                case 1// Fallthrough
                case 3:  candidate = candidate.inverse(); break;
                case 2:  candidate = FRACTIONAL; break;
            }
            if (equals(candidate)) {
                return candidate;
            }
View Full Code Here

            final double expected, final Unit<Q> unitExpected,
            final double actual,   final Unit<Q> unitActual)
    {
        UnitConverter converter = unitActual.getConverterTo(unitExpected);
        assertEquals(expected, converter.convert(actual), 1E-6);
        converter = converter.inverse();
        assertEquals(actual, converter.convert(expected), 1E-6);
    }

    /**
     * Checks the conversions using {@link Units#SEXAGESIMAL_DMS}.
View Full Code Here

        UnitConverter candidate = INTEGER;
        for (int i=0; i<=3; i++) {
            switch (i) {
                case 0break; // Do nothing since candidate is already set to INTEGER/
                case 2:  candidate = FRACTIONAL; break;
                default: candidate = candidate.inverse(); break;
            }
            if (equals(candidate)) {
                return candidate;
            }
        }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.