org.opengts.db
Class WorkHours

java.lang.Object
  extended by org.opengts.db.WorkHours

public class WorkHours
extends java.lang.Object


Nested Class Summary
static class WorkHours.Day
          Day
 
Field Summary
static int DAYS_IN_WEEK
           
static java.lang.String DFT
           
static java.lang.String[] DOW_NAME
           
static java.lang.String FRI
           
static char HOUR_MINUTE_SEPARATOR_CHAR
           
static java.lang.String MON
           
static java.lang.String PROP_WorkHours_includeHourMinuteSeparator
           
static java.lang.String PROP_WorkHours_minuteInterval
           
static java.lang.String SAT
           
static java.lang.String SUN
           
static java.lang.String THU
           
static char TIMERANGE_SEPARATOR_CHAR
           
static java.lang.String TUE
           
static java.lang.String WED
           
 
Constructor Summary
WorkHours(RTConfig.PropertyGetter dayRTP)
          Constructor
WorkHours(RTConfig.PropertyGetter dayRTP, java.lang.String keyPrefix)
          Constructor
WorkHours(java.lang.String keyPrefix)
          Deprecated. (currently only required for legacy ENRE interface)
WorkHours(WorkHours.Day[] day)
          Constructor
 
Method Summary
 double countWorkHours(DateTime startDT, DateTime stopDT, java.util.TimeZone tz)
          Accumulate all work-hour time between the specified dates
static java.lang.String formatTOD(int tod, boolean inclSep)
          Return formated String for specified time-of-day
 WorkHours.Day getDay(DateTime dateTime)
          Return the requested Day
 WorkHours.Day getDay(DateTime dateTime, java.util.TimeZone tz)
          Return the requested Day
 WorkHours.Day getDay(int dow)
          Return the requested Day
 WorkHours.Day getDay(long timestamp, java.util.TimeZone tz)
          Return the requested Day
 RTProperties getProperties()
          Returns the WorkHours instance as an RTProperties
 boolean isMatch(DateTime dateTime)
          True if the specified DateTime is within the current 'WorkingHours'
 boolean isMatch(DateTime dateTime, java.util.TimeZone tz)
          True if the specified DateTime is within the current 'WorkingHours'
 boolean isMatch(int dow, int tod)
          True if the specified time-of-day is within the current 'WorkingHours'
 boolean isMatch(long timestamp, java.util.TimeZone tz)
          True if the specified DateTime is within the current 'WorkingHours'
static void main(java.lang.String[] argv)
           
 java.lang.String toString()
          Returns a String repreentation of this instance
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DAYS_IN_WEEK

public static final int DAYS_IN_WEEK
See Also:
Constant Field Values

DFT

public static final java.lang.String DFT
See Also:
Constant Field Values

SUN

public static final java.lang.String SUN
See Also:
Constant Field Values

MON

public static final java.lang.String MON
See Also:
Constant Field Values

TUE

public static final java.lang.String TUE
See Also:
Constant Field Values

WED

public static final java.lang.String WED
See Also:
Constant Field Values

THU

public static final java.lang.String THU
See Also:
Constant Field Values

FRI

public static final java.lang.String FRI
See Also:
Constant Field Values

SAT

public static final java.lang.String SAT
See Also:
Constant Field Values

DOW_NAME

public static final java.lang.String[] DOW_NAME

PROP_WorkHours_minuteInterval

public static final java.lang.String PROP_WorkHours_minuteInterval
See Also:
Constant Field Values

PROP_WorkHours_includeHourMinuteSeparator

public static final java.lang.String PROP_WorkHours_includeHourMinuteSeparator
See Also:
Constant Field Values

TIMERANGE_SEPARATOR_CHAR

public static final char TIMERANGE_SEPARATOR_CHAR
See Also:
Constant Field Values

HOUR_MINUTE_SEPARATOR_CHAR

public static final char HOUR_MINUTE_SEPARATOR_CHAR
See Also:
Constant Field Values
Constructor Detail

WorkHours

public WorkHours(WorkHours.Day[] day)
Constructor


WorkHours

public WorkHours(RTConfig.PropertyGetter dayRTP)
Constructor


WorkHours

public WorkHours(RTConfig.PropertyGetter dayRTP,
                 java.lang.String keyPrefix)
Constructor


WorkHours

@Deprecated
public WorkHours(java.lang.String keyPrefix)
Deprecated. (currently only required for legacy ENRE interface)

Constructor

Parameters:
keyPrefix - Property key prefix
Method Detail

formatTOD

public static java.lang.String formatTOD(int tod,
                                         boolean inclSep)
Return formated String for specified time-of-day


getDay

public WorkHours.Day getDay(int dow)
Return the requested Day


getDay

public WorkHours.Day getDay(DateTime dateTime)
Return the requested Day


getDay

public WorkHours.Day getDay(DateTime dateTime,
                            java.util.TimeZone tz)
Return the requested Day


getDay

public WorkHours.Day getDay(long timestamp,
                            java.util.TimeZone tz)
Return the requested Day


isMatch

public boolean isMatch(DateTime dateTime)
True if the specified DateTime is within the current 'WorkingHours'


isMatch

public boolean isMatch(DateTime dateTime,
                       java.util.TimeZone tz)
True if the specified DateTime is within the current 'WorkingHours'


isMatch

public boolean isMatch(long timestamp,
                       java.util.TimeZone tz)
True if the specified DateTime is within the current 'WorkingHours'


isMatch

public boolean isMatch(int dow,
                       int tod)
True if the specified time-of-day is within the current 'WorkingHours'


countWorkHours

public double countWorkHours(DateTime startDT,
                             DateTime stopDT,
                             java.util.TimeZone tz)
Accumulate all work-hour time between the specified dates


getProperties

public RTProperties getProperties()
Returns the WorkHours instance as an RTProperties

Returns:
The WorkHours instance as an RTProperties

toString

public java.lang.String toString()
Returns a String repreentation of this instance

Overrides:
toString in class java.lang.Object

main

public static void main(java.lang.String[] argv)