org.feijoas.mango.common.collect

RangeSetLike

Related Doc: package collect

trait RangeSetLike[C, O <: Ordering[C], +Repr <: RangeSetLike[C, O, Repr] with RangeSet[C, O]] extends HasNewBuilder[Range[C, O], Repr]

Implementation trait for RangeSet

A range set is a set comprising zero or more nonempty, disconnected ranges of type C for which an Ordering[C] is defined.

Note that the behavior of Range#isEmpty() and Range#isConnected(Range) may not be as expected on discrete ranges. See the Scaladoc of those methods for details.

For a Set whose contents are specified by a Range, see ContiguousSet.

Usage example:

import org.feijoas.mango.common.collect.Bound._
import org.feijoas.mango.common.collect._
import math.Ordering.Int

// immutable range set:
val rangeSet = RangeSet(Range.open(1, 3), Range.closed(4, 9)) // {(1,3), [4,9]}
val subSet = rangeSet.subRangeSet(Range.closed(2, 6))         // union view {[2,3), [4,6]}

// mutable range set:
val mutableRangeSet = mutable.RangeSet(Range.closed(1, 10))   // {[1, 10]}
mutableRangeSet += Range.closedOpen(11, 15)                   // disconnected range: {[1, 10], [11, 15)}
mutableRangeSet += Range.closedOpen(15, 20)                   // connected range; {[1, 10], [11, 20)}
mutableRangeSet += Range.openClosed(0, 0)                     // empty range; {[1, 10], [11, 20)}
mutableRangeSet -= Range.open(5, 10)                          // splits [1, 10]; {[1, 5], [10, 10], [11, 20)}
Self Type
RangeSetLike[C, O, Repr]
Annotations
@Beta()
Since

0.8

Linear Supertypes
HasNewBuilder[Range[C, O], Repr], AnyRef, Any
Known Subclasses
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. RangeSetLike
  2. HasNewBuilder
  3. AnyRef
  4. Any
  1. Hide All
  2. Show all
Learn more about member selection
Visibility
  1. Public
  2. All

Type Members

  1. type Self = Repr

    The type implementing this RangeSet

    The type implementing this RangeSet

    Attributes
    protected

Abstract Value Members

  1. abstract def asRanges(): Set[Range[C, O]]

    Returns a view of the disconnected ranges that make up this range set.

    Returns a view of the disconnected ranges that make up this range set. The returned set may be empty. The iterators returned by its Iterable#iterator method return the ranges in increasing order of lower bound (equivalently, of upper bound).

  2. abstract def complement(): Repr

    Returns a view of the complement of this RangeSet.

  3. abstract def newBuilder: Builder[Range[C, O], Repr]

    Attributes
    protected[this]
    Definition Classes
    HasNewBuilder
  4. abstract def span(): Option[Range[C, O]]

    Returns a Some with the minimal range which encloses all ranges in this range set or None if this range set is empty

  5. abstract def subRangeSet(view: Range[C, O]): Repr

    Returns a view of the intersection of this RangeSet with the specified range.

Concrete Value Members

  1. final def !=(arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  4. final def asInstanceOf[T0]: T0

    Definition Classes
    Any
  5. def clone(): AnyRef

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  6. def contains(value: C): Boolean

    Determines whether any of this range set's member ranges contains value.

  7. def encloses(otherRange: Range[C, O]): Boolean

    Returns true if there exists a member range in this range set which encloses the specified range.

  8. def enclosesAll(other: RangeSet[C, O]): Boolean

    Returns true if for each member range in other there exists a member range in this range set which encloses it.

    Returns true if for each member range in other there exists a member range in this range set which encloses it. It follows that this.contains(value) whenever other.contains(value). Returns true if other is empty.

    This is equivalent to checking if this range set #encloses each of the ranges in other.

  9. final def eq(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  10. def equals(obj: Any): Boolean

    Returns true if obj is another RangeSet that contains the same ranges according to Range#equals(Any).

    Returns true if obj is another RangeSet that contains the same ranges according to Range#equals(Any).

    Definition Classes
    RangeSetLike → AnyRef → Any
  11. def finalize(): Unit

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  12. final def getClass(): Class[_]

    Definition Classes
    AnyRef → Any
  13. def hashCode(): Int

    Returns asRanges().hashCode().

    Returns asRanges().hashCode().

    Definition Classes
    RangeSetLike → AnyRef → Any
  14. def isEmpty: Boolean

    Returns true if this range set contains no ranges.

  15. final def isInstanceOf[T0]: Boolean

    Definition Classes
    Any
  16. final def ne(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  17. final def notify(): Unit

    Definition Classes
    AnyRef
  18. final def notifyAll(): Unit

    Definition Classes
    AnyRef
  19. def rangeContaining(value: C): Option[Range[C, O]]

    Returns the unique range from this range set that contains value as Some(value), or None if this range set does not contain value.

  20. final def synchronized[T0](arg0: ⇒ T0): T0

    Definition Classes
    AnyRef
  21. def toString(): String

    Returns a readable string representation of this range set.

    Returns a readable string representation of this range set. For example, if this RangeSet consisted of Ranges.closed(1, 3) and Ranges.greaterThan(4), this might return "{[1‥3](4‥+∞)}".

    Definition Classes
    RangeSetLike → AnyRef → Any
  22. final def wait(): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  23. final def wait(arg0: Long, arg1: Int): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  24. final def wait(arg0: Long): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from HasNewBuilder[Range[C, O], Repr]

Inherited from AnyRef

Inherited from Any

Ungrouped