|
||||||||||
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(java.util.Date start,
TimeDuration duration)
Create Date Range from a start date and duration |
|
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 |
contains(java.util.Date d)
Same as included() |
boolean |
equals(java.lang.Object o)
|
void |
extend(DateRange dr)
Extend this date range by the given one. |
TimeDuration |
getDuration()
Get the duration of the interval |
DateType |
getEnd()
Get the ending Date. |
TimeDuration |
getResolution()
Get the time resolution. |
DateType |
getStart()
Get the starting Date. |
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 |
intersects(DateRange other)
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)
Set the duration of the interval. |
void |
setEnd(DateType end)
Set the ending Date. |
void |
setResolution(TimeDuration resolution)
Set the time resolution. |
void |
setStart(DateType start)
Set the starting Date. |
java.lang.String |
toString()
|
boolean |
useDuration()
Get if the duration is fixed. |
boolean |
useEnd()
Get if the end is fixed. |
boolean |
useResolution()
Get if the resolution is set. |
boolean |
useStart()
Get if the start is fixed. |
Methods inherited from class java.lang.Object |
---|
getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public DateRange() throws java.text.ParseException
java.text.ParseException
- artifact, cant happenpublic DateRange(java.util.Date start, java.util.Date end)
start
- start of rangeend
- end of rangepublic DateRange(java.util.Date start, TimeDuration duration)
start
- start of rangeduration
- duration of rangepublic 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 unitspublic DateRange(DateType start, DateType end, TimeDuration duration, TimeDuration resolution)
start
- starting dateend
- ending dateduration
- time durationresolution
- time resolution; optionalMethod Detail |
---|
public boolean included(java.util.Date d)
d
- date to check
public boolean contains(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 boolean intersects(DateRange other)
other
- date range
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)
start
- starting Datepublic DateType getEnd()
public void setEnd(DateType end)
end
- ending Datepublic TimeDuration getDuration()
public void setDuration(TimeDuration duration)
duration
- duration of the intervalpublic TimeDuration getResolution()
public void setResolution(TimeDuration resolution)
resolution
- the time resolutionpublic 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.Object
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |