Class Interval<T extends Comparable<? super T>>

  • Type Parameters:
    T - a class that implements Comparable; hence a partially ordered set
    Direct Known Subclasses:
    RealInterval, TimeInterval

    public class Interval<T extends Comparable<? super T>>
    extends Object
    For a partially ordered set, there is a binary relation, denoted as ≤, that indicates that, for certain pairs of elements in the set, one of the elements precedes the other. An interval is defined as follows. For a ≤ b, an interval [a,b] is the set of elements x satisfying a ≤ x ≤ b (i.e. a ≤ x and x ≤ b). It contains at least the elements a and b.

    An Interval is immutable.

    See Also:
    Wikipedia: Interval
    • Constructor Detail

      • Interval

        public Interval​(T begin,
                        T end)
        Construct an interval.
        Parameters:
        begin - the beginning of this interval
        end - the end of this interval
    • Method Detail

      • begin

        public T begin()
        Get the beginning of this interval.
        Returns:
        the beginning of this interval
      • end

        public T end()
        Get the end of this interval.
        Returns:
        the end of this interval
      • relations

        public Set<IntervalRelation> relations​(Interval<T> Y)
        Determine the interval relations between this and Y.
        Parameters:
        Y - an interval
        Returns:
        the set of satisfied relations
      • is

        public boolean is​(IntervalRelation relation,
                          Interval<T> Y)
        Check whether this and Y satisfies a certain Allen's interval relation.
        Parameters:
        relation - an IntervalRelation
        Y - an interval
        Returns:
        true if this and Y satisfies relation
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object