JIDE 3.5.15

com.jidesoft.range
Class TimeRange

java.lang.Object
  extended by com.jidesoft.range.AbstractRange<Date>
      extended by com.jidesoft.range.TimeRange
All Implemented Interfaces:
Range<Date>

public class TimeRange
extends AbstractRange<Date>

Specifies upper and lower bounds for a range of values along a time line.

Author:
Simon White (swhite@catalysoft.com)

Field Summary
protected  Date _max
           
protected  Date _min
           
 
Fields inherited from interface com.jidesoft.range.Range
PROPERTY_MAX, PROPERTY_MIN
 
Constructor Summary
TimeRange()
          Sets a default time range of the whole of today
TimeRange(Calendar from, Calendar to)
           
TimeRange(Date from, Date to)
           
TimeRange(long from, long to)
           
TimeRange(TimeRange timeRange)
          Constructs a copy of the supplied time range
 
Method Summary
 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(Date to)
           
 void setMax(long to)
           
 void setMin(Date from)
           
 void setMin(long 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()
           
 
Methods inherited from class com.jidesoft.range.AbstractRange
addPropertyChangeListener, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, removePropertyChangeListener
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

_min

protected Date _min

_max

protected Date _max
Constructor Detail

TimeRange

public TimeRange()
Sets a default time range of the whole of today


TimeRange

public TimeRange(Calendar from,
                 Calendar to)

TimeRange

public TimeRange(Date from,
                 Date to)

TimeRange

public TimeRange(long from,
                 long to)

TimeRange

public TimeRange(TimeRange timeRange)
Constructs a copy of the supplied time range

Parameters:
timeRange - the timeRange to copy
Method Detail

copy

public Range<Date> copy()
Overrides:
copy in class AbstractRange<Date>

setMin

public void setMin(Date from)

setMin

public void setMin(long from)

adjust

public void adjust(Date lower,
                   Date upper)
Description copied from interface: Range
Adjusts the range.

Parameters:
lower - the new smallest value of the range
upper - the new largest value of the range

setMax

public void setMax(Date to)

setMax

public void setMax(long to)

minimum

public double minimum()
Description copied from interface: Range
This 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: Range
This 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: Range
Compute the size of the range


lower

public Date lower()
Returns:
the smallest value of the range

upper

public Date upper()
Returns:
the largest value of the range

contains

public boolean contains(Date x)
Description copied from interface: Range
Determines 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 <= x <= max), but for discrete ranges the contains() method is more like a set membership test.

Returns:
a boolean to indicate whether the supplied point lies within the range

getTimeZone

public TimeZone getTimeZone()

setTimeZone

public void setTimeZone(TimeZone timeZone)

createIntermediate

public Range<Date> createIntermediate(Range<Date> target,
                                      double position)
Specified by:
createIntermediate in class AbstractRange<Date>

union

public static TimeRange union(TimeRange r1,
                              TimeRange r2)
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 TimeRange
r2 - the second TimeRange
Returns:
the union of the supplied TimeRanges

equals

public boolean equals(Object other)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

toString

public String toString()
Overrides:
toString in class Object

JIDE 3.5.15