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