@Test public void testConversionFactor() throws Exception { assertThat(SimpleUnit.getConversionFactor("m", "km")).isEqualTo(1 / 1000.0); assertThat(SimpleUnit.getConversionFactor("km", "m")).isEqualTo(1000.0); }
public static double getConversionFactor(String inputUnitString, String outputUnitString) throws IllegalArgumentException { SimpleUnit inputUnit = SimpleUnit.factory(inputUnitString); SimpleUnit outputUnit = SimpleUnit.factory(outputUnitString); return inputUnit.convertTo(1.0, outputUnit); }
SimpleUnit { public static double getConversionFactor(String inputUnitString, String outputUnitString) throws IllegalArgumentException { SimpleUnit inputUnit = SimpleUnit.factory(inputUnitString); SimpleUnit outputUnit = SimpleUnit.factory(outputUnitString); return inputUnit.convertTo(1.0, outputUnit); } }
SimpleUnit { public static double getConversionFactor(String inputUnitString, String outputUnitString) throws IllegalArgumentException { SimpleUnit inputUnit = SimpleUnit.factory(inputUnitString); SimpleUnit outputUnit = SimpleUnit.factory(outputUnitString); return inputUnit.convertTo(1.0, outputUnit); } protected  SimpleUnit();   SimpleUnit(ucar.units.Unit uu); }
SimpleUnit { public static double getConversionFactor(String inputUnitString, String outputUnitString) throws IllegalArgumentException { SimpleUnit inputUnit = SimpleUnit.factory(inputUnitString); SimpleUnit outputUnit = SimpleUnit.factory(outputUnitString); return inputUnit.convertTo(1.0, outputUnit); } protected  SimpleUnit();   SimpleUnit(ucar.units.Unit uu); static SimpleUnit factory(String name); static SimpleUnit factoryWithExceptions(String name); static boolean isCompatible(String unitString1, String unitString2); static boolean isCompatibleWithExceptions(String unitString1, String unitString2); static boolean isDateUnit(ucar.units.Unit uu); static boolean isTimeUnit(ucar.units.Unit uu); static boolean isDateUnit(String unitString); static boolean isTimeUnit(String unitString); static double getConversionFactor(String inputUnitString, String outputUnitString); String toString(); Unit getUnit(); double convertTo(double value, SimpleUnit outputUnit); boolean isCompatible(String unitString); boolean isUnknownUnit(); double getValue(); String getUnitString(); String getCanonicalString(); String getImplementingClass(); }
SimpleUnit { public static double getConversionFactor(String inputUnitString, String outputUnitString) throws IllegalArgumentException { SimpleUnit inputUnit = SimpleUnit.factory(inputUnitString); SimpleUnit outputUnit = SimpleUnit.factory(outputUnitString); return inputUnit.convertTo(1.0, outputUnit); } protected  SimpleUnit();   SimpleUnit(ucar.units.Unit uu); static SimpleUnit factory(String name); static SimpleUnit factoryWithExceptions(String name); static boolean isCompatible(String unitString1, String unitString2); static boolean isCompatibleWithExceptions(String unitString1, String unitString2); static boolean isDateUnit(ucar.units.Unit uu); static boolean isTimeUnit(ucar.units.Unit uu); static boolean isDateUnit(String unitString); static boolean isTimeUnit(String unitString); static double getConversionFactor(String inputUnitString, String outputUnitString); String toString(); Unit getUnit(); double convertTo(double value, SimpleUnit outputUnit); boolean isCompatible(String unitString); boolean isUnknownUnit(); double getValue(); String getUnitString(); String getCanonicalString(); String getImplementingClass(); static final SimpleUnit kmUnit; static final SimpleUnit meterUnit; static final SimpleUnit pressureUnit; }