flux
Interface BusinessIntervalFactory


public interface BusinessIntervalFactory

Creates and manipulates BusinessInterval objects.

Author:
Copyright 2014 Flux Corporation. All rights reserved.

Method Summary
 BusinessInterval makeBusinessInterval(java.lang.String name)
          Returns a new BusinessInterval with the specified name.
 flux.dev.BusinessIntervalComponent makeBusinessIntervalForDay(java.lang.String name, java.util.Date day)
          Returns a new BusinessIntervalComponent that represents a single calendar day.
 flux.dev.BusinessIntervalComponent makeBusinessIntervalForDay(java.lang.String name, java.util.Date day, java.lang.String repeatTimeExpression)
          Returns a new BusinessIntervalComponent that represents an all day interval that repeats according to repeatTimeExpression.
 flux.dev.BusinessIntervalComponent makeBusinessIntervalForever()
          Returns a new BusinessIntervalComponent that represents all time.
 flux.dev.BusinessIntervalComponent makeBusinessIntervalForRange(java.lang.String name, java.util.Date start, java.util.Date stop, java.lang.String duration, java.lang.String repeatTimeExpression, int count)
          Returns a new BusinessIntervalComponent that represents an interval with an arbitrary duration, starting at the specified start date (inclusive), ending at the specified end date (exclusive), and repeating according to repeatTimeExpression for the specified number of times.
 flux.dev.BusinessIntervalComponent makeBusinessIntervalForRange(java.lang.String name, java.util.Date start, java.lang.String duration, java.lang.String repeatTimeExpression)
          Returns a new BusinessIntervalComponent that represents an interval with an arbitrary duration, starting at the specified start date (inclusive), and repeating according to repeatTimeExpression.
 BusinessInterval makeCustomBusinessInterval(flux.dev.AllowableBusinessIntervalDev customBusinessInterval)
          Creates a custom BusinessInterval from an AllowableBusinessIntervalDev object.
 BusinessInterval makeDifference(BusinessInterval left, BusinessInterval right)
          Performs the set operation "difference" on the intervals, "left difference right".
 BusinessInterval makeDifference(java.lang.String name, BusinessInterval left, BusinessInterval right)
          Performs the set operation "difference" on the intervals, "left difference right".
 BusinessInterval makeFridayWeekend()
          Returns a pre-defined business interval that excludes Fridays.
 BusinessInterval makeIntersection(BusinessInterval left, BusinessInterval right)
          Performs the set operation "intersection" on the intervals, "left intersection right".
 BusinessInterval makeIntersection(java.lang.String name, BusinessInterval left, BusinessInterval right)
          Performs the set operation "intersection" on the intervals, "left intersection right".
 BusinessInterval makeSaturdaySundayWeekend()
          Returns a business interval that excludes Saturdays and Sundays.
 BusinessInterval makeSaturdayWeekend()
          Returns a pre-defined business interval that excludes Saturdays.
 BusinessInterval makeSundayWeekend()
          Returns a pre-defined business interval that excludes Sundays.
 BusinessInterval makeUnion(BusinessInterval left, BusinessInterval right)
          Performs the set operation "union" on the intervals, "left union right".
 BusinessInterval makeUnion(java.lang.String name, BusinessInterval left, BusinessInterval right)
          Performs the set operation "union" on the intervals, "left union right".
 BusinessInterval makeUsFederalHolidays()
          Returns a pre-defined business interval that excludes federal holidays in the United States.
 

Method Detail

makeBusinessInterval

BusinessInterval makeBusinessInterval(java.lang.String name)
Returns a new BusinessInterval with the specified name.

Parameters:
name - The name of the new BusinessInterval.
Returns:
A new BusinessInterval with the specified name.

makeBusinessIntervalForDay

flux.dev.BusinessIntervalComponent makeBusinessIntervalForDay(java.lang.String name,
                                                              java.util.Date day)
                                                              throws EngineException
Returns a new BusinessIntervalComponent that represents a single calendar day. This method is equivalent to calling makeBusinessIntervalForRange(name, start, "+1d", "+1d") as long as the "start" argument represents the beginning of a calendar day.

Parameters:
name - The name of the component.
day - The starting calendar day. The time component of day is ignored.
Returns:
A new BusinessIntervalComponent.
Throws:
EngineException - If day is null.

makeBusinessIntervalForDay

