org.pfsw.text
Enum TimeUnit

java.lang.Object
  extended by java.lang.Enum<TimeUnit>
      extended by org.pfsw.text.TimeUnit
All Implemented Interfaces:
java.io.Serializable, java.lang.Comparable<TimeUnit>

public enum TimeUnit
extends java.lang.Enum<TimeUnit>

This enum provides several time units with an associated factor useful to calculate the milliseconds from a time value given in a different time unit.


Enum Constant Summary
HOURS
           
MILLISECONDS
           
MINUTES
           
SECONDS
           
 
Method Summary
 java.lang.String getLongName()
          Returns the string long name of the unit.
 long getMsFactor()
          Returns the multiplication factor for this unit to convert a corresponding value to milliseconds.
 java.lang.String getShortName()
          Returns the string short name of the unit.
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
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Enum Constant Detail

MILLISECONDS

public static final TimeUnit MILLISECONDS

SECONDS

public static final TimeUnit SECONDS

MINUTES

public static final TimeUnit MINUTES

HOURS

public static final TimeUnit HOURS
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

getLongName

public java.lang.String getLongName()
Returns the string long name of the unit.


getShortName

public java.lang.String getShortName()
Returns the string short name of the unit.


getMsFactor

public long getMsFactor()
Returns the multiplication factor for this unit to convert a corresponding value to milliseconds.