Table of Contents

Class IntervalCollection<T>

Namespace
Arc4u
Assembly
Arc4u.dll

Represents a collection of intervals. This class cannot be inherited.

public sealed class IntervalCollection<T> : ReadOnlyCollection<Interval<T>>, IList<Interval<T>>, ICollection<Interval<T>>, IReadOnlyList<Interval<T>>, IReadOnlyCollection<Interval<T>>, IEnumerable<Interval<T>>, IList, ICollection, IEnumerable

Type Parameters

T

The value type of the interval.

Inheritance
IntervalCollection<T>
Implements
Inherited Members
Extension Methods

Constructors

IntervalCollection(params Interval<T>[])

Initializes a new instance of the IntervalCollection`1 class.

public IntervalCollection(params Interval<T>[] args)

Parameters

args Interval<T>[]

The arguments.

Exceptions

ArgumentNullException

args is null.

IntervalCollection(IList<Interval<T>>)

Initializes a new instance of the IntervalCollection`1 class.

public IntervalCollection(IList<Interval<T>> collection)

Parameters

collection IList<Interval<T>>

The collection whose elements are copied to the IntervalCollection`1.

Exceptions

ArgumentNullException

collection is null.

Properties

Complement

Gets the complement of the current IntervalCollection`1.

public IntervalCollection<T> Complement { get; }

Property Value

IntervalCollection<T>

The complement.

Intersection

Gets the intersection of the current IntervalCollection`1.

public Interval<T> Intersection { get; }

Property Value

Interval<T>

The intersection.

IsEmpty

Gets a value indicating whether this instance represents the default empty set.

public bool IsEmpty { get; }

Property Value

bool

true if this instance contains no element; otherwise, false.

See Also

IsSingleton

Gets a value indicating whether this instance represents a singleton.

public bool IsSingleton { get; }

Property Value

bool

true if this instance contains only one element; otherwise, false.

See Also

IsUniverse

Gets a value indicating whether this instance represents an universe.

public bool IsUniverse { get; }

Property Value

bool

true if this instance represents an universe; otherwise, false.

See Also

Methods

IsSingletonOf(T)

Gets a value indicating whether this instance represents a singleton of the specified element.

public bool IsSingletonOf(T value)

Parameters

value T

The element value.

Returns

bool

true if this instance contains only the specified value; otherwise, false.

See Also

Union()

Gets the union of the current IntervalCollection`1.

public IntervalCollection<T> Union()

Returns

IntervalCollection<T>

The union.

Union(UnionDenominator)

Gets the union of the current IntervalCollection`1 according to the specified denominator.

public IntervalCollection<T> Union(UnionDenominator denominator)

Parameters

denominator UnionDenominator

The denominator considered while performing the union.

Returns

IntervalCollection<T>

The union.

Remarks

While performing an UnionOf intervals, depending of the specified UnionDenominator, the result will be different. If you consider the following intervals:

a]∞ ; 3[
b]0 ; 5[
c[1 ; 2]

The union with the Highest denominator will return an IntervalCollection<T> of 1 element as shown below:

i]∞ ; 5[

The union with the Lowest denominator will return an IntervalCollection<T> of 5 element as shown below:

i]∞ ; 0]
j]0 ; 1[
k[1 ; 2]
l]2 ; 3[
m[3 ; 5[