org.ofbiz.service.calendar
Class TemporalExpressions.Frequency

java.lang.Object
  extended by org.ofbiz.service.calendar.TemporalExpression
      extended by org.ofbiz.service.calendar.TemporalExpressions.Frequency
All Implemented Interfaces:
java.io.Serializable, java.lang.Comparable<TemporalExpression>
Enclosing class:
TemporalExpressions

public static class TemporalExpressions.Frequency
extends TemporalExpression

A temporal expression that represents a frequency.

See Also:
Serialized Form

Field Summary
protected  int freqCount
           
protected  int freqType
           
protected  java.util.Date start
           
 
Fields inherited from class org.ofbiz.service.calendar.TemporalExpression
id, sequence, subSequence
 
Constructor Summary
TemporalExpressions.Frequency(java.util.Date start, int freqType, int freqCount)
           
 
Method Summary
 void accept(TemporalExpressionVisitor visitor)
          Handles a TemporalExpressionVisitor visit.
 boolean equals(java.lang.Object obj)
           
 java.util.Calendar first(java.util.Calendar cal)
          Returns a date representing the first occurrence of this expression on or after a specified date.
 int getFreqCount()
          Returns the frequency count of this expression.
 int getFreqType()
          Returns the frequency type of this expression.
 java.util.Date getStartDate()
          Returns the start date of this expression.
 boolean includesDate(java.util.Calendar cal)
          Returns true if this expression includes the specified date.
 java.util.Calendar next(java.util.Calendar cal)
          Returns a date representing the next occurrence of this expression after a specified date.
protected  java.util.Calendar prepareCal(java.util.Calendar cal)
           
 java.lang.String toString()
           
 
Methods inherited from class org.ofbiz.service.calendar.TemporalExpression
compareTo, containsExpression, getId, getRange, setId, setStartOfDay
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

start

protected final java.util.Date start

freqType

protected final int freqType

freqCount

protected final int freqCount
Constructor Detail

TemporalExpressions.Frequency

public TemporalExpressions.Frequency(java.util.Date start,
                                     int freqType,
                                     int freqCount)
Parameters:
start - Starting date, defaults to current system time
freqType - One of the following integer values: Calendar.SECOND Calendar.MINUTE Calendar.HOUR Calendar.DAY_OF_MONTH Calendar.MONTH Calendar.YEAR
freqCount - A positive integer
Method Detail

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

includesDate

public boolean includesDate(java.util.Calendar cal)
Description copied from class: TemporalExpression
Returns true if this expression includes the specified date.

Specified by:
includesDate in class TemporalExpression
Parameters:
cal - A date to evaluate
Returns:
true if this expression includes the date represented by cal

first

public java.util.Calendar first(java.util.Calendar cal)
Description copied from class: TemporalExpression
Returns a date representing the first occurrence of this expression on or after a specified date. Returns null if there is no matching date.

Specified by:
first in class TemporalExpression
Parameters:
cal - A date to evaluate
Returns:
A Calendar instance representing the first matching date, or null if no matching date is found

next

public java.util.Calendar next(java.util.Calendar cal)
Description copied from class: TemporalExpression
Returns a date representing the next occurrence of this expression after a specified date. Returns null if there is no matching date.

Specified by:
next in class TemporalExpression
Parameters:
cal - A date to evaluate
Returns:
A Calendar instance representing the first matching date, or null if no matching date is found

accept

public void accept(TemporalExpressionVisitor visitor)
Description copied from class: TemporalExpression
Handles a TemporalExpressionVisitor visit.

Specified by:
accept in class TemporalExpression

getStartDate

public java.util.Date getStartDate()
Returns the start date of this expression.

Returns:
The start date of this expression

getFreqType

public int getFreqType()
Returns the frequency type of this expression.

Returns:
The frequency type of this expression

getFreqCount

public int getFreqCount()
Returns the frequency count of this expression.

Returns:
The frequency count of this expression

prepareCal

protected java.util.Calendar prepareCal(java.util.Calendar cal)