it.amattioli.encapsulate.dates
Class GenericTimeInterval

Show UML class diagram
java.lang.Object
  extended by it.amattioli.encapsulate.range.AbstractRange<T>
      extended by it.amattioli.encapsulate.range.ContinousRange<T>
          extended by it.amattioli.encapsulate.range.GenericContinousRange<Date>
              extended by it.amattioli.encapsulate.dates.GenericTimeInterval
All Implemented Interfaces:
TemporalExpression, TimeInterval, Range<Date>, Serializable

public class GenericTimeInterval
extends GenericContinousRange<Date>
implements TimeInterval, TemporalExpression, Serializable

Estensione di un range che rappresenta un intervallo di tempo.

See Also:
Serialized Form

Constructor Summary
GenericTimeInterval(ConventionalTimeInterval begin, ConventionalTimeInterval end)
          Costruisce un intervallo di tempo dati il giorno iniziale e finale.
GenericTimeInterval(Date begin, Date end)
          Costruisce un intervallo di tempo dati gli istanti iniziale e finale.
 
Method Summary
 boolean after(TimeInterval other)
          Verifies if another time interval completely follows this.
 boolean before(TimeInterval other)
          Verifies if another time interval completely precedes this.
 Duration getDuration()
          Returns the duration of this time interval.
 Day getHighDay()
           
 Day getLowDay()
           
 PhysicalDuration getPhysicalDuration()
           
static TimeInterval highBoundedInterval(Date end)
          Costruisce un intervallo di tempo con un limite superiore ma senza limite inferiore.
static TimeInterval lowBoundedInterval(Date begin)
          Costruisce un intervallo di tempo con un limite inferiore ma senza limite superiore.
protected  GenericTimeInterval newRange(Date low, Date high)
          Crea un nuovo range compatibile con questo.
 
Methods inherited from class it.amattioli.encapsulate.range.GenericContinousRange
getHigh, getLow, isHighBounded, isLowBounded
 
Methods inherited from class it.amattioli.encapsulate.range.ContinousRange
abutOn, gap, mergeWith, minus
 
Methods inherited from class it.amattioli.encapsulate.range.AbstractRange
contains, equals, hashCode, hasSameHigh, hasSameLow, includes, intersect, overlaps, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface it.amattioli.encapsulate.dates.TimeInterval
includes
 
Methods inherited from interface it.amattioli.encapsulate.range.Range
abutOn, contains, gap, getHigh, getLow, hasSameHigh, hasSameLow, intersect, isHighBounded, isLowBounded, mergeWith, minus, overlaps
 
Methods inherited from interface it.amattioli.encapsulate.dates.TemporalExpression
includes
 

Constructor Detail

GenericTimeInterval

public GenericTimeInterval(Date begin,
                           Date end)
Costruisce un intervallo di tempo dati gli istanti iniziale e finale.

Parameters:
begin - istante iniziale dell'intervallo
end - istante finale dell'intervallo
Throws:
NullPointerException - se almeno uno dei due parametri è nullo

GenericTimeInterval

public GenericTimeInterval(ConventionalTimeInterval begin,
                           ConventionalTimeInterval end)
Costruisce un intervallo di tempo dati il giorno iniziale e finale.

Method Detail

lowBoundedInterval

public static TimeInterval lowBoundedInterval(Date begin)
Costruisce un intervallo di tempo con un limite inferiore ma senza limite superiore.

Parameters:
begin - limite inferiore dell'intervallo
Throws:
NullPointerException - se il parametro è nullo

highBoundedInterval

public static TimeInterval highBoundedInterval(Date end)
Costruisce un intervallo di tempo con un limite superiore ma senza limite inferiore.

Parameters:
end - limite superiore dell'intervallo
Throws:
NullPointerException - se il parametro è nullo

getPhysicalDuration

public PhysicalDuration getPhysicalDuration()
Specified by:
getPhysicalDuration in interface TimeInterval

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

newRange

protected GenericTimeInterval newRange(Date low,
                                       Date high)
Description copied from class: AbstractRange
Crea un nuovo range compatibile con questo.

Overrides:
newRange in class GenericContinousRange<Date>
Returns:

getLowDay

public Day getLowDay()
Specified by:
getLowDay in interface TimeInterval

getHighDay

public Day getHighDay()
Specified by:
getHighDay in interface TimeInterval

before

public boolean before(TimeInterval other)
Description copied from interface: TimeInterval
Verifies if another time interval completely precedes this.

Specified by:
before in interface TimeInterval
Parameters:
other - the time interval to be checked
Returns:
true if the passed time interval precedes this, otherwise false

after

public boolean after(TimeInterval other)
Description copied from interface: TimeInterval
Verifies if another time interval completely follows this.

Specified by:
after in interface TimeInterval
Parameters:
other - the time interval to be checked
Returns:
true if the passed time interval follows this, otherwise flase


Copyright © 2011. All Rights Reserved.