cz.muni.fi.pclis.commons.date
Class Period

java.lang.Object
  extended by cz.muni.fi.pclis.commons.date.Period

public class Period
extends Object

Period is immutable class that represents period between two dates. User: Ľuboš Pecho Date: 6.7.2009 Time: 18:15:42


Field Summary
private  Date endTime
          End time of the period
private  Date startTime
          Start time of the period
 
Constructor Summary
  Period()
          Constructs new period, only for Hibernate.
private Period(Date startTime, Date endTime)
          Constructs new period, only for Hibernate.
 
Method Summary
 boolean contains(Date date)
          Returns true if the period contains given date
 boolean equals(Object o)
           
 Date getEndTime()
           
static Period getPeriod(Date startTime, Date endTime)
          Factory method for creating periods
 Date getStartTime()
           
 int hashCode()
           
 void setEndTime(Date endTime)
          Sets end time
 void setStartTime(Date startTime)
          Sets start time
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

startTime

private Date startTime
Start time of the period


endTime

private Date endTime
End time of the period

Constructor Detail

Period

public Period()
Constructs new period, only for Hibernate. Use wisely!!! Only for hibernate and forming backing objects in controllers


Period

private Period(Date startTime,
               Date endTime)
Constructs new period, only for Hibernate. Use wisely!!!

Parameters:
startTime -
endTime -
Method Detail

getPeriod

public static Period getPeriod(Date startTime,
                               Date endTime)
Factory method for creating periods

Parameters:
startTime -
endTime -
Returns:

getStartTime

public Date getStartTime()
Returns:
returns start time

getEndTime

public Date getEndTime()
Returns:
returns end time

setEndTime

public void setEndTime(Date endTime)
Sets end time

Parameters:
endTime -

setStartTime

public void setStartTime(Date startTime)
Sets start time

Parameters:
startTime -

contains

public boolean contains(Date date)
Returns true if the period contains given date

Parameters:
date -
Returns:

equals

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

hashCode

public int hashCode()
Overrides:
hashCode in class Object


Copyright © 2009-2010 Faculty of Informatics, Masaryk university, Brno. All Rights Reserved.