Table of Contents

Struct Interval<T>.Closed

Namespace
Xui.Core.Math1D
Assembly
Xui.Core.dll

Represents a closed interval [Start, End] over a comparable type, modeled as a set with membership and containment operations.

public struct Interval<T>.Closed : INonEnumerableSet<T>, IEquatable<Interval<T>.Closed>
Implements
Inherited Members

Remarks

The closed convention [Start, End] means both bounds are inclusive. The interval is empty when Start > End.

Constructors

Closed(T, T)

Creates a new closed interval [start, end].

public Closed(T start, T end)

Parameters

start T
end T

Fields

End

The inclusive upper bound of the interval.

public T End

Field Value

T

Start

The inclusive lower bound of the interval.

public T Start

Field Value

T

Properties

IsEmpty

Whether this interval represents the empty set (Start > End).

public bool IsEmpty { get; }

Property Value

bool

Methods

Contains(Closed)

Subset test: other ⊆ this.

public bool Contains(Interval<T>.Closed other)

Parameters

other Interval<T>.Closed

Returns

bool

Contains(T)

Membership test: value ∈ [Start, End].

public bool Contains(T value)

Parameters

value T

Returns

bool

Equals(object?)

Indicates whether this instance and a specified object are equal.

public override bool Equals(object? obj)

Parameters

obj object

The object to compare with the current instance.

Returns

bool

true if obj and this instance are the same type and represent the same value; otherwise, false.

Equals(Closed)

Indicates whether the current object is equal to another object of the same type.

public bool Equals(Interval<T>.Closed other)

Parameters

other Interval<T>.Closed

An object to compare with this object.

Returns

bool

true if the current object is equal to the other parameter; otherwise, false.

GetHashCode()

Returns the hash code for this instance.

public override int GetHashCode()

Returns

int

A 32-bit signed integer that is the hash code for this instance.

Intersect(Closed)

Set intersection: this ∩ other. Returns ∅ if the intervals do not overlap.

public Interval<T>.Closed Intersect(Interval<T>.Closed other)

Parameters

other Interval<T>.Closed

Returns

Interval<T>.Closed

Overlaps(Closed)

Whether two intervals share any elements (this ∩ other ≠ ∅).

public bool Overlaps(Interval<T>.Closed other)

Parameters

other Interval<T>.Closed

Returns

bool

ToString()

Returns the fully qualified type name of this instance.

public override string ToString()

Returns

string

The fully qualified type name.

Operators

operator ==(Closed, Closed)

public static bool operator ==(Interval<T>.Closed left, Interval<T>.Closed right)

Parameters

left Interval<T>.Closed
right Interval<T>.Closed

Returns

bool

implicit operator Closed((T Start, T End))

Implicit conversion from a 2-tuple to a closed interval.

public static implicit operator Interval<T>.Closed((T Start, T End) tuple)

Parameters

tuple (T Start, T End)

Returns

Interval<T>.Closed

operator !=(Closed, Closed)

public static bool operator !=(Interval<T>.Closed left, Interval<T>.Closed right)

Parameters

left Interval<T>.Closed
right Interval<T>.Closed

Returns

bool