Enum ETimeUnit

    • Enum Constant Detail

      • NANOSECONDS

        public static final ETimeUnit NANOSECONDS
        1/1000000000th of a second.
      • MICROSECONDS

        public static final ETimeUnit MICROSECONDS
        1/1000000th of a second.
      • MILLISECONDS

        public static final ETimeUnit MILLISECONDS
        1/1000th of a second.
      • SECONDS

        public static final ETimeUnit SECONDS
        One second.
      • MINUTES

        public static final ETimeUnit MINUTES
        60 seconds.
      • HOURS

        public static final ETimeUnit HOURS
        3600 seconds.
      • DAYS

        public static final ETimeUnit DAYS
        86400 seconds.
      • WEEKS

        public static final ETimeUnit WEEKS
        604800 seconds.
    • Method Detail

      • values

        public static ETimeUnit[] values()
        Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
        for (ETimeUnit c : ETimeUnit.values())
            System.out.println(c);
        
        Returns:
        an array containing the constants of this enum type, in the order they are declared
      • valueOf

        public static ETimeUnit valueOf​(String name)
        Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
        Parameters:
        name - the name of the enum constant to be returned.
        Returns:
        the enum constant with the specified name
        Throws:
        IllegalArgumentException - if this enum type has no constant with the specified name
        NullPointerException - if the argument is null
      • convertToBigDecimal

        public BigDecimal convertToBigDecimal​(long duration,
                                              ETimeUnit targetUnit,
                                              MathContext mathContext)
        Converts the given duration to the given unit.
        Parameters:
        duration - The duration to convert.
        targetUnit - The unit to convert to.
        mathContext - The math context to use for the division.
        Returns:
        The given duration expressed in the target unit.
      • convertToBigInt

        public BigInteger convertToBigInt​(long duration,
                                          ETimeUnit targetUnit)
        Converts the given duration to the given unit.
        Parameters:
        duration - The duration to convert.
        targetUnit - The unit to convert to.
        Returns:
        The given duration expressed in the target unit.
      • convertToDouble

        public double convertToDouble​(long duration,
                                      ETimeUnit targetUnit)
        Converts the given duration to the given unit.
        Parameters:
        duration - The duration to convert.
        targetUnit - The unit to convert to.
        Returns:
        The given duration expressed in the target unit.
      • convertToLong

        public long convertToLong​(long duration,
                                  ETimeUnit targetUnit)
        Converts the given duration to the given unit.
        Parameters:
        duration - The duration to convert.
        targetUnit - The unit to convert to.
        Returns:
        The given duration expressed in the target unit.
      • getDisplayName

        public String getDisplayName​(Locale locale)
        Description copied from interface: INamedUiElement
        The display name of this element in the given locale.
        Specified by:
        getDisplayName in interface INamedUiElement
        Parameters:
        locale - The locale to get the display name for.
        Returns:
        The display name of this element in the given locale.
      • scaleFactor

        public org.apache.commons.math3.fraction.Fraction scaleFactor()
        Gets the scale factor of this unit, i.e. the number of seconds in this unit.
        Returns:
        The scale factor of this unit.