flux.dev.BusinessIntervalComponent makeBusinessIntervalForDay(java.lang.String name,
                                                              java.util.Date day,
                                                              java.lang.String repeatTimeExpression)
                                                              throws EngineException
Returns a new BusinessIntervalComponent that represents an all day interval that repeats according to repeatTimeExpression. This method is equivalent to calling makeBusinessIntervalForRange(name, start, "+1d", repeatTimeExpression) as long as the "start" argument represents the beginning of a calendar day and "repeatTimeExpression" represents a whole number of days.

Parameters:
name - The name of the component.
day - The starting calendar day. The time component of day is ignored.
repeatTimeExpression - Applied to start to determine the start of the next interval.
Returns:
A new BusinessIntervalComponent.
Throws:
EngineException - If repeatTimeExpression is an invalid time expression.

makeBusinessIntervalForever

flux.dev.BusinessIntervalComponent makeBusinessIntervalForever()
Returns a new BusinessIntervalComponent that represents all time. More accurately, the result spans all time from the epoch (1970 January 1 00:00:00.000) until infinity.

Returns:
A new BusinessIntervalComponent that represents all time.

makeBusinessIntervalForRange

flux.dev.BusinessIntervalComponent makeBusinessIntervalForRange(java.lang.String name,
                                                                java.util.Date start,
                                                                java.util.Date stop,
                                                                java.lang.String duration,
                                                                java.lang.String repeatTimeExpression,
                                                                int count)
                                                                throws EngineException
Returns a new BusinessIntervalComponent that represents an interval with an arbitrary duration, starting at the specified start date (inclusive), ending at the specified end date (exclusive), and repeating according to repeatTimeExpression for the specified number of times.

Parameters:
name - The name of the component.
start - The starting date (inclusive).
stop - The date when this interval is no longer applied (exclusive).
duration - The duration of one interval.
repeatTimeExpression - Applied to start to determine the start of the next interval.
count - The repeat count.
Returns:
A new BusinessIntervalComponent.
Throws:
EngineException - If repeatTimeExpression is an invalid time expression.

makeBusinessIntervalForRange

flux.dev.BusinessIntervalComponent makeBusinessIntervalForRange(java.lang.String name,
                                                                java.util.Date start,
                                                                java.lang.String duration,
                                                                java.lang.String repeatTimeExpression)
                                                                throws EngineException
Returns a new BusinessIntervalComponent that represents an interval with an arbitrary duration, starting at the specified start date (inclusive), and repeating according to repeatTimeExpression.

Parameters:
name - The name of the component.
start - The starting date (inclusive).
duration - The duration of one interval.
repeatTimeExpression - Applied to start to determine the start of the next interval.
Returns:
A new BusinessIntervalComponent.
Throws:
EngineException - If repeatTimeExpression is an invalid time expression.

makeCustomBusinessInterval

BusinessInterval makeCustomBusinessInterval(flux.dev.AllowableBusinessIntervalDev customBusinessInterval)
Creates a custom BusinessInterval from an AllowableBusinessIntervalDev object. The custom business interval is invoked to test whether dates occur in allowable business intervals. This custom interval can be used to contact other software systems that may contain business intervals, business calendars, and other holiday information.

The new BusinessInterval can have additional times included and excluded from business processing using the BusinessInterval methods. Using this technique, a custom business interval can be combined with the built-in BusinessInterval functionality.

Parameters:
customBusinessInterval - A custom business interval for calling out to external software systems for business interval, calendar, and holiday information.
Returns:
The new custom business interval.

makeDifference

BusinessInterval makeDifference(BusinessInterval left,
                                BusinessInterval right)
Performs the set operation "difference" on the intervals, "left difference right". The result is a new interval that contains all spans of time that are in the left operand but not in the right operand. Neither operand is modified. The name of the result is "<left> difference <right>".

Parameters:
left - The left operand.
right - The right operand.
Returns:
The interval resulting from "left difference right".

makeDifference

BusinessInterval makeDifference(java.lang.String name,
                                BusinessInterval left,
                                BusinessInterval right)
Performs the set operation "difference" on the intervals, "left difference right". The result is a new interval that contains all spans of time that are in the left operand but not in the right operand. Neither operand is modified.

Parameters:
name - The name of the result interval.
left - The left operand.
right - The right operand.
Returns:
The interval resulting from "left difference right".

makeIntersection

BusinessInterval makeIntersection(BusinessInterval left,
                                  BusinessInterval right)
