Table of Contents

Struct Interval<T>.ClosedOpen

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

Represents a half-open interval [Start, End) over a comparable type, modeled as a set with membership and containment operations.

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

Remarks

The half-open convention [Start, End) means Start is inclusive and End is exclusive. The interval is empty when Start >= End, making [n, n) a natural representation for a cursor position with no selection.

Constructors

ClosedOpen(T, T)

Creates a new half-open interval [start, end).

public ClosedOpen(T start, T end)

Parameters

start T
end T

Fields

End

The exclusive 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(ClosedOpen)

Subset test: other ⊆ this.

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

Parameters

other Interval<T>.ClosedOpen

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(ClosedOpen)

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

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

Parameters

other Interval<T>.ClosedOpen

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(ClosedOpen)

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

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

Parameters

other Interval<T>.ClosedOpen

Returns

Interval<T>.ClosedOpen

Overlaps(ClosedOpen)

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

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

Parameters

other Interval<T>.ClosedOpen

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 ==(ClosedOpen, ClosedOpen)

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

Parameters

left Interval<T>.ClosedOpen
right Interval<T>.ClosedOpen

Returns

bool

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

Implicit conversion from a 2-tuple to a half-open interval.

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

Parameters

tuple (T Start, T End)

Returns

Interval<T>.ClosedOpen

operator !=(ClosedOpen, ClosedOpen)

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

Parameters

left Interval<T>.ClosedOpen
right Interval<T>.ClosedOpen

Returns

bool