it.amattioli.encapsulate.dates
Class Day

Show UML class diagram
java.lang.Object
  extended by it.amattioli.encapsulate.range.AbstractRange<T>
      extended by it.amattioli.encapsulate.range.ContinousRange<Date>
          extended by it.amattioli.encapsulate.dates.ConventionalTimeInterval
              extended by it.amattioli.encapsulate.dates.Day
All Implemented Interfaces:
TimeInterval, Discrete<Day>, Range<Date>, Serializable, Cloneable, Comparable<Day>

public class Day
extends ConventionalTimeInterval
implements Discrete<Day>, Serializable, Cloneable

An instance of this class represents a time interval corresponding to a day, from 00:00 to 24:00. As the concept of 00:00 and 24:00 is Timezone dependent, the same will be for instances of this class.

See Also:
Serialized Form

Constructor Summary
Day(Date date)
          Construct the day that contains the passed time point in the current time zone.
Day(int day, int month, int year)
          Construct a day given day, month and year in the current time zone
 
Method Summary
 Day clone()
           
 int compareTo(Day d)
           
 boolean equals(Object o)
           
 int getDayOfMonth()
          The day of the month
 Duration getDuration()
          Returns the duration of this time interval.
 Date getEndTime()
          Returns the time point that is the end of this day
 int getMonth()
          The month
 int getYear()
          The year
 int hashCode()
           
 Day next()
          Returns the day immediately following this.
 Day previous()
          Returns the day immediately preceding this.
 DiscreteRange<Day> through(Day end)
           
static Day today()
          Costruisce un Day che rappresenta la giornata odierna.
static Day tomorrow()
           
 String toString()
           
static Day yesterday()
           
 
Methods inherited from class it.amattioli.encapsulate.dates.ConventionalTimeInterval
after, after, before, before, dayIterator, getCalendar, getHigh, getHighDay, getInitTime, getLow, getLowDay, getPhysicalDuration, includes, isHighBounded, isLowBounded, newRange, setCalendar
 
Methods inherited from class it.amattioli.encapsulate.range.ContinousRange
abutOn, gap, mergeWith, minus
 
Methods inherited from class it.amattioli.encapsulate.range.AbstractRange
contains, hasSameHigh, hasSameLow, intersect, overlaps
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface it.amattioli.encapsulate.range.Range
abutOn, contains, gap, hasSameHigh, hasSameLow, intersect, mergeWith, minus, overlaps
 

Constructor Detail

Day

public Day(Date date)
Construct the day that contains the passed time point in the current time zone.

Parameters:
date -

Day

public Day(int day,
           int month,
           int year)
Construct a day given day, month and year in the current time zone

Parameters:
day -
month -
year -
Method Detail

today

public static Day today()
Costruisce un Day che rappresenta la giornata odierna.


yesterday

public static Day yesterday()

tomorrow

public static Day tomorrow()

getDayOfMonth

public int getDayOfMonth()
The day of the month


getMonth

public int getMonth()
The month


getYear

public int getYear()
The year


previous

public Day previous()
Returns the day immediately preceding this.

Specified by:
previous in interface Discrete<Day>
Specified by:
previous in class ConventionalTimeInterval
Returns:
l'elemento precedente a questo

next

public Day next()
Returns the day immediately following this.

Specified by:
next in interface Discrete<Day>
Specified by:
next in class ConventionalTimeInterval
Returns:
l'elemento successivo a questo

getEndTime

public Date getEndTime()
Returns the time point that is the end of this day

Specified by:
getEndTime in class ConventionalTimeInterval
Returns:
l'istante di tempo finale di questo intervallo

compareTo

public int compareTo(Day d)
Specified by:
compareTo in interface Comparable<Day>

equals

public boolean equals(Object o)
Overrides:
equals in class AbstractRange<Date>

hashCode

public int hashCode()
Overrides:
hashCode in class ConventionalTimeInterval

clone

public Day clone()
Overrides:
clone in class Object

toString

public String toString()
Overrides:
toString in class AbstractRange<Date>

getDuration

public Duration getDuration()
Description copied from interface: TimeInterval
Returns the duration of this time interval. This make sense only for a time interval that has both extremes, otherwise the duration is infinite.

Specified by:
getDuration in interface TimeInterval
Returns:
this time interval duration

through

public DiscreteRange<Day> through(Day end)


Copyright © 2011. All Rights Reserved.