Class MeasureConverter

java.lang.Object
overit.geocall.util.measure.MeasureConverter
All Implemented Interfaces:
Serializable

public class MeasureConverter extends Object implements Serializable
This class aims to make conversions between units measurement.
To convert a value it's mandatory to defines an origin unit and a destination unit, between which you want to make the conversion.
See for example get(overit.geocall.util.measure.distances.Distances, overit.geocall.util.measure.distances.Distances) and convert(java.lang.Double)
See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    convert(Double value)
    Makes the conversion from the origin unit measurement value to the destination unit measurement.
    get(Distances originUnit, Distances destUnit)
    Gets the MeasureConverter object with which make the conversion between originUnit and destUnit of the distances category.
    For example, to convert from kilometers to miles, this method would have to be used like: MeasureConverter.get(Distances.KILOMETERS,Distances.MILES);
    get(Temperatures originUnit, Temperatures destUnit)
    Gets the MeasureConverter object with which make the conversion between originUnit and destUnit of the temperatures category.
    For example, to convert from celsius to kelvin, this method would have to be used like: MeasureConverter.get(Temperatures.CELSIUS,temperatures.KELVIN);
    get(Weights originUnit, Weights destUnit)
    Gets the MeasureConverter object with which make the conversion between originUnit and destUnit of the weights category.
    For example, to convert from kilograms to pounds, this method would have to be used like: MeasureConverter.get(Weights.KILOGRAMS,Weights.POUNDS);

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • get

      public static MeasureConverter get(Distances originUnit, Distances destUnit)
      Gets the MeasureConverter object with which make the conversion between originUnit and destUnit of the distances category.
      For example, to convert from kilometers to miles, this method would have to be used like: MeasureConverter.get(Distances.KILOMETERS,Distances.MILES);
      Parameters:
      originUnit - The origin unit measurement.
      destUnit - The destination unit measurement desired.
      Returns:
      The MeasureConverter object with which make the conversion between originUnit and destUnit of the distances category.
    • get

      public static MeasureConverter get(Weights originUnit, Weights destUnit)
      Gets the MeasureConverter object with which make the conversion between originUnit and destUnit of the weights category.
      For example, to convert from kilograms to pounds, this method would have to be used like: MeasureConverter.get(Weights.KILOGRAMS,Weights.POUNDS);
      Parameters:
      originUnit - The origin unit measurement.
      destUnit - The destination unit measurement desired.
      Returns:
      The MeasureConverter object with which make the conversion between originUnit and destUnit of the weights category.
    • get

      public static MeasureConverter get(Temperatures originUnit, Temperatures destUnit)
      Gets the MeasureConverter object with which make the conversion between originUnit and destUnit of the temperatures category.
      For example, to convert from celsius to kelvin, this method would have to be used like: MeasureConverter.get(Temperatures.CELSIUS,temperatures.KELVIN);
      Parameters:
      originUnit - The origin unit measurement.
      destUnit - The destination unit measurement desired.
      Returns:
      The MeasureConverter object with which make the conversion between originUnit and destUnit of the temperatures category.
    • convert

      public Double convert(Double value)
      Makes the conversion from the origin unit measurement value to the destination unit measurement.
      Parameters:
      value - The value to convert.
      Returns:
      The converted value.