Class DistanceUnit

  • All Implemented Interfaces:
    Unit

    public class DistanceUnit
    extends SimpleUnit
    Unit class for all distance related units
    Author:
    markr
    • Constructor Detail

      • DistanceUnit

        protected DistanceUnit​(UnitType unitType)
        Constructor
        Parameters:
        unitType - to use
    • Method Detail

      • convertMeterTo

        public static double convertMeterTo​(UnitType to,
                                            double value)
                                     throws PlanItException
        convert meter to...
        Parameters:
        to - to unit
        value - to convert
        Returns:
        converted value
        Throws:
        PlanItException - thrown if error
      • convertKmTo

        public static double convertKmTo​(UnitType to,
                                         double value)
                                  throws PlanItException
        convert km to...
        Parameters:
        to - to unit
        value - to convert
        Returns:
        converted value
        Throws:
        PlanItException - thrown if error
      • convertTo

        public double convertTo​(Unit to,
                                double value)
                         throws PlanItException
        Convert one unit to the other for a given value
        Parameters:
        to - to unit
        value - value to convert
        Returns:
        converted value
        Throws:
        PlanItException - thrown if not possible to perform conversion