ABLE 2.0.0 07/02/2003 10:25:01

com.ibm.able.rules
Class AbleTimePeriod

java.lang.Object
  |
  +--com.ibm.able.rules.AbleTimePeriod
All Implemented Interfaces:
java.io.Serializable

public class AbleTimePeriod
extends java.lang.Object
implements java.io.Serializable

This class defines the Able time period built in data type. It is used to specify a time period with optional masks for Months of the year, days of the month, days of the week, and starting/ending time of day.

The masks follow the IETF Policy Framework TimePeriod Condition spec.

See Also:
Serialized Form

Field Summary
protected  long myDayOfMonthMask
          The Day of Month mask
protected  int myDayOfWeekMask
          The Day of Week mask
protected  java.util.Calendar myEndValue
          The ending date/time for this time period
protected  int myMonthMask
          The Month mask
protected  java.util.Calendar myStartValue
          The starting date/time for this time period.
protected  java.util.Calendar myTimeOfDayEndMask
          The Time of Day end mask
protected  java.util.Calendar myTimeOfDayStartMask
          The Time of Day start mask
 
Constructor Summary
AbleTimePeriod(java.util.Calendar theStartValue, java.util.Calendar theEndValue)
          Create a new time period instance over the specified range.
AbleTimePeriod(java.util.Calendar theStartValue, java.util.Calendar theEndValue, java.util.Calendar theTimeOfDayStartMask, java.util.Calendar theTimeOfDayEndMask)
          Create a new time period instance over the specified range.
AbleTimePeriod(java.util.Calendar theStartValue, java.util.Calendar theEndValue, int theMonthMask)
          Create a new time period instance over the specified range.
AbleTimePeriod(java.util.Calendar theStartValue, java.util.Calendar theEndValue, int theDayOfWeekMask, java.util.Calendar theTimeOfDayStartMask, java.util.Calendar theTimeOfDayEndMask)
          Create a new time period instance over the specified range.
AbleTimePeriod(java.util.Calendar theStartValue, java.util.Calendar theEndValue, int theMonthMask, int theDayOfWeekMask)
          Create a new time period instance over the specified range.
AbleTimePeriod(java.util.Calendar theStartValue, java.util.Calendar theEndValue, int theMonthMask, int theDayOfWeekMask, java.lang.String theTimeOfDayMask)
          Create a new time period instance over the specified range.
AbleTimePeriod(java.util.Calendar theStartValue, java.util.Calendar theEndValue, int theMonthMask, long theDayOfMonthMask)
          Create a new time period instance over the specified range.
AbleTimePeriod(java.util.Calendar theStartValue, java.util.Calendar theEndValue, int theMonthMask, long theDayOfMonthMask, int theDayOfWeekMask, java.util.Calendar theTimeOfDayStartMask, java.util.Calendar theTimeOfDayEndMask)
          Create a new time period instance over the specified range.
AbleTimePeriod(java.util.Calendar theStartValue, java.util.Calendar theEndValue, java.lang.String theTimeOfDayMask)
          Create a new time period instance over the specified range.
AbleTimePeriod(java.util.Calendar theStartValue, java.lang.String theEndValue)
          Create a new time period instance over the specified range.
AbleTimePeriod(java.lang.String theStartValue, java.util.Calendar theEndValue)
          Create a new time period instance over the specified range.
AbleTimePeriod(java.lang.String theTimePeriod, int theMonthMask, long theDayOfMonthMask, int theDayOfWeekMask, java.lang.String theTimeOfDayMask)
          Create a new time period instance over the specified range using IETF formatted Strings and Masks
AbleTimePeriod(java.lang.String theStartValue, java.lang.String theEndValue)
          Create a new time period instance over the specified range.
AbleTimePeriod(java.lang.String theStartValue, java.lang.String theEndValue, int theMonthMask)
          Create a new time period instance over the specified range.
AbleTimePeriod(java.lang.String theStartValue, java.lang.String theEndValue, int theMonthMask, int theDayOfWeekMask)
          Create a new time period instance over the specified range.
AbleTimePeriod(java.lang.String theStartValue, java.lang.String theEndValue, int theMonthMask, int theDayOfWeekMask, java.lang.String theTimeOfDayMask)
          Create a new time period instance over the specified range.
AbleTimePeriod(java.lang.String theStartValue, java.lang.String theEndValue, int theMonthMask, long theDayOfMonthMask)
          Create a new time period instance over the specified range.
