org.feijoas.mango.common.collect.mutable

RangeSet

Related Docs: object RangeSet | package mutable

trait RangeSet[C, O <: Ordering[C]] extends collect.RangeSet[C, O] with RangeSetLike[C, O, RangeSet[C, O]]

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)}
Annotations
@Beta()
Since

0.8

Linear Supertypes
RangeSetLike[C, O, RangeSet[C, O]], Shrinkable[Range[C, O]], Growable[Range[C, O]], Clearable, collect.RangeSet[C, O], collect.RangeSetLike[C, O, RangeSet[C, O]], HasNewBuilder[Range[C, O], RangeSet[C, O]], AnyRef, Any
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. RangeSet
  2. RangeSetLike
  3. Shrinkable
  4. Growable
  5. Clearable
  6. RangeSet
  7. RangeSetLike
  8. HasNewBuilder
  9. AnyRef
  10. Any
  1. Hide All
  2. Show all
Learn more about member selection
Visibility
  1. Public
  2. All

Type Members

  1. type Self = RangeSet[C, O]

    The type implementing this RangeSet

    The type implementing this RangeSet

    Attributes
    protected
    Definition Classes
    RangeSetLike

Abstract Value Members

  1. abstract def add(range: Range[C, O]): Unit

    Adds the specified range to this RangeSet (optional operation).

    Adds the specified range to this RangeSet (optional operation). That is, for equal range sets a and b, the result of a.add(range) is that a will be the minimal range set for which both a.enclosesAll(b) and a.encloses(range).

    Note that range will be coalesced with any ranges in the range set that are connected with it. Moreover, if range is empty, this is a no-op.

    Definition Classes
    RangeSetLike
  2. 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).

    Definition Classes
    RangeSetLike
  3. abstract def clear(): Unit

    Removes all ranges from this RangeSet (optional operation).

    Removes all ranges from this RangeSet (optional operation). After this operation, this.contains(c) will return false for all c.

    This is equivalent to remove(Range.all()).

    Definition Classes
    RangeSetLike → Growable → Clearable
  4. abstract def complement(): RangeSet[C, O]

    Returns a view of the complement of this RangeSet.

    Returns a view of the complement of this RangeSet.

    Definition Classes
    RangeSetLike
  5. abstract def newBuilder: Builder[Range[C, O], RangeSet[C, O]]

    Attributes
    protected[this]
    Definition Classes
    HasNewBuilder
  6. abstract def remove(range: Range[C, O]): Unit

    Removes the specified range from this RangeSet (optional operation).

    Removes the specified range from this RangeSet (optional operation). After this operation, if range.contains(c), this.contains(c) will return false.

    If range is empty, this is a no-op.

    Definition Classes
    RangeSetLike
  7. 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

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

    Definition Classes
    RangeSetLike
  8. abstract def subRangeSet(view: Range[C, O]): RangeSet[C, O]

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

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

    Definition Classes
    RangeSetLike

Concrete Value Members

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

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

    Definition Classes
    AnyRef → Any
  3. def ++=(xs: TraversableOnce[Range[C, O]]): RangeSet.this.type

    Definition Classes
    Growable
  4. final def +=(range: Range[C, O]): RangeSet.this.type

    Alias for #add(range)

    Alias for #add(range)

    Definition Classes
    RangeSetLike → Growable
  5. def +=(elem1: Range[C, O], elem2: Range[C, O], elems: Range[C, O]*): RangeSet.this.type

    Definition Classes
    Growable
  6. def --=(xs: TraversableOnce[Range[C, O]]): RangeSet.this.type

    Definition Classes
    Shrinkable
  7. final def -=(range: Range[C, O]): RangeSet.this.type

    Alias for #remove(range)

    Alias for #remove(range)

    Definition Classes
    RangeSetLike → Shrinkable
  8. def -=(elem1: Range[C, O], elem2: Range[C, O], elems: Range[C, O]*): RangeSet.this.type

    Definition Classes
    Shrinkable
  9. final def ==(arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  10. def addAll(other: RangeSet[C, O]): Unit

    Adds all of the ranges from the specified range set to this range set (optional operation).

    Adds all of the ranges from the specified range set to this range set (optional operation). After this operation, this range set is the minimal range set that encloses both the original range set and other.

    This is equivalent to calling #add on each of the ranges in other in turn.

    Definition Classes
    RangeSetLike
    Exceptions thrown

    UnsupportedOperationException if this range set does not support the addAll operation

  11. final def asInstanceOf[T0]: T0

    Definition Classes
    Any
  12. def clone(): AnyRef

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

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

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

    Definition Classes
    RangeSetLike
  14. def encloses(otherRange: Range[C, O]): Boolean

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

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

    Definition Classes
    RangeSetLike
  15. def enclosesAll(other: collect.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.

    Definition Classes
    RangeSetLike
  16. final def eq(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  17. 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
  18. def finalize(): Unit

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

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

    Returns asRanges().hashCode().

    Returns asRanges().hashCode().

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

    Returns true if this range set contains no ranges.

    Returns true if this range set contains no ranges.

    Definition Classes
    RangeSetLike
  22. final def isInstanceOf[T0]: Boolean

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

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

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

    Definition Classes
    AnyRef
  26. 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.

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

    Definition Classes
    RangeSetLike
  27. def removeAll(other: RangeSet[C, O]): Unit

    Removes all of the ranges from the specified range set from this range set (optional operation).

    Removes all of the ranges from the specified range set from this range set (optional operation). After this operation, if other.contains(c), this.contains(c) will return false.

    This is equivalent to calling #remove on each of the ranges in other in turn.

    Definition Classes
    RangeSetLike
  28. final def synchronized[T0](arg0: ⇒ T0): T0

    Definition Classes
    AnyRef
  29. 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
  30. final def wait(): Unit

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

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

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from RangeSetLike[C, O, RangeSet[C, O]]

Inherited from Shrinkable[Range[C, O]]

Inherited from Growable[Range[C, O]]

Inherited from Clearable

Inherited from collect.RangeSet[C, O]

Inherited from collect.RangeSetLike[C, O, RangeSet[C, O]]

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

Inherited from AnyRef

Inherited from Any

Ungrouped