Range<Date>
, Comparable<Date>
public class TimeRange extends AbstractRange<Date>
Modifier and Type | Field | Description |
---|---|---|
protected Date |
_max |
|
protected Date |
_min |
PROPERTY_MAX, PROPERTY_MIN
Constructor | Description |
---|---|
TimeRange() |
Sets a default time range of the whole of today
|
TimeRange(long from,
long to) |
|
TimeRange(TimeRange timeRange) |
Constructs a copy of the supplied time range
|
TimeRange(Calendar from,
Calendar to) |
|
TimeRange(Date from,
Date to) |
Modifier and Type | Method | Description |
---|---|---|
void |
adjust(Date lower,
Date upper) |
Adjusts the range.
|
boolean |
contains(Date x) |
Determines whether the supplied point lies within this range.
|
Range<Date> |
copy() |
|
Range<Date> |
createIntermediate(Range<Date> target,
double position) |
|
boolean |
equals(Object other) |
|
TimeZone |
getTimeZone() |
|
int |
hashCode() |
|
Date |
lower() |
|
double |
maximum() |
This may be the numeric representation of upper() or it may be rounded up.
|
double |
minimum() |
This may be the numeric representation of lower() or it may be rounded down.
|
void |
setMax(long to) |
|
void |
setMax(Date to) |
|
void |
setMin(long from) |
|
void |
setMin(Date from) |
|
void |
setTimeZone(TimeZone timeZone) |
|
double |
size() |
Compute the size of the range
|
String |
toString() |
|
static TimeRange |
union(TimeRange r1,
TimeRange r2) |
Creates a new TimeRange as the union of two existing TimeRanges.
|
Date |
upper() |
addPropertyChangeListener, compareTo, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getPropertyChangeListeners, getPropertyChangeListeners, removePropertyChangeListener
public TimeRange()
public TimeRange(long from, long to)
public TimeRange(TimeRange timeRange)
timeRange
- the timeRange to copypublic Range<Date> copy()
copy
in class AbstractRange<Date>
public void setMin(Date from)
public void setMin(long from)
public void adjust(Date lower, Date upper)
Range
lower
- the new smallest value of the rangeupper
- the new largest value of the rangepublic void setMax(Date to)
public void setMax(long to)
public double minimum()
Range
public double maximum()
Range
public double size()
Range
public Date lower()
public Date upper()
public boolean contains(Date x)
Range
contains()
method is more like a set membership test.public TimeZone getTimeZone()
public void setTimeZone(TimeZone timeZone)
public Range<Date> createIntermediate(Range<Date> target, double position)
createIntermediate
in class AbstractRange<Date>
public static TimeRange union(TimeRange r1, TimeRange r2)
r1
- the first TimeRanger2
- the second TimeRange