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 Period.Level

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

public static enum Period.Level
extends java.lang.Enum<Period.Level>

The known levels.

Version:
$Revision: 1685 $
Author:
Daniel Dietz

Enum Constant Summary
END
          Last hour/day, day/week, day/month or day/year - 23:59:59.999.
START
          First hour/day, day/week, day/month or day/year - 00:00:00.000.
 
Method Summary
static java.util.GregorianCalendar level(long millis, Period period, Period.Level level)
          Takes a given reference-time-stamp in milliseconds and levels it to the start/end of the given period to either the first millisecond of the period or the last millisecond of the period according to the given level.
static Period.Level valueOf(java.lang.String name)
          Returns the enum constant of this type with the specified name.
static Period.Level[] 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

END

public static final Period.Level END
Last hour/day, day/week, day/month or day/year - 23:59:59.999.


START

public static final Period.Level START
First hour/day, day/week, day/month or day/year - 00:00:00.000.

Method Detail

values

public static final Period.Level[] 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(Period.Level c : Period.Level.values())
        System.out.println(c);

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

valueOf

public static Period.Level 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

level

public static java.util.GregorianCalendar level(long millis, Period period, Period.Level level)
Takes a given reference-time-stamp in milliseconds and levels it to the start/end of the given period to either the first millisecond of the period or the last millisecond of the period according to the given level.

Parameters:
millis - the reference-date in milliseconds
period - the Period
level -
  • Period.Level.START for levelling the GregorianCalendar down to 00:00:00.000
  • Period.Level.END for levelling the GregorianCalendar up to 23:59:59.999
Returns:
a levelled GregorianCalendar for the given reference-time-stamp and time-zone "UTC"