Class IntervalTree<T extends Span>

    • Constructor Detail

      • IntervalTree

        public IntervalTree()
        Instantiates a new IntervalTree
      • IntervalTree

        public IntervalTree​(@NonNull
                            @NonNull Collection<T> collection)
        Instantiates a new IntervalTree with the given items
        Parameters:
        collection - the collection of items to initialize the IntervalTree with
    • Method Detail

      • add

        public boolean add​(@NonNull
                           T item)
        Specified by:
        add in interface Collection<T extends Span>
      • ceiling

        public Iterable<T> ceiling​(@NonNull
                                   T span)
        Returns the least elements in this set greater than or equal to the given element, or an empty Iterable if there is no such element.
        Parameters:
        span - the span to match
        Returns:
        the iterable of least elements greater than or equal to span, or an empty Iterable if there is no such element
      • ceilingIterator

        public Iterator<T> ceilingIterator​(@NonNull
                                           T start)
        Returns an iterator of items in the tree starting at the least element in the set greater than or equal to the given element or an empty iterator if there is no such element.
        Parameters:
        start - the span to match for the starting point of iteration
        Returns:
        the iterator of items in the tree starting at the least element in the set greater than or equal to the given element or an empty iterator if there is no such element.
      • containsOverlappingSpans

        public boolean containsOverlappingSpans​(@NonNull
                                                @NonNull Span span)
      • floor

        public Iterable<T> floor​(@NonNull
                                 T span)
        Returns the greatest elements in this set less than or equal to the given element, or an empty iterable if there is no such element.
        Parameters:
        span - the span to match
        Returns:
        the iterable of the the greatest elements in this set less than or equal to the given element, or an empty iterable if there is no such element.
      • floorIterator

        public Iterator<T> floorIterator​(@NonNull
                                         T start)
        Returns an iterator of items in the tree starting at the greatest element in the set less than or equal to the given element or an empty iterator if there is no such element.
        Parameters:
        start - the span to match for the starting point of iteration
        Returns:
        the iterator of items in the tree starting at the greatest element in the set less than or equal to the given element or an empty iterator if there is no such element.
      • higher

        public Iterable<T> higher​(@NonNull
                                  T span)
        Returns the least elements in this set greater than the given element, or an empty Iterable if there is no such element.
        Parameters:
        span - the span to match
        Returns:
        the iterable of least elements greater than span, or an empty Iterable if there is no such element
      • higherIterator

        public Iterator<T> higherIterator​(@NonNull
                                          T start)
        Returns an iterator of items in the tree starting at the least element in the set greater than the given element or an empty iterator if there is no such element.
        Parameters:
        start - the span to match for the starting point of iteration
        Returns:
        the iterator of items in the tree starting at the least element in the set greater than the given element or an empty iterator if there is no such element.
      • lower

        public Iterable<T> lower​(@NonNull
                                 T span)
        Returns the greatest elements in this set less than the given element, or an empty iterable if there is no such element.
        Parameters:
        span - the span to match
        Returns:
        the iterable of the the greatest elements in this set less than the given element, or an empty iterable if there is no such element.
      • lowerIterator

        public Iterator<T> lowerIterator​(@NonNull
                                         T start)
        Returns an iterator of items in the tree starting at the greatest element in the set less than the given element or an empty iterator if there is no such element.
        Parameters:
        start - the span to match for the starting point of iteration
        Returns:
        the iterator of items in the tree starting at the greatest element in the set less than the given element or an empty iterator if there is no such element.
      • overlapping

        public Iterable<T> overlapping​(@NonNull
                                       @NonNull Span span)
        Returns the collection of elements in this set overlapping with the given span including.
        Parameters:
        span - the span to match
        Returns:
        the list of elements overlapping in this set overlapping with the given span
      • toArray

        public <T1> T1[] toArray​(T1[] t1s)
        Specified by:
        toArray in interface Collection<T extends Span>