Class Interval

java.lang.Object
org.opencastproject.metadata.api.util.Interval

public abstract class Interval extends Object
An interval in time, possibly unbounded on one end. The interval is described by its bounds which are absolutely placed instants in time with a precision defined by Date.
  • Method Details

    • boundedInterval

      public static Interval boundedInterval(Date leftBound, Date rightBound)
      Constructor function for a bounded interval.
    • rightBoundedInterval

      public static Interval rightBoundedInterval(Date rightBound)
      Constructor function for a right bounded interval, i.e. an interval with an infinite left endpoint.
    • leftBoundedInterval

      public static Interval leftBoundedInterval(Date leftBound)
      Constructor function for a left bounded interval, i.e. an interval with an infinite right endpoint.
    • fromValues

      public static Interval fromValues(Date leftBound, Date rightBound)
      Create an interval from two dates. One of the dates may be null to indicate an infinite endpoint.
      Throws:
      IllegalArgumentException - if boths bounds are null
    • isBounded

      public boolean isBounded()
      Test if both endpoints are not infinite.
    • isLeftInfinite

      public abstract boolean isLeftInfinite()
      Test if the right endpoint is infinite.
    • isRightInfinite

      public abstract boolean isRightInfinite()
      Test if the left endpoint is infinite.
    • fold

      public abstract <A> A fold(Interval.Match<A> visitor)
      Safe decomposition.