org.sakaiproject.service.legacy.time
Interface TimeRange

All Superinterfaces:
Cloneable
All Known Implementing Classes:
BasicTimeService.MyTimeRange

public interface TimeRange
extends Cloneable

TimeRange ...

Version:
$Revision: 632 $
Author:
University of Michigan, Sakai Software Development Team

Method Summary
 void adjust(TimeRange original, TimeRange modified)
          Adjust this time range based on the difference between the origRange and the modRange, if any.
 Object clone()
          Clone the TimeRange
 boolean contains(Time time)
          Check if this Time in my range.
 boolean contains(TimeRange range)
          Check if this TimeRange completely contains the other range.
 long duration()
          Access the duration of the TimeRange, in milliseconds.
 Time firstTime()
          Access the first Time of the range.
 Time firstTime(long fudge)
          Access the first Time of the range (fudged).
 boolean isSingleTime()
          Check if the TimeRange is really just a single Time.
 Time lastTime()
          Access the last Time in the range.
 Time lastTime(long fudge)
          Access the last Time of the range (fudged).
 boolean overlaps(TimeRange range)
          Check if this TimeRange overlap this other TimeRange at all.
 void shiftBackward(long i)
          Shift the time range back an interval
 void shiftForward(long i)
          Shift the time range forward an interval
 String toStringHR()
          Format the TimeRange - human readable.
 void zoom(double f)
          Enlarge or shrink the time range by multiplying a zooming factor.
 

Method Detail

contains

public boolean contains(Time time)
Check if this Time in my range.

Parameters:
time - The time to check for inclusion.
Returns:
true if the time is in the range, false if not.

overlaps

public boolean overlaps(TimeRange range)
Check if this TimeRange overlap this other TimeRange at all.

Parameters:
range - The time range to check for overlap.
Returns:
true if any time in the other range is in this range, false if not.

contains

public boolean contains(TimeRange range)
Check if this TimeRange completely contains the other range.

Parameters:
range - The time range to check for containment.
Returns:
true if the other TimeRange is within this TimeRange, false if not.

firstTime

public Time firstTime()
Access the first Time of the range.

Returns:
the first Time actually in the range.

lastTime

public Time lastTime()
Access the last Time in the range.

Returns:
the last Time actually in the range.

firstTime

public Time firstTime(long fudge)
Access the first Time of the range (fudged).

Parameters:
fudge - How many ms to increase if the first is not included.
Returns:
the first Time actually in the range (fudged).

lastTime

public Time lastTime(long fudge)
Access the last Time of the range (fudged).

Parameters:
fudge - How many ms to decrease if the last is not included.
Returns:
the first Time actually in the range (fudged).

toStringHR

public String toStringHR()
Format the TimeRange - human readable.

Returns:
The TimeRange in string format.

duration

public long duration()
Access the duration of the TimeRange, in milliseconds.

Returns:
The duration.

shiftBackward

public void shiftBackward(long i)
Shift the time range back an interval

Parameters:
i - time intervel in ms

shiftForward

public void shiftForward(long i)
Shift the time range forward an interval

Parameters:
i - time intervel in ms

zoom

public void zoom(double f)
Enlarge or shrink the time range by multiplying a zooming factor.

Parameters:
f - zooming factor

adjust

public void adjust(TimeRange original,
                   TimeRange modified)
Adjust this time range based on the difference between the origRange and the modRange, if any.

Parameters:
original - the original time range.
modified - the modified time range.

clone

public Object clone()
Clone the TimeRange

Returns:
A cloned TimeRange.

isSingleTime

public boolean isSingleTime()
Check if the TimeRange is really just a single Time.

Returns:
true if the tiTimeRange is a single Time, false if it is not.