org.obe.xpdl.model.misc
Class DurationUnit

java.lang.Object
  extended byorg.obe.util.AbstractEnum
      extended byorg.obe.xpdl.model.misc.DurationUnit
All Implemented Interfaces:
java.lang.Comparable, Enum, java.io.Serializable

public final class DurationUnit
extends AbstractEnum

Class which defines all duration units available. This class defines the following duration units:

Author:
Adrian Price
See Also:
Serialized Form

Field Summary
static DurationUnit DAY
           
static int DAY_INT
           
static DurationUnit DEFAULT
           
static DurationUnit HOUR
           
static int HOUR_INT
           
static DurationUnit MINUTE
           
static int MINUTE_INT
           
static DurationUnit MONTH
           
static int MONTH_INT
           
static DurationUnit SECOND
           
static int SECOND_INT
           
static java.util.List VALUES
           
static DurationUnit YEAR
           
static int YEAR_INT
           
 
Fields inherited from class org.obe.util.AbstractEnum
name, ordinal
 
Method Summary
 java.util.List family()
          Returns an immutable list of the members of the enumerated type.
 int getJDKCalendarField()
          Returns the integer code for the corresponding JDK Calendar field.
 long toMilliseconds()
          Converts the duration unit to milliseconds.
static DurationUnit valueOf(java.lang.String tag)
          Converts the specified type String to a DurationUnit object.
 
Methods inherited from class org.obe.util.AbstractEnum
clinit, clone, compareTo, equals, hashCode, readResolve, toString, value
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

SECOND_INT

public static final int SECOND_INT
See Also:
Constant Field Values

MINUTE_INT

public static final int MINUTE_INT
See Also:
Constant Field Values

HOUR_INT

public static final int HOUR_INT
See Also:
Constant Field Values

DAY_INT

public static final int DAY_INT
See Also:
Constant Field Values

MONTH_INT

public static final int MONTH_INT
See Also:
Constant Field Values

YEAR_INT

public static final int YEAR_INT
See Also:
Constant Field Values

SECOND

public static final DurationUnit SECOND

MINUTE

public static final DurationUnit MINUTE

HOUR

public static final DurationUnit HOUR

DAY

public static final DurationUnit DAY

MONTH

public static final DurationUnit MONTH

YEAR

public static final DurationUnit YEAR

DEFAULT

public static final DurationUnit DEFAULT

VALUES

public static final java.util.List VALUES
Method Detail

valueOf

public static DurationUnit valueOf(java.lang.String tag)
Converts the specified type String to a DurationUnit object. If the String cannot be converted to a DurationUnit then the value null is returned.

Parameters:
tag - The duration unit String
Returns:
A DurationUnit or null

getJDKCalendarField

public int getJDKCalendarField()
Returns the integer code for the corresponding JDK Calendar field. This value can be passed to the java.util.Calendar.add(int, int) method.

Returns:
One of the constants declared by the java.util.Calendar class.

toMilliseconds

public long toMilliseconds()
Converts the duration unit to milliseconds.

N.B. For duration units MONTH and YEAR this method returns only a rough approximation based on 30 days per month and 365 days per year respectively. Be wary of using the resulting milliseconds value for serious temporal computations.

Returns:
Duration unit value expressed milliseconds.

family

public java.util.List family()
Description copied from interface: Enum
Returns an immutable list of the members of the enumerated type.

Returns:
The family of allowed values.


SourceForge.net Logo OBE-1.0 Copyright (C) 2002-2006 Adrian Price. All Rights Reserved.