com.atlassian.jira.web.component.cron.parser
Class CronHoursEntry

java.lang.Object
  extended by com.atlassian.jira.web.component.cron.parser.CronHoursEntry

public class CronHoursEntry
extends Object

Represents the hours part of a cron string. This class is responsible for parsing and validating the hours entry. The isValid() method refers only to what is supported by the cron editor for the hours entry.

Valid hours means a numerical hour (or range of the form x-y) with an optional trailing "/1", "/2" or "/3" to indicate the repeat increment in hours. This expects that numeric hours to be in 24 hour time format.

The hours and meridian attributes depend on whether this is a range entry or a "run once" entry. For ranges, use the "from" and "to" methods.


Constructor Summary
CronHoursEntry(String cronEntry)
          Parses the given value and establishes state based on this.
 
Method Summary
 int getFrom()
          Returns the lower bound of the hour range if this entry has a range.
 String getFromMeridian()
          Returns the meridian indicator @{link #AM} or @{link #AM} for the lower bound of a range entry.
 int getIncrement()
          Returns the increment or step size in hours or -1 if this entry has no increment.
 int getRunOnce()
          Returns the single hour value for this entry if it is a run once entry.
 String getRunOnceMeridian()
          Returns the meridian indicator @{link #AM} or @{link #AM} for the entry if it is a run once entry.
 int getTo()
          Returns the upper bound of the hour range if this entry has a range.
 String getToMeridian()
          Returns the meridian indicator @{link #AM} or @{link #AM} for the upper bound of a range entry.
 boolean hasIncrement()
          Indicates if this entry has an increment.
 boolean isRunOnce()
           
 boolean isValid()
          Returns true only if the hours entry is valid with respect to the editor.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CronHoursEntry

public CronHoursEntry(String cronEntry)
Parses the given value and establishes state based on this.

Parameters:
cronEntry - the hours field of a cron string.
Method Detail

isValid

public boolean isValid()
Returns true only if the hours entry is valid with respect to the editor.

Returns:
true only if the editor can handle this hour part.

getFrom

public int getFrom()
Returns the lower bound of the hour range if this entry has a range. This end of the range is inclusive - e.g. if HoursFrom is 3PM and HoursTo is 5PM, the duration of the range is 2 hours.

Returns:
the lower bound or -1 if this is not a range hour entry.

getTo

public int getTo()
Returns the upper bound of the hour range if this entry has a range. This end of the range is exclusive - e.g. if HoursFrom is 3PM and HoursTo is 5PM, the duration of the range is 2 hours.

Returns:
the upper bound or -1 if this is not a range hour entry.

getFromMeridian

public String getFromMeridian()
Returns the meridian indicator @{link #AM} or @{link #AM} for the lower bound of a range entry.

Returns:
the meridian belonging to the lower bound hour or null if this is not a range entry.

getToMeridian

public String getToMeridian()
Returns the meridian indicator @{link #AM} or @{link #AM} for the upper bound of a range entry.

Returns:
the meridian belonging to the upper bound hour or null if this is not a range entry.

getRunOnce

public int getRunOnce()
Returns the single hour value for this entry if it is a run once entry.

Returns:
the hour value or -1 if this is not a run once hour entry.

getRunOnceMeridian

public String getRunOnceMeridian()
Returns the meridian indicator @{link #AM} or @{link #AM} for the entry if it is a run once entry.

Returns:
the meridian belonging single hour value or null if this is not a run once entry.

getIncrement

public int getIncrement()
Returns the increment or step size in hours or -1 if this entry has no increment.

Returns:
the period of repetition in hours.

hasIncrement

public boolean hasIncrement()
Indicates if this entry has an increment.

Returns:
true only if the entry has an increment part specified.

isRunOnce

public boolean isRunOnce()


Copyright © 2002-2012 Atlassian. All Rights Reserved.