Class TimeRange

java.lang.Object
org.gvsig.timesupport.swing.impl.rdv.TimeRange
All Implemented Interfaces:
Comparable<TimeRange>

public class TimeRange extends Object implements Comparable<TimeRange>
A time range. This is a range in time specified by a start and end time.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    double
    The end of the time range
    double
    The start of the time range
  • Constructor Summary

    Constructors
    Constructor
    Description
    TimeRange(double start, double end)
    Create a time range.
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    Compare time ranges.
    boolean
    contains(double time)
    See if the time is within the time range.
    double
    The length of the time range.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • start

      public double start
      The start of the time range
    • end

      public double end
      The end of the time range
  • Constructor Details

    • TimeRange

      public TimeRange(double start, double end)
      Create a time range.
      Parameters:
      start - the start of the time range
      end - the end of the time range
  • Method Details

    • length

      public double length()
      The length of the time range. Simply end-start.
      Returns:
      the length of the time range
    • contains

      public boolean contains(double time)
      See if the time is within the time range.
      Parameters:
      time - the time to check
      Returns:
      true if the time is within the time range, false otherwise
    • compareTo

      public int compareTo(TimeRange t)
      Compare time ranges. This is based first on their start, and then on their end (if needed).
      Specified by:
      compareTo in interface Comparable<TimeRange>
      Parameters:
      d - the time range to compare with
      Returns:
      0 if they are the same, -1 if this is less than the other, and 1 if this is greater than the other.