com.espertech.esper.schedule
Class ScheduleSpec

java.lang.Object
  extended by com.espertech.esper.schedule.ScheduleSpec
All Implemented Interfaces:
MetaDefItem, java.io.Serializable

public final class ScheduleSpec
extends java.lang.Object
implements MetaDefItem, java.io.Serializable

Holds a schedule specification which consists of a set of integer values or a null value for each schedule unit to indicate a wildcard. There is always an element in the specification for each unit minutes, hours, day of month, month, and day of week. There is optionally an element in the specification for the unit seconds.

See Also:
Serialized Form

Constructor Summary
ScheduleSpec()
          Constructor - for unit testing, initialize to all wildcards but leave seconds empty.
ScheduleSpec(java.util.EnumMap<ScheduleUnit,java.util.SortedSet<java.lang.Integer>> unitValues, java.lang.String optionalTimeZone, CronParameter optionalDayOfMonthOperator, CronParameter optionalDayOfWeekOperator)
          Constructor - validates that all mandatory schedule.
 
Method Summary
 void addValue(ScheduleUnit element, int value)
          For unit testing, add a single value, changing wildcards to value sets.
protected static void compress(java.util.Map<ScheduleUnit,java.util.SortedSet<java.lang.Integer>> unitValues)
          Function to reduce value sets for unit that cover the whole range down to a wildcard.
 boolean equals(java.lang.Object otherObject)
           
 CronParameter getOptionalDayOfMonthOperator()
           
 CronParameter getOptionalDayOfWeekOperator()
           
 java.lang.String getOptionalTimeZone()
           
 java.util.EnumMap<ScheduleUnit,java.util.SortedSet<java.lang.Integer>> getUnitValues()
          Return map of ordered set of valid schedule values for minute, hour, day, month etc.
 int hashCode()
           
 void setOptionalTimeZone(java.lang.String optionalTimeZone)
           
 java.lang.String toString()
           
protected static void validate(java.util.Map<ScheduleUnit,java.util.SortedSet<java.lang.Integer>> unitValues)
          Validate units and their value sets.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ScheduleSpec

public ScheduleSpec(java.util.EnumMap<ScheduleUnit,java.util.SortedSet<java.lang.Integer>> unitValues,
                    java.lang.String optionalTimeZone,
                    CronParameter optionalDayOfMonthOperator,
                    CronParameter optionalDayOfWeekOperator)
             throws java.lang.IllegalArgumentException
Constructor - validates that all mandatory schedule.

Parameters:
unitValues - are the values for each minute, hour, day, month etc.
Throws:
java.lang.IllegalArgumentException - - if validation of value set per unit fails

ScheduleSpec

public ScheduleSpec()
Constructor - for unit testing, initialize to all wildcards but leave seconds empty.

Method Detail

getOptionalDayOfMonthOperator

public CronParameter getOptionalDayOfMonthOperator()

getOptionalDayOfWeekOperator

public CronParameter getOptionalDayOfWeekOperator()

setOptionalTimeZone

public void setOptionalTimeZone(java.lang.String optionalTimeZone)

getUnitValues

public final java.util.EnumMap<ScheduleUnit,java.util.SortedSet<java.lang.Integer>> getUnitValues()
Return map of ordered set of valid schedule values for minute, hour, day, month etc. units

Returns:
map of 5 or 6 entries each with a set of integers

getOptionalTimeZone

public java.lang.String getOptionalTimeZone()

addValue

public final void addValue(ScheduleUnit element,
                           int value)
For unit testing, add a single value, changing wildcards to value sets.

Parameters:
element - to add
value - to add

toString

public final java.lang.String toString()
Overrides:
toString in class java.lang.Object

equals

public final boolean equals(java.lang.Object otherObject)
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

compress

protected static void compress(java.util.Map<ScheduleUnit,java.util.SortedSet<java.lang.Integer>> unitValues)
Function to reduce value sets for unit that cover the whole range down to a wildcard. I.e. reduce 0,1,2,3,4,5,6 for week value to 'null' indicating the wildcard.

Parameters:
unitValues - is the set of valid values per unit

validate

protected static void validate(java.util.Map<ScheduleUnit,java.util.SortedSet<java.lang.Integer>> unitValues)
Validate units and their value sets.

Parameters:
unitValues - is the set of valid values per unit

© 2006-2015 EsperTech Inc.
All rights reserved.
Visit us at espertech.com