Package generic

Interface Span.SpanSet<N,S extends Span<N,S>>

Type Parameters:
N - the type of endpoints
S - the type of spans
All Known Subinterfaces:
Span.MutableSpanSet<N,S>, ULongSpan.MutableULongSpanSet, ULongSpan.ULongSpanSet
All Known Implementing Classes:
Span.DefaultSpanSet, ULongSpan.DefaultULongSpanSet
Enclosing interface:
Span<N,S extends Span<N,S>>

public static interface Span.SpanSet<N,S extends Span<N,S>>
An abstract interface for a set of spans

Connected spans in the set are automatically coalesced. For example, the set [[0..5],[6..10]] becomes [[0..10]].

  • Method Summary

    Modifier and Type
    Method
    Description
    Get a span which encloses all spans in the set
    default Iterable<S>
    Iterate over the spans which are absent from the set but enclosed by the given span
    boolean
    Check if the set contains the given value
    default boolean
    Check if any span in the set encloses the given span
    Iterate over all spans in the set that intersect the given span
    boolean
    Check if any span in the set intersects the given span
    boolean
    Check if this set has any spans
    Get the span containing the given value
    Iterate the spans in this set
  • Method Details

    • isEmpty

      boolean isEmpty()
      Check if this set has any spans
      Returns:
      true if empty
    • spans

      Iterable<S> spans()
      Iterate the spans in this set
      Returns:
      the iterable
    • bound

      S bound()
      Get a span which encloses all spans in the set
      Returns:
      the bounding span
    • contains

      boolean contains(N n)
      Check if the set contains the given value
      Parameters:
      n - the value
      Returns:
      true if contained by any span in the set
    • spanContaining

      S spanContaining(N n)
      Get the span containing the given value
      Parameters:
      n - the value
      Returns:
      the span or null
    • intersecting

      Iterable<S> intersecting(S s)
      Iterate over all spans in the set that intersect the given span
      Parameters:
      s - the span
      Returns:
      the iterable of spans
    • complement

      default Iterable<S> complement(S s)
      Iterate over the spans which are absent from the set but enclosed by the given span
      Parameters:
      s - the span
      Returns:
      the iterable of spans
    • intersects

      boolean intersects(S s)
      Check if any span in the set intersects the given span
      Parameters:
      s - the span
      Returns:
      true if any span in the set intersects it
    • encloses

      default boolean encloses(S s)
      Check if any span in the set encloses the given span
      Parameters:
      s - the span
      Returns:
      true if any span in the set encloses it