|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectucar.nc2.units.DateRange
public class DateRange
Implements a range of dates, using DateType and/or TimeDuration. You can use a DateType = "present" and a time duration to specify "real time" intervals, eg "last 3 days" uses endDate = "present" and duration = "3 days".
| Constructor Summary | |
|---|---|
DateRange()
default Constructor |
|
DateRange(java.util.Date start,
java.util.Date end)
Create Date Range from a start and end date |
|
DateRange(DateRange range,
java.lang.String timeUnits)
Create DateRange from another DateRange, with a different units of resolution. |
|
DateRange(DateType start,
DateType end,
TimeDuration duration,
TimeDuration resolution)
Encapsolates a range of dates, using DateType start/end, and/or a TimeDuration. |
|
| Method Summary | |
|---|---|
boolean |
equals(java.lang.Object o)
|
void |
extend(DateRange dr)
Extend this date range by the given one. |
TimeDuration |
getDuration()
|
DateType |
getEnd()
|
TimeDuration |
getResolution()
|
DateType |
getStart()
|
int |
hashCode()
Override Object.hashCode() to implement equals. |
boolean |
included(java.util.Date d)
Determine if the given date is included in this date range. |
DateRange |
intersect(DateRange clip)
Intersect with another date range |
boolean |
intersects(java.util.Date start_want,
java.util.Date end_want)
Determine if the given range intersects this date range. |
boolean |
isEmpty()
If the range is empty |
boolean |
isPoint()
Return true if start date equals end date, so date range is a point. |
void |
setDuration(TimeDuration duration)
|
void |
setEnd(DateType end)
|
void |
setResolution(TimeDuration resolution)
|
void |
setStart(DateType start)
|
java.lang.String |
toString()
|
boolean |
useDuration()
|
boolean |
useEnd()
|
boolean |
useResolution()
|
boolean |
useStart()
|
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public DateRange()
throws java.text.ParseException
java.text.ParseException - artifact, cant happen
public DateRange(java.util.Date start,
java.util.Date end)
start - start of rangeend - end of range
public DateRange(DateRange range,
java.lang.String timeUnits)
throws java.lang.Exception
range - copy start and end from heretimeUnits - make resolution using new TimeDuration( timeUnits)
java.lang.Exception - is units are not valid time units
public DateRange(DateType start,
DateType end,
TimeDuration duration,
TimeDuration resolution)
start - starting dateend - ending dateduration - time durationresolution - time resolution; optional| Method Detail |
|---|
public boolean included(java.util.Date d)
d - date to check
public boolean intersects(java.util.Date start_want,
java.util.Date end_want)
start_want - range starts hereend_want - range ends here
public DateRange intersect(DateRange clip)
clip - interset with this date range
public void extend(DateRange dr)
dr - given DateRangepublic DateType getStart()
public void setStart(DateType start)
public DateType getEnd()
public void setEnd(DateType end)
public TimeDuration getDuration()
public void setDuration(TimeDuration duration)
public TimeDuration getResolution()
public void setResolution(TimeDuration resolution)
public boolean useStart()
public boolean useEnd()
public boolean useDuration()
public boolean useResolution()
public boolean isPoint()
public boolean isEmpty()
public java.lang.String toString()
toString in class java.lang.Objectpublic boolean equals(java.lang.Object o)
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||