org.hackystat.utilities.time.interval
Class WeekInterval

java.lang.Object
  extended by org.hackystat.utilities.time.interval.Interval
      extended by org.hackystat.utilities.time.interval.WeekInterval
All Implemented Interfaces:
java.lang.Iterable<Week>

public class WeekInterval
extends Interval
implements java.lang.Iterable<Week>

Provides week interval.

Author:
Hongbing Kou, Philip Johnson

Constructor Summary
WeekInterval(java.lang.String startWeek, java.lang.String endWeek)
          Creates a WeekInterval object with start and end information.
WeekInterval(javax.xml.datatype.XMLGregorianCalendar startWeek, javax.xml.datatype.XMLGregorianCalendar endWeek)
          Creates a week-based interval with start and end information.
 
Method Summary
 boolean equals(java.lang.Object obj)
          Indicates whether some other object is "equal to" this one.
 Week getEndWeek()
          Gets end week.
 Week getStartWeek()
          Gets start week.
 int hashCode()
          Gets the hash code.
 java.util.Iterator<Week> iterator()
          Gets the iterator over the week period.
 java.lang.String toString()
          String representaiton of the WeekInterval object.
 
Methods inherited from class org.hackystat.utilities.time.interval.Interval
getIntervalType, isDailyInterval, isMonthlyInterval, isWeeklyInterval
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

WeekInterval

public WeekInterval(java.lang.String startWeek,
                    java.lang.String endWeek)
             throws IllegalIntervalException
Creates a WeekInterval object with start and end information.

Parameters:
startWeek - Start week string.
endWeek - End week string.
Throws:
IllegalIntervalException - If the given start and end are invalid.

WeekInterval

public WeekInterval(javax.xml.datatype.XMLGregorianCalendar startWeek,
                    javax.xml.datatype.XMLGregorianCalendar endWeek)
             throws IllegalIntervalException
Creates a week-based interval with start and end information.

Parameters:
startWeek - An XMLGregorianCalendar indicating the start week.
endWeek - An XMLGregorianCalendar indicating the end week.
Throws:
IllegalIntervalException - If problems occur.
Method Detail

getStartWeek

public Week getStartWeek()
Gets start week.

Returns:
Start week.

getEndWeek

public Week getEndWeek()
Gets end week.

Returns:
End week.

iterator

public java.util.Iterator<Week> iterator()
Gets the iterator over the week period.

Specified by:
iterator in interface java.lang.Iterable<Week>
Specified by:
iterator in class Interval
Returns:
Iterator over week period.

toString

public java.lang.String toString()
String representaiton of the WeekInterval object.

Overrides:
toString in class java.lang.Object
Returns:
Week interval string

hashCode

public int hashCode()
Gets the hash code.

Overrides:
hashCode in class java.lang.Object
Returns:
The hash code.

equals

public boolean equals(java.lang.Object obj)
Indicates whether some other object is "equal to" this one.

Overrides:
equals in class java.lang.Object
Parameters:
obj - Another instance of DayInterval.
Returns:
True if they are equal, false otherwise.