org.codehaus.mojo.dashboard.report.plugin.utils
Class TimePeriod

java.lang.Object
  extended by org.codehaus.mojo.dashboard.report.plugin.utils.TimePeriod
All Implemented Interfaces:
java.lang.Comparable

public class TimePeriod
extends java.lang.Object
implements java.lang.Comparable

Used to set the time period of the analysis.

Version:
0.1
Author:
Karim REFEYTON

Field Summary
static TimePeriod DAY
          1 day time period.
static TimePeriod HOUR
          1 hour time period.
static TimePeriod MINUTE
          1 minute time period.
static TimePeriod MONTH
          1 month time period.
static TimePeriod WEEK
          1 week time period.
 
Method Summary
 int compareTo(java.lang.Object anotherPeriod)
          Compare two periods.
 java.text.SimpleDateFormat getDateFormat()
          Return the date format.
 java.lang.String getName()
          Return the period name.
static TimePeriod getPeriod(java.lang.String name)
          Return the period associated to the specified name.
 java.util.Date normalize(java.util.Date date)
          Normalize the specified date with current date format.
 java.lang.String normalizeToString(java.util.Date date)
          Format the specified date to String.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MINUTE

public static final TimePeriod MINUTE
1 minute time period.


HOUR

public static final TimePeriod HOUR
1 hour time period.


DAY

public static final TimePeriod DAY
1 day time period.


WEEK

public static final TimePeriod WEEK
1 week time period.


MONTH

public static final TimePeriod MONTH
1 month time period.

Method Detail

getDateFormat

public java.text.SimpleDateFormat getDateFormat()
Return the date format.

Returns:
Date format.

getName

public java.lang.String getName()
Return the period name.

Returns:
Period name.

normalize

public java.util.Date normalize(java.util.Date date)
Normalize the specified date with current date format.

Parameters:
date - Date to normalize
Returns:
Normalized date.

normalizeToString

public java.lang.String normalizeToString(java.util.Date date)
Format the specified date to String.

Parameters:
date - Date to format
Returns:
Formatted date.

getPeriod

public static TimePeriod getPeriod(java.lang.String name)
Return the period associated to the specified name.

Parameters:
name - Period name
Returns:
Period

compareTo

public int compareTo(java.lang.Object anotherPeriod)
Compare two periods. Return 0 if the current period is equal to the specified period; a value lower than 0 if the period is lower than the specified period; a value greater than 0 if the period is greater than the specified period.

Specified by:
compareTo in interface java.lang.Comparable
Parameters:
anotherPeriod - The period to be compared.
Returns:
0 if this equals the other period; < 0 if lower; > 0 if greater.
See Also:
Comparable.compareTo(java.lang.Object)


Copyright © 2006-2009 CodeHaus. All Rights Reserved.