Class CronExpression

    • Constructor Detail

      • CronExpression

        public CronExpression​(String cronExpression)
        Constructs a new CronExpression based on the specified parameter.
        Parameters:
        cronExpression - String representation of the cron expression the new object should represent
      • CronExpression

        public CronExpression​(CronExpression expression)
        Constructs a new CronExpression as a copy of an existing instance.
        Parameters:
        expression - The existing cron expression to be copied
    • Method Detail

      • isSatisfiedBy

        public boolean isSatisfiedBy​(Date date)
        Indicates whether the given date satisfies the cron expression. Note that milliseconds are ignored, so two Dates falling on different milliseconds of the same second will always have the same result here.
        Parameters:
        date - the date to evaluate
        Returns:
        a boolean indicating whether the given date satisfies the cron expression
      • getNextValidTimeAfter

        public Date getNextValidTimeAfter​(Date date)
        Returns the next date/time after the given date/time which satisfies the cron expression.
        Parameters:
        date - the date/time at which to begin the search for the next valid date/time
        Returns:
        the next valid date/time
      • getNextInvalidTimeAfter

        public Date getNextInvalidTimeAfter​(Date date)
        Returns the next date/time after the given date/time which does not satisfy the expression
        Parameters:
        date - the date/time at which to begin the search for the next invalid date/time
        Returns:
        the next valid date/time
      • getTimeZone

        public TimeZone getTimeZone()
        Returns the time zone for which this CronExpression will be resolved.
        Returns:
        time zone
      • setTimeZone

        public void setTimeZone​(TimeZone timeZone)
        Sets the time zone for which this CronExpression will be resolved.
        Parameters:
        timeZone - object
      • toString

        public String toString()
        Returns the string representation of the CronExpression
        Overrides:
        toString in class Object
        Returns:
        a string representation of the CronExpression
      • isValidExpression

        public static boolean isValidExpression​(String cronExpression)
        Indicates whether the specified cron expression can be parsed into a valid cron expression
        Parameters:
        cronExpression - the expression to evaluate
        Returns:
        a boolean indicating whether the given expression is a valid cron expression
      • getCronExpression

        public String getCronExpression()
      • getExpressionSummary

        public String getExpressionSummary()
      • getExpressionSetSummary

        protected String getExpressionSetSummary​(Set<Integer> set)
      • skipWhiteSpace

        protected int skipWhiteSpace​(int i,
                                     String s)
      • findNextWhiteSpace

        protected int findNextWhiteSpace​(int i,
                                         String s)
      • getValue

        protected org.redisson.executor.ValueSet getValue​(int v,
                                                          String s,
                                                          int i)
      • getNumericValue

        protected int getNumericValue​(String s,
                                      int i)
      • getMonthNumber

        protected int getMonthNumber​(String s)
      • getDayOfWeekNumber

        protected int getDayOfWeekNumber​(String s)
      • getTimeAfter

        public Date getTimeAfter​(Date afterTime)
      • setCalendarHour

        protected void setCalendarHour​(Calendar cal,
                                       int hour)
        Advance the calendar to the particular hour paying particular attention to daylight saving problems.
        Parameters:
        cal - the calendar to operate on
        hour - the hour to set
      • getTimeBefore

        public Date getTimeBefore​(Date endTime)
      • getFinalFireTime

        public Date getFinalFireTime()
      • isLeapYear

        protected boolean isLeapYear​(int year)
      • getLastDayOfMonth

        protected int getLastDayOfMonth​(int monthNum,
                                        int year)