Class TemporalExpression

    • 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 String id
        A unique ID for this expression. This field is intended to be used by persistence classes.
    • Constructor Detail

      • TemporalExpression

        protected TemporalExpression()
    • Method Detail

      • accept

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

        public int hashCode()
        Overrides:
        hashCode in class 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. 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
      • setId

        public void setId​(String id)
        Sets this expression's ID.
        Parameters:
        id - Expression ID String