Class TimeUnit

  • All Implemented Interfaces:
    Unit

    public class TimeUnit
    extends SimpleUnit
    Unit class for all time related units.
    Author:
    markr
    • Field Detail

      • HOUR_2_MINUTE

        public static final double HOUR_2_MINUTE
        hour to minute conversion multiplier
        See Also:
        Constant Field Values
      • MINUTE_2_HOUR

        public static final double MINUTE_2_HOUR
        minute to hour conversion multiplier
        See Also:
        Constant Field Values
      • MINUTE_2_SECOND

        public static final double MINUTE_2_SECOND
        minute to second conversion multiplier
        See Also:
        Constant Field Values
      • SECOND_2_MINUTE

        public static final double SECOND_2_MINUTE
        second to minute conversion multiplier
        See Also:
        Constant Field Values
      • HOUR_2_SECOND

        public static final double HOUR_2_SECOND
        hour to second conversion multiplier
        See Also:
        Constant Field Values
      • SECOND_2_HOUR

        public static final double SECOND_2_HOUR
        second to hour conversion multiplier
        See Also:
        Constant Field Values
    • Constructor Detail

      • TimeUnit

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

      • convertSecondTo

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

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

        public static double convertHourTo​(UnitType to,
                                           double value)
                                    throws PlanItException
        convert hour 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