org.hackystat.utilities.time.interval
Class IntervalUtility

java.lang.Object
  extended by org.hackystat.utilities.time.interval.IntervalUtility

 class IntervalUtility
extends java.lang.Object

Provides support for constants and methods in the interval selector.

Author:
Hongbing Kou, Philip Johnson

Method Summary
 java.lang.String getCurrentDay()
          Gets current day string.
 java.lang.String getCurrentMonth()
          Gets current month value.
 java.lang.String getCurrentWeek()
          Gets current week string.
 java.lang.String getCurrentYear()
          Gets current year value in the year options.
 Day getDay(java.lang.String yearString, java.lang.String monthString, java.lang.String dayString)
          Get day object from year, month and day strings.
 java.util.TreeMap<java.lang.String,java.lang.String> getDayOptions()
          Gets map of days.
static IntervalUtility getInstance()
          Gets the singleton interval utility class.
 java.util.TreeMap<java.lang.String,java.lang.String> getMonthOptions()
          Gets map of months.
 Week getWeek(java.lang.String weekString)
          Returns a Week instance given a week string.
 java.util.TreeMap<java.lang.String,java.lang.String> getWeekOptions()
          Gets map of weeks.
 java.util.TreeMap<java.lang.String,java.lang.String> getYearOptions()
          Gets map of years.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getWeek

public Week getWeek(java.lang.String weekString)
Returns a Week instance given a week string. The week string will be something like "11-Jan-2004 to 17-Jan-2004". Test cases always pass an English locale-based string, so this method will first try to parse the string using the current locale, then try to parse it using Locale.US, then fail if neither works.

Parameters:
weekString - Week string from the week selector.
Returns:
Week object represented by the week string.

getYearOptions

public java.util.TreeMap<java.lang.String,java.lang.String> getYearOptions()
Gets map of years.

Returns:
TreeMap of the year.

getMonthOptions

public java.util.TreeMap<java.lang.String,java.lang.String> getMonthOptions()
Gets map of months.

Returns:
TreeMap of the months.

getWeekOptions

public java.util.TreeMap<java.lang.String,java.lang.String> getWeekOptions()
Gets map of weeks.

Returns:
TreeMap of the past 26 weeks.

getDayOptions

public java.util.TreeMap<java.lang.String,java.lang.String> getDayOptions()
Gets map of days.

Returns:
TreeMap of the days in a month.

getInstance

public static IntervalUtility getInstance()
Gets the singleton interval utility class.

Returns:
Singleton interval utility object.

getDay

public Day getDay(java.lang.String yearString,
                  java.lang.String monthString,
                  java.lang.String dayString)
Get day object from year, month and day strings.

Parameters:
yearString - Year string in format '2004'.
monthString - Month string in format '00', '02', '20' etc.
dayString - Day string in '12', '02' etc.
Returns:
Day object.

getCurrentYear

public java.lang.String getCurrentYear()
Gets current year value in the year options.

Returns:
Current year string.

getCurrentMonth

public java.lang.String getCurrentMonth()
Gets current month value.

Returns:
Current month string.

getCurrentDay

public java.lang.String getCurrentDay()
Gets current day string.

Returns:
Current day string.

getCurrentWeek

public java.lang.String getCurrentWeek()
Gets current week string.

Returns:
Current week