Class TemporalExpression
- java.lang.Object
-
- org.apache.ofbiz.service.calendar.TemporalExpression
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.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 java.lang.Object implements java.io.Serializable, java.lang.Comparable<TemporalExpression>
Temporal expression abstract class.- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected class
TemporalExpression.ExpressionContext
-
Constructor Summary
Constructors Modifier Constructor Description protected
TemporalExpression()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract void
accept(TemporalExpressionVisitor visitor)
Handles aTemporalExpressionVisitor
visit.int
compareTo(TemporalExpression obj)
protected boolean
containsExpression(TemporalExpression expression)
boolean
equals(java.lang.Object obj)
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.java.lang.String
getId()
Returns this expression's ID.java.util.Set<java.util.Date>
getRange(DateRange range, com.ibm.icu.util.Calendar cal)
Returns a range of dates matching this expression.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
setId(java.lang.String id)
Sets this expression's ID.java.lang.String
toString()
-
-
-
Field Detail
-
sequence
protected int sequence
Field used to sort expressions. Expression evaluation depends on correct ordering. Expressions are evaluated from lowest value to highest value.
-
id
protected java.lang.String id
A unique ID for this expression. This field is intended to be used by persistence classes.
-
-
Method Detail
-
accept
public abstract void accept(TemporalExpressionVisitor visitor)
Handles aTemporalExpressionVisitor
visit.- Parameters:
visitor
-
-
compareTo
public int compareTo(TemporalExpression obj)
- Specified by:
compareTo
in interfacejava.lang.Comparable<TemporalExpression>
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
containsExpression
protected boolean containsExpression(TemporalExpression expression)
-
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
public java.lang.String getId()
Returns this expression's ID.- Returns:
- Expression ID String
-
getRange
public java.util.Set<java.util.Date> getRange(DateRange range, com.ibm.icu.util.Calendar cal)
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
public void setId(java.lang.String id)
Sets this expression's ID.- Parameters:
id
- Expression ID String
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-