Class TimeInterval

  • All Implemented Interfaces:
    java.lang.Comparable<TimeInterval>
    Direct Known Subclasses:
    OwnedInterval

    public class TimeInterval
    extends java.lang.Object
    implements java.lang.Comparable<TimeInterval>

    TimeInterval class.

    Version:
    $Id: $
    Author:
    ranger
    • Constructor Detail

      • TimeInterval

        public TimeInterval​(java.util.Date start,
                            java.util.Date end)

        Constructor for TimeInterval.

        Parameters:
        start - a Date object.
        end - a Date object.
    • Method Detail

      • getStart

        public java.util.Date getStart()

        getStart

        Returns:
        a Date object.
      • getEnd

        public java.util.Date getEnd()

        getEnd

        Returns:
        a Date object.
      • comparesTo

        public int comparesTo​(java.util.Date date)
        Returns -1, 0, 1 based on how date compares to this interval
        Parameters:
        date - a Date object.
        Returns:
        -1 if the interval is entirely before date, 0 if the interval contains date, 1 if the interface entirely follows date, for these the starting date is included the ending date excluded
      • toString

        public java.lang.String toString()

        toString

        Overrides:
        toString in class java.lang.Object
        Returns:
        a String object.
      • equals

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()

        hashCode

        Overrides:
        hashCode in class java.lang.Object
        Returns:
        a int.
      • compareTo

        public int compareTo​(TimeInterval t)

        compareTo

        Specified by:
        compareTo in interface java.lang.Comparable<TimeInterval>
        Parameters:
        t - a TimeInterval object.
        Returns:
        a int.
      • preceeds

        public boolean preceeds​(TimeInterval interval)
      • follows

        public boolean follows​(TimeInterval interval)
      • overlaps

        public boolean overlaps​(TimeInterval interval)