pulse - the web application framework Get pulse at SourceForge.net. Fast, secure and Free Open Source software downloads Ohloh project report for pulse-java

org.torweg.pulse.util.time
Enum MillisecondConstant

java.lang.Object
  extended by java.lang.Enum<MillisecondConstant>
      extended by org.torweg.pulse.util.time.MillisecondConstant
All Implemented Interfaces:
java.io.Serializable, java.lang.Comparable<MillisecondConstant>

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

Defines millisecond constants for:

Version:
$Revision: 1417 $
Author:
Daniel Dietz

Nested Class Summary
static class MillisecondConstant.ScrollDirection
          Defines constants for scroll-direction as used by MillisecondConstant.scroll(long, MillisecondConstant, ScrollDirection) .
 
Enum Constant Summary
DAY
          A day (HOUR * 24).
FIFTEEN_MINUTE
          Fifteen minutes (MINUTE * 15).
HALF_HOUR
          A half hour (MINUTE * 30).
HOUR
          An hour (MINUTE * 60).
MINUTE
          A minute (SECOND * 60).
MONTH_30
          A month with 30 days (DAY * 30).
SECOND
          A second (1000L).
WEEK
          A week (DAY * 7).
YEAR_365
          A year with 365 days (DAY * 365).
 
Method Summary
 long getValue()
          Returns the value.
static long scroll(long v, MillisecondConstant constant, MillisecondConstant.ScrollDirection direction)
          "Scrolls" the given long-value by the given MillisecondConstant and the given ScrollDirection.
static MillisecondConstant valueOf(java.lang.String name)
          Returns the enum constant of this type with the specified name.
static MillisecondConstant[] values()
          Returns an array containing the constants of this enum type, in the order they're declared.
 
Methods inherited from class java.lang.Enum
clone, compareTo, equals, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Enum Constant Detail

SECOND

public static final MillisecondConstant SECOND
A second (1000L).


MINUTE

public static final MillisecondConstant MINUTE
A minute (SECOND * 60).


FIFTEEN_MINUTE

public static final MillisecondConstant FIFTEEN_MINUTE
Fifteen minutes (MINUTE * 15).


HALF_HOUR

public static final MillisecondConstant HALF_HOUR
A half hour (MINUTE * 30).


HOUR

public static final MillisecondConstant HOUR
An hour (MINUTE * 60).


DAY

public static final MillisecondConstant DAY
A day (HOUR * 24).


WEEK

public static final MillisecondConstant WEEK
A week (DAY * 7).


MONTH_30

public static final MillisecondConstant MONTH_30
A month with 30 days (DAY * 30).


YEAR_365

public static final MillisecondConstant YEAR_365
A year with 365 days (DAY * 365).

Method Detail

values

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

Returns:
an array containing the constants of this enum type, in the order they're declared

valueOf

public static MillisecondConstant 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

getValue

public long getValue()
Returns the value.

Returns:
the value

scroll

public static long scroll(long v, MillisecondConstant constant, MillisecondConstant.ScrollDirection direction)
"Scrolls" the given long-value by the given MillisecondConstant and the given ScrollDirection.

Parameters:
v - the long
constant - the MillisecondConstant
direction - the ScrollDirection
Returns:
the "scrolled" value