Package com.jidesoft.range
Class TimeRange
- All Implemented Interfaces:
Range<Date>,Comparable<Range>
Specifies upper and lower bounds for a range of values along a time line.
- Author:
- Simon White (swhite@catalysoft.com)
-
Field Summary
FieldsFields inherited from interface com.jidesoft.range.Range
PROPERTY_MAX, PROPERTY_MIN -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAdjusts the range.booleanDetermines whether the supplied point lies within this range.copy()createIntermediate(Range<Date> target, double position) booleaninthashCode()lower()doublemaximum()This may be the numeric representation of upper() or it may be rounded up.doubleminimum()This may be the numeric representation of lower() or it may be rounded down.voidsetMax(long to) voidvoidsetMin(long from) voidvoidsetTimeZone(TimeZone timeZone) doublesize()Compute the size of the rangetoString()static TimeRangeCreates a new TimeRange as the union of two existing TimeRanges.upper()Methods inherited from class com.jidesoft.range.AbstractRange
addPropertyChangeListener, compareTo, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getPropertyChangeListeners, getPropertyChangeListeners, removePropertyChangeListener
-
Field Details
-
_min
-
_max
-
-
Constructor Details
-
TimeRange
public TimeRange()Sets a default time range of the whole of today -
TimeRange
-
TimeRange
-
TimeRange
public TimeRange(long from, long to) -
TimeRange
Constructs a copy of the supplied time range- Parameters:
timeRange- the timeRange to copy
-
-
Method Details
-
copy
- Overrides:
copyin classAbstractRange<Date>
-
setMin
-
setMin
public void setMin(long from) -
adjust
Description copied from interface:RangeAdjusts the range.- Parameters:
lower- the new smallest value of the rangeupper- the new largest value of the range
-
setMax
-
setMax
public void setMax(long to) -
minimum
public double minimum()Description copied from interface:RangeThis may be the numeric representation of lower() or it may be rounded down.- Returns:
- the numeric value of the smallest value to include in the range.
-
maximum
public double maximum()Description copied from interface:RangeThis may be the numeric representation of upper() or it may be rounded up.- Returns:
- The numeric value of the largest value to include in the range.
-
size
public double size()Description copied from interface:RangeCompute the size of the range -
lower
- Returns:
- the smallest value of the range
-
upper
- Returns:
- the largest value of the range
-
contains
Description copied from interface:RangeDetermines whether the supplied point lies within this range. For continuous ranges this is interpreted as a pair of inequalities on the supplied value (i.e., min invalid input: '<'= x invalid input: '<'= max), but for discrete ranges thecontains()method is more like a set membership test.- Parameters:
x-- Returns:
- a boolean to indicate whether the supplied point lies within the range
-
getTimeZone
-
setTimeZone
-
createIntermediate
- Specified by:
createIntermediatein classAbstractRange<Date>
-
union
Creates a new TimeRange as the union of two existing TimeRanges. The date format of the first time range is retained in the returned result.- Parameters:
r1- the first TimeRanger2- the second TimeRange- Returns:
- the union of the supplied TimeRanges
-
equals
-
hashCode
public int hashCode() -
toString
-