AbleTimePeriod(java.lang.String theStartValue, java.lang.String theEndValue, int theMonthMask, long theDayOfMonthMask, int theDayOfWeekMask, java.util.Calendar theTimeOfDayStartMask, java.util.Calendar theTimeOfDayEndMask)
          Create a new time period instance over the specified range.
AbleTimePeriod(java.lang.String theStartValue, java.lang.String theEndValue, int theMonthMask, long theDayOfMonthMask, int theDayOfWeekMask, java.lang.String theTimeOfDayMask)
          Create a new time period instance over the specified range.
AbleTimePeriod(java.lang.String theStartValue, java.lang.String theEndValue, int theDayOfWeekMask, java.lang.String theTimeOfDayMask)
          Create a new time period instance over the specified range.
AbleTimePeriod(java.lang.String theStartValue, java.lang.String theEndValue, java.lang.String theTimeOfDayMask)
          Create a new time period instance over the specified range.
 
Method Summary
 boolean contains(java.util.Calendar theCurrentTime)
          Test to see if theCurrentTime (or simulated time) falls between the start and end date/times in this time period
protected  long getDayOfMonthBitMask(int theDayOfMonth)
           
 long getDayOfMonthMask()
           
protected  int getDayOfWeekBitMask(int theDayOfWeek)
           
 int getDayOfWeekMask()
           
protected  int getMonthBitMask(int theCalendarMonth)
           
 int getMonthMask()
           
 java.util.Calendar getTimeOfDayEndMask()
           
 java.util.Calendar getTimeOfDayStartMask()
           
 boolean isInDayOfMonth(java.util.Calendar theCurrentTime)
           
 boolean isInDayOfWeek(java.util.Calendar theCurrentTime)
           
 boolean isInMonth(java.util.Calendar theCurrentTime)
           
 boolean isInTimePeriod(java.util.Calendar theCurrentTime)
           
 java.util.BitSet setDayOfMonthMask(int theDayOfMonthMask)
          Set the day of the month mask for this time period
 java.util.BitSet setDayOfWeekMask(int theDayOfWeekMask)
          Set the day of week mask for this time period
 java.util.BitSet setMonthMask(int theMonthMask)
          Set the month mask for this time period
 void setTimeOfDayEndMask(java.util.Calendar theMaskValue)
          Set the end time mask for this time period
 void setTimeOfDayMask(java.util.Calendar theStartValue, java.util.Calendar theEndValue)
          Set the time of day mask for this time period
 void setTimeOfDayMask(java.lang.String theTimeOfDayMask)
          Set the time of day mask for this time period using IETF syntax
 void setTimeOfDayStartMask(java.util.Calendar theMaskValue)
          Set the start time mask for this time period
 void setTimePeriod(java.lang.String theTimePeriod)
          Set the time period using IETF syntax
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

myStartValue

protected java.util.Calendar myStartValue
The starting date/time for this time period.

myEndValue

protected java.util.Calendar myEndValue
The ending date/time for this time period

myMonthMask

protected int myMonthMask
The Month mask

myDayOfWeekMask

protected int myDayOfWeekMask
The Day of Week mask

myDayOfMonthMask

protected long myDayOfMonthMask
The Day of Month mask

myTimeOfDayStartMask

protected java.util.Calendar myTimeOfDayStartMask
The Time of Day start mask

myTimeOfDayEndMask

protected java.util.Calendar myTimeOfDayEndMask
The Time of Day end mask
Constructor Detail

AbleTimePeriod

public AbleTimePeriod(java.lang.String theTimePeriod,
                      int theMonthMask,
                      long theDayOfMonthMask,
                      int theDayOfWeekMask,
                      java.lang.String theTimeOfDayMask)
               throws java.text.ParseException
Create a new time period instance over the specified range using IETF formatted Strings and Masks
Parameters:
theTimePeriod - The starting and ending date/time for this time period encoded as a single string value of the form

"yyyymmddThhmmss/yyyymmddThhmmss"

theMonthOfYearMask - The subset of months to include in this time period

theDayOfMonthMask - The days of the month to include in this time period (1-31)

theDayOfWeekMask - The days of the week to include in this time period (1-7)

theTimeOfDayMask - The starting and ending time of day for this time period encoded as a single string value of the form

"Thhmmss/Thhmmss"


AbleTimePeriod

public AbleTimePeriod(java.util.Calendar theStartValue,
                      java.util.Calendar theEndValue)
Create a new time period instance over the specified range.
Parameters:
theStartValue - The Calendar starting date/time for this time period

