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

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

public class Interval
extends Object
implements Serializable, 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(String label, Date startTime, Date endTime)
           
 
Method Summary
 boolean after(Interval last)
           
 int compareTo(Object o)
           
 boolean containsDate(Date clickedDate)
           
 boolean equals(Object obj)
           
 long getDuration()
           
 Date getEndTime()
           
 String getLabel()
           
 int getStartHours(TimeZone timeZone)
           
 int getStartMinutes(TimeZone timeZone)
           
 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(Date endTime)
           
 void setLabel(String label)
           
 void setStartTime(Date startTime)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Interval

public Interval(String label,
                Date startTime,
                Date endTime)
Method Detail

getLabel

public String getLabel()

setLabel

public void setLabel(String label)

getStartTime

public Date getStartTime()

setStartTime

public void setStartTime(Date startTime)

getEndTime

public Date getEndTime()

setEndTime

public void setEndTime(Date endTime)

containsDate

public boolean containsDate(Date clickedDate)

compareTo

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

after

public boolean after(Interval last)

getStartHours

public int getStartHours(TimeZone timeZone)

getStartMinutes

public int getStartMinutes(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 Object

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

toString

public String toString()
Overrides:
toString in class Object


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