com.melloware.jukes.util
Class TimeSpanUnit

java.lang.Object
  extended by com.melloware.jukes.util.TimeSpanUnit

public final class TimeSpanUnit
extends Object

The TimeSpanUnit defines a standard set of units to be used with the TimeSpan class. The methods of the TimeSpan class require the use of TimeSpanUnit objects for certain methods. The purpose of this class is to provide a typesafe enum. (see java.util.logging.Level for an example from the Java API.)

The TimeSpanUnit objects are:

Author:
Thomas Paul

Field Summary
static TimeSpanUnit DAYS
          DAYS indicates that days are being used
static TimeSpanUnit HOURS
          HOURS indicates that hours are being used
static TimeSpanUnit MILLISECONDS
          MILLISECONDS indicates that milliseconds are being used
static TimeSpanUnit MINUTES
          MINUTES indicates that minutes are being used
static TimeSpanUnit SECONDS
          SECONDS indicates that seconds are being used
 
Method Summary
 boolean equals(Object aObj)
           
 int getName()
          Gets the name of this TimeSpanUnit.
 int getValue()
          Gets the number of milliseconds this TimeSpanUnit represents.
 int hashCode()
          Returns a hash code value for the object.
 String toString()
          Returns a string representation of the object in the format "name:value"
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

MILLISECONDS

public static final TimeSpanUnit MILLISECONDS
MILLISECONDS indicates that milliseconds are being used


SECONDS

public static final TimeSpanUnit SECONDS
SECONDS indicates that seconds are being used


MINUTES

public static final TimeSpanUnit MINUTES
MINUTES indicates that minutes are being used


HOURS

public static final TimeSpanUnit HOURS
HOURS indicates that hours are being used


DAYS

public static final TimeSpanUnit DAYS
DAYS indicates that days are being used

Method Detail

getName

public int getName()
Gets the name of this TimeSpanUnit.

Returns:
the name of this TimeSpanUnit.

getValue

public int getValue()
Gets the number of milliseconds this TimeSpanUnit represents.

Returns:
the number of milliseconds.

hashCode

public int hashCode()
Returns a hash code value for the object. This method is supported for the benefit of hashtables such as those provided by java.util.Hashtable. The method returns the value of the TimeSpanUnit.

Overrides:
hashCode in class Object
Returns:
a hash code value for this object.
See Also:
Object.equals(java.lang.Object), Hashtable

toString

public String toString()
Returns a string representation of the object in the format "name:value"

Overrides:
toString in class Object
Returns:
a string containing the name and value of this TimeSpanUnit object.

equals

public boolean equals(Object aObj)
Overrides:
equals in class Object


Copyright © 1999-2010 Melloware Inc. All Rights Reserved.