theEndValue - The Calendar ending date/time for this time period.


AbleTimePeriod

public AbleTimePeriod(java.util.Calendar theStartValue,
                      java.lang.String theEndValue)
Create a new time period instance over the specified range.
Parameters:
theStartValue - The Calendar starting date/time for this time period

theEndValue - The String ending date/time for this time period.


AbleTimePeriod

public AbleTimePeriod(java.lang.String theStartValue,
                      java.lang.String theEndValue)
Create a new time period instance over the specified range.
Parameters:
theStartValue - The String starting date/time for this time period

theEndValue - The String ending date/time for this time period.


AbleTimePeriod

public AbleTimePeriod(java.lang.String theStartValue,
                      java.util.Calendar theEndValue)
Create a new time period instance over the specified range.
Parameters:
theStartValue - The String starting date/time for this time period

theEndValue - The String ending date/time for this time period.


AbleTimePeriod

public AbleTimePeriod(java.util.Calendar theStartValue,
                      java.util.Calendar theEndValue,
                      int theMonthMask)
Create a new time period instance over the specified range.
Parameters:
theStartValue - The Calendar starting date/time for this time period

theEndValue - The Calendar ending date/time for this time period.

theMonthMask - The int bitmask representing the subset of months to include in this time period

AbleTimePeriod

public AbleTimePeriod(java.lang.String theStartValue,
                      java.lang.String theEndValue,
                      int theMonthMask)
Create a new time period instance over the specified range.
Parameters:
theStartValue - The String starting date/time for this time period

theEndValue - The String ending date/time for this time period.

theMonthMask - The int bitmask representing the subset of months to include in this time period

AbleTimePeriod

public AbleTimePeriod(java.util.Calendar theStartValue,
                      java.util.Calendar theEndValue,
                      int theMonthMask,
                      long theDayOfMonthMask)
Create a new time period instance over the specified range.
Parameters:
theStartValue - The Calendar starting date/time for this time period

theEndValue - The Calendar ending date/time for this time period.

theMonthMask - The int bitmask representing the subset of months to include in this time period

theDayOfMonthMask - The long bitmask representing the days of the month to include in this time period

AbleTimePeriod

public AbleTimePeriod(java.lang.String theStartValue,
                      java.lang.String theEndValue,
                      int theMonthMask,
                      long theDayOfMonthMask)
Create a new time period instance over the specified range.
Parameters:
theStartValue - The Calendar starting date/time for this time period

theEndValue - The Calendar ending date/time for this time period.

theMonthMask - The int bitmask representing the subset of months to include in this time period

theDayOfMonthMask - The long bitmask representing the days of the month to include in this time period

AbleTimePeriod

public AbleTimePeriod(java.util.Calendar theStartValue,
                      java.util.Calendar theEndValue,
                      int theMonthMask,
                      int theDayOfWeekMask)
Create a new time period instance over the specified range.
Parameters:
theStartValue - The Calendar starting date/time for this time period

theEndValue - The Calendar ending date/time for this time period.

theMonthMask - The int bitmask representing the subset of months to include in this time period

theDayOfWeekMask - The int bitmask representing the days of the week to include in this time period

AbleTimePeriod

public AbleTimePeriod(java.lang.String theStartValue,
                      java.lang.String theEndValue,
                      int theMonthMask,
                      int theDayOfWeekMask)
Create a new time period instance over the specified range.
Parameters:
theStartValue - The starting date/time for this time period

theEndValue - The ending date/time for this time period.

theMonthMask - The subset of months to include in this time period

theDayOfMonthMask - The days of the month to include in this time period (1-31)

theDayOfWeekMask - The days of the week to include in this time period (1-7)

AbleTimePeriod

public AbleTimePeriod(java.util.Calendar theStartValue,
                      java.util.Calendar theEndValue,
                      int theMonthMask,
                      int theDayOfWeekMask,
                      java.lang.String theTimeOfDayMask)
               throws java.text.ParseException
Create a new time period instance over the specified range.
Parameters:
theStartValue - The Calendar starting date/time for this time period

theEndValue - The Calendar ending date/time for this time period.

theMonthMask - The int bitmask representing the subset of months to include in this time period

theDayOfWeekMask - The int bitmask representing the days of the week to include in this time period

AbleTimePeriod

public AbleTimePeriod(java.lang.String theStartValue,
                      java.lang.String theEndValue,
                      int theMonthMask,
                      int theDayOfWeekMask,
                      java.lang.String theTimeOfDayMask)
               throws java.text.ParseException
