Class IntervalList

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Cloneable, java.lang.Iterable<Interval>, java.util.Collection<Interval>, java.util.List<Interval>, java.util.RandomAccess

    public class IntervalList
    extends java.util.ArrayList<Interval>
    See Also:
    Serialized Form
    • Field Summary

      • Fields inherited from class java.util.AbstractList

        modCount
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean containsInterval​(Interval interval)
      Checks whether this list contains the specified interval.
      boolean containsTimestamp​(long timestamp)
      Checks whether this list contains any interval that contains the specified timestamp.
      void end​(long timestamp)
      Will try to change the end timestamp of the last interval in the list to the provided timestamp T.
      void start​(long timestamp)
      Will add a new open-ended interval (T,-) to the end of the list.
      java.lang.String toString()  
      • Methods inherited from class java.util.ArrayList

        add, add, addAll, addAll, clear, clone, contains, ensureCapacity, equals, forEach, get, hashCode, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, removeIf, removeRange, replaceAll, retainAll, set, size, sort, spliterator, subList, toArray, toArray, trimToSize
      • Methods inherited from class java.util.AbstractCollection

        containsAll
      • Methods inherited from class java.lang.Object

        finalize, getClass, notify, notifyAll, wait, wait, wait
      • Methods inherited from interface java.util.Collection

        parallelStream, stream, toArray
      • Methods inherited from interface java.util.List

        containsAll
    • Constructor Detail

      • IntervalList

        public IntervalList()
      • IntervalList

        public IntervalList​(int initialCapacity)
    • Method Detail

      • containsTimestamp

        public boolean containsTimestamp​(long timestamp)
        Checks whether this list contains any interval that contains the specified timestamp. The list is traversed in reverse order.
        Parameters:
        timestamp - The timestamp
        Returns:
        True if the list contains an interval that contains the timestamp, false otherwise.
      • containsInterval

        public boolean containsInterval​(Interval interval)
        Checks whether this list contains the specified interval. The list is traversed in reverse order.
        Parameters:
        interval - The interval
        Returns:
        True if the list contains an interval that fully contains the specified interval, false otherwise.
      • end

        public void end​(long timestamp)
        Will try to change the end timestamp of the last interval in the list to the provided timestamp T. When the last interval is empty the previous interval will be tried etc. When an interval is reached that has an end timestamp that is greater than T, a notification is thrown.
        Parameters:
        timestamp - T
      • start

        public void start​(long timestamp)
        Will add a new open-ended interval (T,-) to the end of the list.
        Parameters:
        timestamp - T
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.util.AbstractCollection<Interval>