Class TemporalExpressions.DayInMonth
java.lang.Object
org.apache.ofbiz.service.calendar.TemporalExpression
org.apache.ofbiz.service.calendar.TemporalExpressions.DayInMonth
- All Implemented Interfaces:
Serializable
,Comparable<TemporalExpression>
- Enclosing class:
- TemporalExpressions
A temporal expression that represents a day in the month.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.ofbiz.service.calendar.TemporalExpression
TemporalExpression.ExpressionContext
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
accept
(TemporalExpressionVisitor visitor) Handles aTemporalExpressionVisitor
visit.protected com.ibm.icu.util.Calendar
alignDayOfWeek
(com.ibm.icu.util.Calendar cal) Align day of week calendar.boolean
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.int
Returns the day of week in this expression.int
Returns the occurrence in this expression.int
hashCode()
boolean
includesDate
(com.ibm.icu.util.Calendar cal) Returns true if this expression includes the specified date.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, TemporalExpression.ExpressionContext context) toString()
Methods inherited from class org.apache.ofbiz.service.calendar.TemporalExpression
compareTo, containsExpression, getId, getRange, getSequence, next, setId, setSequence
-
Constructor Details
-
DayInMonth
public DayInMonth(int dayOfWeek, int occurrence) - Parameters:
dayOfWeek
- An integer in the range ofCalendar.SUNDAY
toCalendar.SATURDAY
occurrence
- An integer in the range of -5 to 5, excluding zero
-
-
Method Details
-
accept
Description copied from class:TemporalExpression
Handles aTemporalExpressionVisitor
visit.- Specified by:
accept
in classTemporalExpression
-
alignDayOfWeek
protected com.ibm.icu.util.Calendar alignDayOfWeek(com.ibm.icu.util.Calendar cal) Align day of week calendar.- Parameters:
cal
- the cal- Returns:
- the calendar
-
hashCode
public int hashCode()- Overrides:
hashCode
in classTemporalExpression
-
equals
- Overrides:
equals
in classTemporalExpression
-
first
public com.ibm.icu.util.Calendar first(com.ibm.icu.util.Calendar cal) Description copied from class:TemporalExpression
Returns a date representing the first occurrence of this expression on or after a specified date. Returnsnull
if there is no matching date.- Specified by:
first
in classTemporalExpression
- Parameters:
cal
- A date to evaluate- Returns:
- A Calendar instance representing the first matching date,
or
null
if no matching date is found
-
getDayOfWeek
public int getDayOfWeek()Returns the day of week in this expression.- Returns:
- The day of week in this expression
-
getOccurrence
public int getOccurrence()Returns the occurrence in this expression.- Returns:
- The occurrence in this expression
-
includesDate
public boolean includesDate(com.ibm.icu.util.Calendar cal) Description copied from class:TemporalExpression
Returns true if this expression includes the specified date.- Specified by:
includesDate
in classTemporalExpression
- Parameters:
cal
- A date to evaluate- Returns:
- true if this expression includes the date represented by
cal
-
isSubstitutionCandidate
public boolean isSubstitutionCandidate(com.ibm.icu.util.Calendar cal, TemporalExpression expressionToTest) Description copied from class:TemporalExpression
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
.- Specified by:
isSubstitutionCandidate
in classTemporalExpression
- 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, TemporalExpression.ExpressionContext context) - Specified by:
next
in classTemporalExpression
-
toString
- Overrides:
toString
in classTemporalExpression
-