Create a new time period instance over the specified range.
Parameters:
theStartValue - The starting date/time for this time period

theEndValue - The ending date/time for this time period.

theMonthMask - The subset of months to include in this time period

theDayOfMonthMask - The days of the month to include in this time period (1-31)

theDayOfWeekMask - The days of the week to include in this time period (1-7)

AbleTimePeriod

public AbleTimePeriod(java.util.Calendar theStartValue,
                      java.util.Calendar theEndValue,
                      int theMonthMask,
                      long theDayOfMonthMask,
                      int theDayOfWeekMask,
                      java.util.Calendar theTimeOfDayStartMask,
                      java.util.Calendar theTimeOfDayEndMask)
Create a new time period instance over the specified range.
Parameters:
theStartValue - The starting date/time for this time period

theEndValue - The ending date/time for this time period.

theMonthMask - The subset of months to include in this time period

theDayOfMonthMask - The days of the month to include in this time period (1-31)

theDayOfWeekMask - The days of the week to include in this time period (1-7)

theTimeOfDayStartMask - The time of day to include in this period

theTimeofDayEndMask - The end of day to include in this period

AbleTimePeriod

public AbleTimePeriod(java.lang.String theStartValue,
                      java.lang.String theEndValue,
                      int theMonthMask,
                      long theDayOfMonthMask,
                      int theDayOfWeekMask,
                      java.util.Calendar theTimeOfDayStartMask,
                      java.util.Calendar theTimeOfDayEndMask)
Create a new time period instance over the specified range.
Parameters:
theStartValue - The starting date/time for this time period

theEndValue - The ending date/time for this time period.

theMonthMask - The subset of months to include in this time period

theDayOfMonthMask - The days of the month to include in this time period (1-31)

theDayOfWeekMask - The days of the week to include in this time period (1-7)

theTimeOfDayStartMask - The time of day to include in this period

theTimeofDayEndMask - The end of day to include in this period

AbleTimePeriod

public AbleTimePeriod(java.lang.String theStartValue,
                      java.lang.String theEndValue,
                      int theMonthMask,
                      long theDayOfMonthMask,
                      int theDayOfWeekMask,
                      java.lang.String theTimeOfDayMask)
               throws java.text.ParseException
Create a new time period instance over the specified range.
Parameters:
theStartValue - The starting date/time for this time period

theEndValue - The ending date/time for this time period.

theMonthMask - The subset of months to include in this time period

theDayOfMonthMask - The days of the month to include in this time period (1-31)

theDayOfWeekMask - The days of the week to include in this time period (1-7)

theTimeOfDayMask - The time of day to include in this period


AbleTimePeriod

public AbleTimePeriod(java.lang.String theStartValue,
                      java.lang.String theEndValue,
                      int theDayOfWeekMask,
                      java.lang.String theTimeOfDayMask)
               throws java.text.ParseException
Create a new time period instance over the specified range.
Parameters:
theStartValue - The starting date/time for this time period

theEndValue - The ending date/time for this time period.

theDayOfWeekMask - The days of the week to include in this time period (1-7)

theTimeOfDayStartMask - The time of day to include in this period

theTimeofDayEndMask - The end of day to include in this period

AbleTimePeriod

public AbleTimePeriod(java.util.Calendar theStartValue,
                      java.util.Calendar theEndValue,
                      int theDayOfWeekMask,
                      java.util.Calendar theTimeOfDayStartMask,
                      java.util.Calendar theTimeOfDayEndMask)
Create a new time period instance over the specified range.
Parameters:
theStartValue - The starting date/time for this time period

theEndValue - The ending date/time for this time period.

theDayOfWeekMask - The days of the week to include in this time period (1-7)

theTimeOfDayStartMask - The time of day to include in this period

theTimeofDayEndMask - The end of day to include in this period

AbleTimePeriod

public AbleTimePeriod(java.util.Calendar theStartValue,
                      java.util.Calendar theEndValue,
                      java.util.Calendar theTimeOfDayStartMask,
                      java.util.Calendar theTimeOfDayEndMask)
Create a new time period instance over the specified range.
Parameters:
theStartValue - The starting date/time for this time period

theEndValue - The ending date/time for this time period.

theTimeOfDayStartMask - The time of day to include in this period

theTimeofDayEndMask - The end of day to include in this period

AbleTimePeriod

