Interface Interval

All Superinterfaces:
Time
All Known Subinterfaces:
AbsoluteInterval, RelativeInterval

public interface Interval extends Time

A time interval represents a period of time between two instants. Intervals are inclusive of the start instant and exclusive of the end. The end instant is always greater than or equal to the start instant.

Intervals have a fixed millisecond duration. This is the difference between the start and end instants. As a result, intervals are not comparable. To compare the length of two intervals, you should compare their durations.

*

A huge part of the documentation of this class has been retrieved from the joda-time library.

Version:
$Id$
Author:
gvSIG Team
  • Method Details

    • contains

      boolean contains(Instant instant)
      Does this time interval contain the specified time instant.
      Parameters:
      instant - the time instant to compare to, null means now
      Returns:
      true if this time interval contains the time instant
    • getStart

      Instant getStart()
      Gets the start of this time interval, which is inclusive, as an Instant.
      Returns:
      the start of the time interval
    • getEnd

      Instant getEnd()
      Gets the end of this time interval, which is exclusive, as an Instant.
      Returns:
      the end of the time interval
    • toStandardDuration

      Duration toStandardDuration()
      Gets the duration of the interval. If the interval is relative, it returns the exact duration. It the interval is relative, it returns a duration assuming a 365 days year, 12 months year, 30 days month, 7 day week, 24 hour day, 60 minute hour, 60 second minute and 1000 millis second.
      Returns:
      a duration equivalent to this interval