org.promotego.logic.storehours
Class HourSpecification

java.lang.Object
  extended by org.promotego.logic.storehours.HourSpecification

public class HourSpecification
extends java.lang.Object

A single specification of store hours, featuring hours for one day or same hours for a set of days. Generates IntRange objects representing the start and end seconds on a weekly schedule, and also contains helper methods for merging multiple days' schedules into a single HourSpecification object for nicer printing.

Author:
alf

Constructor Summary
HourSpecification(java.util.Collection<Day> days, java.util.List<org.apache.commons.lang.math.IntRange> ranges)
           
HourSpecification(java.lang.String stringSpec)
           
 
Method Summary
 boolean equals(java.lang.Object obj)
           
 java.util.Set<Day> getDays()
           
 java.util.List<org.apache.commons.lang.math.IntRange> getSecondRanges()
           
 int hashCode()
           
 HourSpecification mergeWith(HourSpecification otherSpec)
          Return a new HourSpecification with all days and hour ranges of this HourSpecification and the one provided.
 boolean sameDays(HourSpecification otherSpec)
           
 boolean sameHours(HourSpecification otherSpec)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

HourSpecification

public HourSpecification(java.lang.String stringSpec)

HourSpecification

public HourSpecification(java.util.Collection<Day> days,
                         java.util.List<org.apache.commons.lang.math.IntRange> ranges)
Method Detail

equals

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

hashCode

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

toString

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

sameDays

public boolean sameDays(HourSpecification otherSpec)

sameHours

public boolean sameHours(HourSpecification otherSpec)

mergeWith

public HourSpecification mergeWith(HourSpecification otherSpec)
Return a new HourSpecification with all days and hour ranges of this HourSpecification and the one provided. This operation is idempotent with respect to both HourSpecification objects used to calculate the new HourSpecification.

Parameters:
otherSpec -
Returns:

getDays

public java.util.Set<Day> getDays()

getSecondRanges

public java.util.List<org.apache.commons.lang.math.IntRange> getSecondRanges()


Copyright © 2007. All Rights Reserved.