@Test public void testTime() throws Exception { double out; out = Dimensions.convert(60.0, Dimensions.Dim.SEC, Dimensions.Dim.MINUTE); assertTrue(Math.abs(out - 1.0) < 0.0001); out = Dimensions.convert(3600.0, Dimensions.Dim.SEC, Dimensions.Dim.HOUR); assertTrue(Math.abs(out - 1.0) < 0.0001); }
public static double convert(double value, Dim fromDimention, Dim toDimention) { if (fromDimention.type != toDimention.type) { throw new IllegalArgumentException("To dimension and from dimension must be equal while converting."); } return conversionRatios.get(fromDimention) / conversionRatios.get(toDimention) * value; }
Dimensions { public static double convert(double value, Dim fromDimention, Dim toDimention) { if (fromDimention.type != toDimention.type) { throw new IllegalArgumentException("To dimension and from dimension must be equal while converting."); } return conversionRatios.get(fromDimention) / conversionRatios.get(toDimention) * value; } }
Dimensions { public static double convert(double value, Dim fromDimention, Dim toDimention) { if (fromDimention.type != toDimention.type) { throw new IllegalArgumentException("To dimension and from dimension must be equal while converting."); } return conversionRatios.get(fromDimention) / conversionRatios.get(toDimention) * value; }  }
Dimensions { public static double convert(double value, Dim fromDimention, Dim toDimention) { if (fromDimention.type != toDimention.type) { throw new IllegalArgumentException("To dimension and from dimension must be equal while converting."); } return conversionRatios.get(fromDimention) / conversionRatios.get(toDimention) * value; }  static ObservableList<Item> getList(final Type dimType); static int getIndex(final Type dimType, Dim dimension); static double convert(double value, Dim fromDimention, Dim toDimention); }
Dimensions { public static double convert(double value, Dim fromDimention, Dim toDimention) { if (fromDimention.type != toDimention.type) { throw new IllegalArgumentException("To dimension and from dimension must be equal while converting."); } return conversionRatios.get(fromDimention) / conversionRatios.get(toDimention) * value; }  static ObservableList<Item> getList(final Type dimType); static int getIndex(final Type dimType, Dim dimension); static double convert(double value, Dim fromDimention, Dim toDimention);  }