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:
  • 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

      public abstract void accept(TemporalExpressionVisitor visitor)
      Handles a TemporalExpressionVisitor visit.
      Parameters:
      visitor -
    • compareTo

      public int compareTo(TemporalExpression obj)
      Specified by:
      compareTo in interface Comparable<TemporalExpression>
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • containsExpression

      protected boolean containsExpression(TemporalExpression expression)
      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. Returns null 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 String getId()
      Returns this expression's ID.
      Returns:
      Expression ID String
    • getRange

      public Set<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 evaluate
      cal - 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 expression expressionToTest for the date cal. A Substitution object will call this method when it needs to know if this expression could have produced the date cal based on the expression expressionToTest.
      Parameters:
      cal - A date to evaluate
      expressionToTest - An expression to evaluate
      Returns:
      true if this expression could have produced the date cal using the expression expressionToTest
    • 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. Returns null 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(String id)
      Sets this expression's ID.
      Parameters:
      id - Expression ID String
    • toString

      public String toString()
      Overrides:
      toString in class Object