flux
Interface TimeExpression

All Superinterfaces:
java.io.Serializable
All Known Subinterfaces:
Cron, CronForLoop, CronOr, Relative

public interface TimeExpression
extends java.io.Serializable

Represents a time specification.

Author:
Copyright 2014 Flux Corporation. All rights reserved.

Method Summary
 void accept(java.lang.String timeExpression)
          Clears any existing time expression information and uses timeExpression as the basis for any future operations.
 AllowableBusinessInterval getBusinessInterval()
          Returns the optional business interval associated with this time expression.
 java.util.TimeZone getTimeZone()
          Returns the time zone associated with this time expression.
 java.util.Date next()
          Returns the next date that satisfies the constraints of this Time Expression.
 java.util.Date next(java.util.Date after)
          Returns the next date that satisfies the constraints of this Time Expression; the next date comes strictly after the specified date.
 void reset()
          Clears any existing time expression information.
 void setBusinessInterval(AllowableBusinessInterval businessInterval)
          Registers a Business Interval with this time expression, which is consulted when the time expression is evaluated, that is, when next() and next(Date) are called.
 void setTimeZone(java.util.TimeZone timeZone)
          Sets the time zone associated with this time expression.
 

Method Detail

accept

void accept(java.lang.String timeExpression)
            throws EngineException
Clears any existing time expression information and uses timeExpression as the basis for any future operations.

Parameters:
timeExpression - The time expression to use as a base.
Throws:
EngineException - If the time expression is illegal.

getBusinessInterval

AllowableBusinessInterval getBusinessInterval()
Returns the optional business interval associated with this time expression.

Returns:
The optional Business Calendar.

getTimeZone

java.util.TimeZone getTimeZone()
Returns the time zone associated with this time expression.

Returns:
The time zone associated with this time expression.

next

java.util.Date next()
                    throws EngineException
Returns the next date that satisfies the constraints of this Time Expression. The first time this method (or a similar method, such as Cron.previous()) is called, it will generate a date relative to the current time. However, on subsequent calls, this method generates a date relative to the date last returned by this method (or a similar method).

For example, consider the following code.

 Date d1 = myTimeExpression.next();
 Date d2 = myTimeExpression.next();
 
In the above code, the first call evaluates a time expression relative to the current time. The result is stored in d1. The second call evaluates a time expression relative to d1 and stores the result in d2.

Returns:
The next date that satisfies the constraints of this Time Expression.
Throws:
EngineException - If the time expression does not evaluate correctly.
See Also:
next(Date)

next

java.util.Date next(java.util.Date after)
                    throws EngineException
Returns the next date that satisfies the constraints of this Time Expression; the next date comes strictly after the specified date. When this method is called, it will generate a date relative to the specified date.

For example, consider the following code.

 Date d2 = myTimeExpression.next(d1);
 Date d3 = myTimeExpression.next();
 
In the above code, the first call evaluates a time expression relative to d1. The result is stored in d2. The second call evaluates a Time Expression relative to d2 and stores the result in d3.

Parameters:
after - The result is strictly later this date.
Returns:
The next date that satisfies the constraints of this Time Expression.
Throws:
EngineException - if the time expression does not evaluate correctly.

reset

void reset()
Clears any existing time expression information.


setBusinessInterval

void setBusinessInterval(AllowableBusinessInterval businessInterval)
Registers a Business Interval with this time expression, which is consulted when the time expression is evaluated, that is, when next() and next(Date) are called.

Parameters:
businessInterval - The BusinessInterval to register.

setTimeZone

void setTimeZone(java.util.TimeZone timeZone)
Sets the time zone associated with this time expression.

Parameters:
timeZone - The time zone associated with this time expression.


© 2014 Flux Corporation. All rights reserved.