Documentation of 'umontreal.iro.lecuyer.util.TimeUnit' Java class
TimeUnit
umontreal.iro.lecuyer.util

Enum TimeUnit

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Comparable<TimeUnit>


    public enum TimeUnit
    extends java.lang.Enum<TimeUnit>
    • Enum Constant Summary

      Enum Constants 
      Enum Constant and Description
      DAY
      Represents a day which has short name d.
      HOUR
      Represents an hour which has short name h.
      MICROSECOND
      Represents a microsecond which has short name us.
      MILLISECOND
      Represents a millisecond which has short name ms.
      MINUTE
      Represents a minute which has short name min.
      NANOSECOND
      Represents a nanosecond which has short name ns.
      SECOND
      Represents a second which has short name s.
      WEEK
      Represents a week which has short name w.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      static double convert(double value, TimeUnit srcUnit, TimeUnit dstUnit)
      Converts value expressed in time unit srcUnit to a time duration expressed in dstUnit and returns the result of the conversion.
      double getHours()
      Returns this time unit represented in hours.
      java.lang.String getLongName()
      Returns the long name of this time unit.
      java.lang.String getShortName()
      Returns the short name representing this unit in a string specifying a time duration.
      java.lang.String toString()
      static TimeUnit valueOf(java.lang.String name)
      Returns the enum constant of this type with the specified name.
      static TimeUnit[] values()
      Returns an array containing the constants of this enum type, in the order they are declared.
      • Methods inherited from class java.lang.Enum

        compareTo, equals, getDeclaringClass, hashCode, name, ordinal, valueOf
      • Methods inherited from class java.lang.Object

        getClass, notify, notifyAll, wait, wait, wait
    • Enum Constant Detail

      • NANOSECOND

        public static final TimeUnit NANOSECOND
        Represents a nanosecond which has short name ns.
      • MICROSECOND

        public static final TimeUnit MICROSECOND
        Represents a microsecond which has short name us.
      • MILLISECOND

        public static final TimeUnit MILLISECOND
        Represents a millisecond which has short name ms.
      • SECOND

        public static final TimeUnit SECOND
        Represents a second which has short name s.
      • MINUTE

        public static final TimeUnit MINUTE
        Represents a minute which has short name min.
      • HOUR

        public static final TimeUnit HOUR
        Represents an hour which has short name h.
      • DAY

        public static final TimeUnit DAY
        Represents a day which has short name d.
      • WEEK

        public static final TimeUnit WEEK
        Represents a week which has short name w.
    • Method Detail

      • values

        public static TimeUnit[] 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 (TimeUnit c : TimeUnit.values())
            System.out.println(c);
        
        Returns:
        an array containing the constants of this enum type, in the order they are declared
      • valueOf

        public static TimeUnit valueOf(java.lang.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:
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        java.lang.NullPointerException - if the argument is null
      • getShortName

        public java.lang.String getShortName()
        Returns the short name representing this unit in a string specifying a time duration.
        Returns:
        the short name of this time unit.
      • getLongName

        public java.lang.String getLongName()
        Returns the long name of this time unit.
        Returns:
        the long name of this time unit.
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Enum<TimeUnit>
        Returns:
        the result of getLongName.
      • getHours

        public double getHours()
        Returns this time unit represented in hours. This returns the number of hours corresponding to one unit.
        Returns:
        the time unit represented in hours.
      • convert

        public static double convert(double value,
                                     TimeUnit srcUnit,
                                     TimeUnit dstUnit)
        Converts value expressed in time unit srcUnit to a time duration expressed in dstUnit and returns the result of the conversion.
        Parameters:
        value - the value being converted.
        srcUnit - the source time unit.
        dstUnit - the destination time unit.
        Returns:
        the converted value.
        Throws:
        java.lang.NullPointerException - if srcUnit or dstUnit are null.

DMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.