Performs the set operation "intersection" on the intervals, "left intersection right". The result is a new interval that contains all spans of time that are in the left operand and the right operand. Neither operand is modified. The name of the result is "<left> intersection <right>".

Parameters:
left - The left operand.
right - The right operand.
Returns:
The interval resulting from "left intersection right".

makeIntersection

BusinessInterval makeIntersection(java.lang.String name,
                                  BusinessInterval left,
                                  BusinessInterval right)
Performs the set operation "intersection" on the intervals, "left intersection right". The result is a new interval that contains all spans of time that are in the left operand and the right operand. Neither operand is modified.

Parameters:
name - The name of the result interval.
left - The left operand.
right - The right operand.
Returns:
The interval resulting from "left intersection right".

makeFridayWeekend

BusinessInterval makeFridayWeekend()
Returns a pre-defined business interval that excludes Fridays.

Returns:
A pre-defined business interval that excludes Fridays.

makeSaturdayWeekend

BusinessInterval makeSaturdayWeekend()
Returns a pre-defined business interval that excludes Saturdays.

Returns:
A pre-defined business interval that excludes Saturdays.

makeSaturdaySundayWeekend

BusinessInterval makeSaturdaySundayWeekend()
Returns a business interval that excludes Saturdays and Sundays.

Returns:
A pre-defined business interval that excludes Saturdays and Sundays.

makeSundayWeekend

BusinessInterval makeSundayWeekend()
Returns a pre-defined business interval that excludes Sundays.

Returns:
A pre-defined business interval that excludes Sundays.

makeUnion

BusinessInterval makeUnion(BusinessInterval left,
                           BusinessInterval right)
Performs the set operation "union" on the intervals, "left union right". The result is a new interval that contains all spans of time that are in the left operand or the right operand. Neither operand is modified. The name of the result is "<left> union <right>".

Parameters:
left - The left operand.
right - The right operand.
Returns:
The interval resulting from "left union right".

makeUnion

BusinessInterval makeUnion(java.lang.String name,
                           BusinessInterval left,
                           BusinessInterval right)
Performs the set operation "union" on the intervals, "left union right". The result is a new interval that contains all spans of time that are in the left operand or the right operand. Neither operand is modified.

Parameters:
name - The name of the result interval.
left - The left operand.
right - The right operand.
Returns:
The interval resulting from "left union right".

makeUsFederalHolidays

BusinessInterval makeUsFederalHolidays()
Returns a pre-defined business interval that excludes federal holidays in the United States.

New Year's Day. 1 January. If the day falls on Saturday, back up to Friday. If the day falls on Sunday, move forward to Monday. The name of this holiday is "New Year's Day", so it can be removed by calling BusinessInterval.remove("New Year's Day").

Martin Luther King Day. Third Monday of January. The name of this holiday is "Martin Luther King Day", so it can be removed by calling BusinessInterval.remove("Martin Luther King Day").

Presidents' Day. Third Monday of February. The name of this holiday is "Presidents' Day", so it can be removed by calling BusinessInterval.remove("Presidents' Day").

Memorial Day. Last Monday of May. The name of this holiday is "Memorial Day", so it can be removed by calling BusinessInterval.remove("Memorial Day").

Independence Day. 4 July. If the day falls on Saturday, back up to Friday. If the day falls on Sunday, move forward to Monday. The name of this holiday is "Independence Day", so it can be removed by calling BusinessInterval.remove("Independence Day").

Labor Day. First Monday in September. The name of this holiday is "Labor Day", so it can be removed by calling BusinessInterval.remove("Labor Day").

Columbus Day. First Monday in October. The name of this holiday is "Columbus Day", so it can be removed by calling BusinessInterval.remove("Columbus Day").

Veterans Day. 11 November. If the day falls on Saturday, back up to Friday. If the day falls on Sunday, move forward to Monday. The name of this holiday is "Veterans Day", so it can be removed by calling BusinessInterval.remove("Veterans Day").

Thanksgiving. Fourth Thursday in November. The name of this holiday is "Thanksgiving Day", so it can be removed by calling BusinessInterval.remove("Thanksgiving Day").

Christmas. 25 December. If the day falls on Saturday, back up to Friday. If the day falls on Sunday, move forward to Monday. The name of this holiday is "Christmas Day", so it can be removed by calling BusinessInterval.remove("Christmas Day").

Returns:
A pre-defined business interval that excludes federal holidays in the United States.


© 2014 Flux Corporation. All rights reserved.