org.apache.myfaces.custom.schedule.model
Class Interval

java.lang.Object
  extended by org.apache.myfaces.custom.schedule.model.Interval
All Implemented Interfaces:
java.io.Serializable, java.lang.Comparable
Direct Known Subclasses:
HalfHourInterval

public class Interval
extends java.lang.Object
implements java.io.Serializable, java.lang.Comparable

This class represents a period of time, which may be given a label. An interval is inclusive of the start time, but excludes the end time.

Since:
1.1.7
Version:
$Revision: 371736 $
Author:
Peter Mahoney
See Also:
Serialized Form

Constructor Summary
Interval(java.lang.String label, java.util.Date startTime, java.util.Date endTime)
           
 
Method Summary
 boolean after(Interval last)
           
 int compareTo(java.lang.Object o)
           
 boolean containsDate(java.util.Date clickedDate)
           
 boolean equals(java.lang.Object obj)
           
 long getDuration()
           
 java.util.Date getEndTime()
           
 java.lang.String getLabel()
           
 int getStartHours(java.util.TimeZone timeZone)
           
 int getStartMinutes(java.util.TimeZone timeZone)
           
 java.util.Date getStartTime()
           
 int hashCode()
           
 boolean isEquivalent(Interval other)
           Intervals are equivalent if their label is the same and they begin and end at the same time of day.
 void setEndTime(java.util.Date endTime)
           
 void setLabel(java.lang.String label)
           
 void setStartTime(java.util.Date startTime)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Interval

public Interval(java.lang.String label,
                java.util.Date startTime,
                java.util.Date endTime)
Method Detail

getLabel

public java.lang.String getLabel()

setLabel

public void setLabel(java.lang.String label)

getStartTime

public java.util.Date getStartTime()

setStartTime

public void setStartTime(java.util.Date startTime)

getEndTime

public java.util.Date getEndTime()

setEndTime

public void setEndTime(java.util.Date endTime)

containsDate

public boolean containsDate(java.util.Date clickedDate)

compareTo

public int compareTo(java.lang.Object o)
Specified by:
compareTo in interface java.lang.Comparable

after

public boolean after(Interval last)

getStartHours

public int getStartHours(java.util.TimeZone timeZone)

getStartMinutes

public int getStartMinutes(java.util.TimeZone timeZone)

getDuration

public long getDuration()

isEquivalent

public boolean isEquivalent(Interval other)

Intervals are equivalent if their label is the same and they begin and end at the same time of day.

Parameters:
other - the interval to compare with
Returns:
true, if this interval is equivalent to the given interval

hashCode

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

equals

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

toString

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


Copyright © 2011 The Apache Software Foundation. All Rights Reserved.