|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectnet.agmodel.physical.Period
net.agmodel.physical.Interval
An interval is a finite period that has a starting and ending time.
In contrast, Periods can be open-ended.
Intervals are immutable.
| Constructor Summary | |
Interval()
Creates an Interval with start and end set to the beginning and end of time respecitively; |
|
Interval(Date start,
Date end)
Creates an interval from a starting and ending time. |
|
Interval(Date start,
Duration duration)
Creates an interval from a starting time and duration. |
|
Interval(Duration duration,
Date end)
Creates an interval from a duration and ending time. |
|
| Method Summary | |
Object |
clone()
|
double |
containsTimeQuantities(Duration small)
Gets the number of Durations in the Interval eg the interval midnight Jan 1, 1999 to midnight Jan 1, 2000 contains 365 subintervals of duration 1 day. |
Duration |
getDuration()
Gets the period duration |
static Duration |
getDuration(Date a,
Date b)
Gets the duration between two dates, regardless of their order |
double |
overlap(Period another)
Returns the degree of overlap between this |
| Methods inherited from class net.agmodel.physical.Period |
coincidesWith, coincidesWith, coincidesWith, compareTo, encompasses, getBeginningOfTime, getEarlierOf, getEnd, getEndOfTime, getLaterOf, getStart, hasBeginning, hasEnd, toString, unionWith |
| Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
public Interval()
public Interval(Date start,
Date end)
IllegalArgumentException - if start or end are null.
public Interval(Duration duration,
Date end)
duration - the duration of the intervalend - the ending time of the interval
IllegalArgumentException - if end is null
public Interval(Date start,
Duration duration)
start - the starting time of the intervalduration - the duration of the interval
IllegalArgumentException - if start is null| Method Detail |
public double overlap(Period another)
|-----|and another
|=======|as a ratio:
duration of overlap ------------------- duration of thisexamples
|======| |---|returns 1
|=================|
|------|
returns 0.5
|-----|
|======|
returns 0
another - Period which may or may not overlap
public static Duration getDuration(Date a,
Date b)
a - one dateb - another date
public Duration getDuration()
public double containsTimeQuantities(Duration small)
public Object clone()
clone in class Period
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||