Class TemporalExpression
java.lang.Object
org.apache.ofbiz.service.calendar.TemporalExpression
- All Implemented Interfaces:
Serializable
,Comparable<TemporalExpression>
- Direct Known Subclasses:
RecurrenceInfo.RecurrenceWrapper
,TemporalExpressions.DateRange
,TemporalExpressions.DayInMonth
,TemporalExpressions.DayOfMonthRange
,TemporalExpressions.DayOfWeekRange
,TemporalExpressions.Difference
,TemporalExpressions.Frequency
,TemporalExpressions.HourRange
,TemporalExpressions.Intersection
,TemporalExpressions.MinuteRange
,TemporalExpressions.MonthRange
,TemporalExpressions.Null
,TemporalExpressions.Substitution
,TemporalExpressions.Union
public abstract class TemporalExpression
extends Object
implements Serializable, Comparable<TemporalExpression>
Temporal expression abstract class.
- See Also:
-
Nested Class Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionabstract void
accept
(TemporalExpressionVisitor visitor) Handles aTemporalExpressionVisitor
visit.int
protected boolean
containsExpression
(TemporalExpression expression) Contains expression boolean.boolean
abstract com.ibm.icu.util.Calendar
first
(com.ibm.icu.util.Calendar cal) Returns a date representing the first occurrence of this expression on or after a specified date.getId()
Returns this expression's ID.Returns a range of dates matching this expression.int
Gets sequence.int
hashCode()
abstract boolean
includesDate
(com.ibm.icu.util.Calendar cal) Returns true if this expression includes the specified date.abstract boolean
isSubstitutionCandidate
(com.ibm.icu.util.Calendar cal, TemporalExpression expressionToTest) Returns true if this expression is a candidate for substitution using the expressionexpressionToTest
for the datecal
.com.ibm.icu.util.Calendar
next
(com.ibm.icu.util.Calendar cal) Returns a date representing the next occurrence of this expression after a specified date.protected abstract com.ibm.icu.util.Calendar
next
(com.ibm.icu.util.Calendar cal, TemporalExpression.ExpressionContext context) void
Sets this expression's ID.void
setSequence
(int sequence) Sets sequence.toString()
-
Constructor Details
-
TemporalExpression
protected TemporalExpression()
-
-
Method Details
-
getSequence
public int getSequence()Gets sequence.- Returns:
- the sequence
-
setSequence
public void setSequence(int sequence) Sets sequence.- Parameters:
sequence
- the sequence
-
accept
Handles aTemporalExpressionVisitor
visit.- Parameters:
visitor
-
-
compareTo
- Specified by:
compareTo
in interfaceComparable<TemporalExpression>
-
equals
-
hashCode
public int hashCode() -
containsExpression
Contains expression boolean.- Parameters:
expression
- the expression- Returns:
- the boolean
-
first
public abstract com.ibm.icu.util.Calendar first(com.ibm.icu.util.Calendar cal) Returns a date representing the first occurrence of this expression on or after a specified date. Returnsnull
if there is no matching date.- Parameters:
cal
- A date to evaluate- Returns:
- A Calendar instance representing the first matching date,
or
null
if no matching date is found
-
getId
Returns this expression's ID.- Returns:
- Expression ID String
-
getRange
Returns a range of dates matching this expression. Returns an empty Set if no dates are found.- Parameters:
range
- The range of dates to evaluatecal
- The starting date- Returns:
- A Set of matching
Date
objects
-
includesDate
public abstract boolean includesDate(com.ibm.icu.util.Calendar cal) Returns true if this expression includes the specified date.- Parameters:
cal
- A date to evaluate- Returns:
- true if this expression includes the date represented by
cal
-
isSubstitutionCandidate
public abstract boolean isSubstitutionCandidate(com.ibm.icu.util.Calendar cal, TemporalExpression expressionToTest) Returns true if this expression is a candidate for substitution using the expressionexpressionToTest
for the datecal
. ASubstitution
object will call this method when it needs to know if this expression could have produced the datecal
based on the expressionexpressionToTest
.- Parameters:
cal
- A date to evaluateexpressionToTest
- An expression to evaluate- Returns:
- true if this expression could have produced the date
cal
using the expressionexpressionToTest
-
next
public com.ibm.icu.util.Calendar next(com.ibm.icu.util.Calendar cal) Returns a date representing the next occurrence of this expression after a specified date. Returnsnull
if there is no matching date.- Parameters:
cal
- A date to evaluate- Returns:
- A Calendar instance representing the first matching date,
or
null
if no matching date is found
-
next
protected abstract com.ibm.icu.util.Calendar next(com.ibm.icu.util.Calendar cal, TemporalExpression.ExpressionContext context) -
setId
Sets this expression's ID.- Parameters:
id
- Expression ID String
-
toString
-