public AbleTimePeriod(java.util.Calendar theStartValue,
                      java.util.Calendar theEndValue,
                      java.lang.String theTimeOfDayMask)
               throws java.text.ParseException
Create a new time period instance over the specified range.
Parameters:
theStartValue - The starting date/time for this time period

theEndValue - The ending date/time for this time period.

theTimeOfDayMask - The String representation of the time of day to include in this period Format is "Thhmmss/Thhmmss" as in the IETF Policy Framework spec


AbleTimePeriod

public AbleTimePeriod(java.lang.String theStartValue,
                      java.lang.String theEndValue,
                      java.lang.String theTimeOfDayMask)
               throws java.text.ParseException
Create a new time period instance over the specified range.
Parameters:
theStartValue - The starting date/time for this time period

theEndValue - The ending date/time for this time period.

theTimeOfDayMask - The String representation of the time of day to include in this period Format is "Thhmmss/Thhmmss" as in the IETF Policy Framework spec

Method Detail

setMonthMask

public java.util.BitSet setMonthMask(int theMonthMask)
Set the month mask for this time period
Parameters:
theMonthMask - The bitmapped int indicating which months are to be included in this time period Note: LSB = Jan (0), MSB = Dec (11)

getMonthMask

public int getMonthMask()

setDayOfMonthMask

public java.util.BitSet setDayOfMonthMask(int theDayOfMonthMask)
Set the day of the month mask for this time period
Parameters:
theDayOfMonthMask - The bitmapped int indicating which days in the month are to be included in this time period Note: LSB (0) is day 1, MSB(31) is day 31

getDayOfMonthMask

public long getDayOfMonthMask()

setDayOfWeekMask

public java.util.BitSet setDayOfWeekMask(int theDayOfWeekMask)
Set the day of week mask for this time period
Parameters:
theDayOfWeekMask - The bitmapped int indicating the days of the week which are to be included in this time period Note: LSB (0) = Monday

getDayOfWeekMask

public int getDayOfWeekMask()

setTimeOfDayStartMask

public void setTimeOfDayStartMask(java.util.Calendar theMaskValue)
Set the start time mask for this time period
Parameters:
theMaskValue - The Date object indicating the start time for this time period

getTimeOfDayStartMask

public java.util.Calendar getTimeOfDayStartMask()

setTimeOfDayEndMask

public void setTimeOfDayEndMask(java.util.Calendar theMaskValue)
Set the end time mask for this time period
Parameters:
theMaskValue - The Date object indicating the end time for this time period

getTimeOfDayEndMask

public java.util.Calendar getTimeOfDayEndMask()

setTimeOfDayMask

public void setTimeOfDayMask(java.util.Calendar theStartValue,
                             java.util.Calendar theEndValue)
Set the time of day mask for this time period
Parameters:
theTimeofDayMask - The start and end times to be included in this time period

setTimeOfDayMask

public void setTimeOfDayMask(java.lang.String theTimeOfDayMask)
                      throws java.text.ParseException
Set the time of day mask for this time period using IETF syntax

Format = "Thhmmss/Thhmmss" or optionally "hh:mm:ss AM/hh:mm:ss PM"

Parameters:
theTimeofDayMask - The start and end times to be included in this time period

setTimePeriod

public void setTimePeriod(java.lang.String theTimePeriod)
                   throws java.text.ParseException
Set the time period using IETF syntax

Format = "yyyymmddThhmmss/yyyymmddThhmmss"

Parameters:
theTimePeriod - The start and end dates and times in a single string formatted per IETF specs

isInTimePeriod

public boolean isInTimePeriod(java.util.Calendar theCurrentTime)

isInMonth

public boolean isInMonth(java.util.Calendar theCurrentTime)

isInDayOfWeek

public boolean isInDayOfWeek(java.util.Calendar theCurrentTime)

isInDayOfMonth

public boolean isInDayOfMonth(java.util.Calendar theCurrentTime)

contains

public boolean contains(java.util.Calendar theCurrentTime)
Test to see if theCurrentTime (or simulated time) falls between the start and end date/times in this time period
Returns:
true if theCurrentTime is contained in this time period

getMonthBitMask

protected int getMonthBitMask(int theCalendarMonth)

getDayOfWeekBitMask

protected int getDayOfWeekBitMask(int theDayOfWeek)

getDayOfMonthBitMask

protected long getDayOfMonthBitMask(int theDayOfMonth)

ABLE 2.0.0 07/02/2003 10:25:01

(C) Copyright IBM Corporation 1999, 2003