class RangeSet<T : Comparable<*>> : Any

An immutable set of ranges.

Constructors

<init>

constructor(ranges: Set<Range<T>>)

Parameters

Name Description
ranges: Set<Range<T>>

<init>

constructor(rangeSet: GImmutableRangeSet<T>)

An immutable set of ranges.

Parameters

Name Description
rangeSet: GImmutableRangeSet<T>

adapted Guava class

Methods

contains

operator fun contains(value: T): Boolean

Returns true, if the value is within the RangeSet.

Parameters

Name Description
value: T

ReturnValue

Name Description
Boolean

span

fun span(): Range<T>

Returns the minimal range that encloses the range set.

ReturnValue

Name Description
Range<T>

intersects

fun intersects(otherRange: Range<T>): Boolean

Returns true, if this RangeSet intersects with the otherRange.

Parameters

Name Description
otherRange: Range<T>

ReturnValue

Name Description
Boolean

intersects

fun intersects(otherRangeSet: RangeSet<T>): Boolean

Returns true, if this RangeSet intersects with the otherRangeSet.

Parameters

Name Description
otherRangeSet: RangeSet<T>

ReturnValue

Name Description
Boolean

union

fun union(other: RangeSet<T>): RangeSet<T>

Union operation of this RangeSet and the other.

Parameters

Name Description
other: RangeSet<T>

ReturnValue

Name Description
RangeSet<T>

intersection

fun intersection(other: RangeSet<T>): RangeSet<T>

Returns the intersecting RangeSet of this range with the other.

Parameters

Name Description
other: RangeSet<T>

range set that must be connected to this range set

ReturnValue

Name Description
RangeSet<T>

intersecting RangeSet

difference

fun difference(other: RangeSet<T>): RangeSet<T>

Returns a new RangeSet consisting of the difference of this range set and the other.

Parameters

Name Description
other: RangeSet<T>

ReturnValue

Name Description
RangeSet<T>

numberOfDisconnectedRanges

fun numberOfDisconnectedRanges(): Int

Returns the number of disconnected intervals of this RangeSet.

ReturnValue

Name Description
Int

toRangeSetG

fun toRangeSetG(): ()<T>

Conversion to Guava range set class.

ReturnValue

Name Description
()<T>

asRanges

fun asRanges(): Set<Range<T>>

Returns all ranges individually.

ReturnValue

Name Description
Set<Range<T>>

equals

fun equals(other: Any?): Boolean

Parameters

Name Description
other: Any?

ReturnValue

Name Description
Boolean

hashCode

fun hashCode(): Int

ReturnValue

Name Description
Int

CompanionObject

RangeSet

class RangeSet<T : Comparable<*>> : Any

An immutable set of ranges.

Methods

empty

fun <T : Comparable<*>> empty(): >

Creates an empty RangeSet.

ReturnValue

Name Description
>

all

fun <T : Comparable<*>> all(): >

Creates a RangeSet that contains all values.

ReturnValue

Name Description
>

of

fun <T : Comparable<*>> of(vararg ranges: Range<T>): RangeSet<T>

Creates a RangeSet containing the provided ranges.

Parameters

Name Description
vararg ranges: Range<T>

ranges which are included in the RangeSet

ReturnValue

Name Description
RangeSet<T>

Extensions

ofNonIntersectingRanges

fun RangeSet.Companion.ofNonIntersectingRanges(ranges: Set<Range<Double>>): RangeSet<Double>

Receiver

Name Description
RangeSet.Companion

Parameters

Name Description
ranges: Set<Range<Double>>

ReturnValue

Name Description
RangeSet<Double>

ofNonIntersectingRanges

fun RangeSet.Companion.ofNonIntersectingRanges(vararg ranges: Range<Double>): RangeSet<Double>

Receiver

Name Description
RangeSet.Companion

Parameters

Name Description
vararg ranges: Range<Double>

ReturnValue

Name Description
RangeSet<Double>