Package org.goplanit.utils.unit
Class VehiclesUnit
- java.lang.Object
-
- org.goplanit.utils.unit.SimpleUnit
-
- org.goplanit.utils.unit.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 Summary
Fields Modifier and Type Field Description static double
DEFAULT_PCU_VEHICLE_MULTIPLIER
Default multiplier for conversion from pcus to vehicles-
Fields inherited from class org.goplanit.utils.unit.SimpleUnit
unitType
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
VehiclesUnit(UnitType unitType)
Constructor with default 1:1 conversion between vehicles and pcus
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static double
convertPcuTo(UnitType unitType, double value)
Convert pcu to...double
convertTo(Unit to, double value)
Convert one unit to the other for a given valuestatic double
convertVehiclesTo(UnitType unitType, double value)
Convert vehicles to...static void
updatePcuToVehicleFactor(double pcuToVehicleFactor)
Update the pcu to vehicle conversion factor to use as it is not a fixed conversion-
Methods inherited from class org.goplanit.utils.unit.SimpleUnit
canConvertTo, equals, isCombinedUnit, toString
-
-
-
-
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 usevalue
- to convert- Returns:
- converted value
-
convertVehiclesTo
public static double convertVehiclesTo(UnitType unitType, double value)
Convert vehicles to...- Parameters:
unitType
- to usevalue
- 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 unitvalue
- 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
-
-