Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.opensymphony.oscache.util
Class FastCronParser

    java.lang.Object
      com.opensymphony.oscache.util.FastCronParser

public class FastCronParser
extends java.lang.Object

Parses cron expressions and determines at what time in the past is the most recent match for the supplied expression.

Version:
  $Revision: 1.3 $
Author:
  Chris Miller, $Author: chris_miller $

Constructor Summary
`FastCronParser()` Creates a FastCronParser that uses a default cron expression of `"* * * * *".`
`FastCronParser(java.lang.String cronExpression)` Constructs a new FastCronParser based on the supplied expression.

Method Summary
`java.lang.String` | `getCronExpression()` Retrieves the current cron expression.
`java.lang.String` | `getExpressionSummary()` Recreates the original human-readable cron expression based on the internal datastructure values.
`long` | `getTimeBefore(long time)` Find the most recent time that matches this cron expression.
`boolean` | `hasMoreRecentMatch(long time)` Determines whether this cron expression matches a date/time that is more recent than the one supplied.
`void` | `setCronExpression(java.lang.String cronExpression)` Resets the cron expression to the value supplied.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### FastCronParser

    public FastCronParser()

  Creates a FastCronParser that uses a default cron expression of `"* * * * *". This will match any time that is supplied.

  `

### FastCronParser

    public FastCronParser(java.lang.String cronExpression)
                   throws java.text.ParseException

  Constructs a new FastCronParser based on the supplied expression.

Throws:
  `java.text.ParseException` - if the supplied expression is not a valid cron expression.

Method Detail

### setCronExpression

    public void setCronExpression(java.lang.String cronExpression)
                           throws java.text.ParseException

  Resets the cron expression to the value supplied.

  Parameters:
    `cronExpression` - the new cron expression.
  Throws:
    `java.text.ParseException` - if the supplied expression is not a valid cron expression.

### getCronExpression

    public java.lang.String getCronExpression()

  Retrieves the current cron expression.

  Returns:
    the current cron expression.

### hasMoreRecentMatch

    public boolean hasMoreRecentMatch(long time)

  Determines whether this cron expression matches a date/time that is more recent than the one supplied.

  Parameters:
    `time` - The time to compare the cron expression against.
  Returns:
    `true` if the cron expression matches a time that is closer to the current time than the supplied time is, `false` otherwise.

### getTimeBefore

    public long getTimeBefore(long time)

  Find the most recent time that matches this cron expression. This time will always be in the past, ie a lower value than the supplied time.

  Parameters:
    `time` - The time (in milliseconds) that we're using as our upper bound.
  Returns:
    The time (in milliseconds) when this cron event last occurred.

### getExpressionSummary

    public java.lang.String getExpressionSummary()

  Recreates the original human-readable cron expression based on the internal datastructure values.

  Returns:
    A cron expression that corresponds to the current state of the internal data structure.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| See www.opensymphony.com for more information.
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD