Class VehiclesUnit

  • All Implemented Interfaces:
    Unit

    public class VehiclesUnit
    extends SimpleUnit
    Unit class for all vehicles related units. Since pcu to vehicle (and vice versa) is not a fixed conversion it is possible to set the conversion factor on this units class.
    Author:
    markr
    • Field Detail

      • DEFAULT_PCU_VEHICLE_MULTIPLIER

        public static final double DEFAULT_PCU_VEHICLE_MULTIPLIER
        Default multiplier for conversion from pcus to vehicles
        See Also:
        Constant Field Values
    • Constructor Detail

      • VehiclesUnit

        protected VehiclesUnit​(UnitType unitType)
        Constructor with default 1:1 conversion between vehicles and pcus
        Parameters:
        unitType - to use
    • Method Detail

      • convertPcuTo

        public static double convertPcuTo​(UnitType unitType,
                                          double value)
        Convert pcu to...
        Parameters:
        unitType - to use
        value - to convert
        Returns:
        converted value
      • convertVehiclesTo

        public static double convertVehiclesTo​(UnitType unitType,
                                               double value)
        Convert vehicles to...
        Parameters:
        unitType - to use
        value - to convert
        Returns:
        converted value
      • convertTo

        public double convertTo​(Unit to,
                                double value)
        Convert one unit to the other for a given value
        Parameters:
        to - to unit
        value - value to convert
        Returns:
        converted value
      • updatePcuToVehicleFactor

        public static void updatePcuToVehicleFactor​(double pcuToVehicleFactor)
        Update the pcu to vehicle conversion factor to use as it is not a fixed conversion
        Parameters:
        pcuToVehicleFactor - to use