Table of Contents

Struct BOBNumericRange<T>

Namespace
BlazOrbit.Components
Assembly
BlazOrbit.Core.dll

Immutable inclusive numeric range used by range-style components. Wraps a T minimum and maximum and provides validation, containment, and clamping helpers backed by generic math.

public readonly struct BOBNumericRange<T> where T : struct, INumber<T>

Type Parameters

T

Numeric value type that participates in System.Numerics.INumber<TSelf>.

Constructors

BOBNumericRange(T, T)

Immutable inclusive numeric range used by range-style components. Wraps a T minimum and maximum and provides validation, containment, and clamping helpers backed by generic math.

public BOBNumericRange(T Min, T Max)

Parameters

Min T
Max T

Properties

IsValid

true when Min is less than or equal to Max.

public bool IsValid { get; }

Property Value

bool

Length

Distance between Min and Max; equals Max - Min.

public T Length { get; }

Property Value

T

Max

public T Max { get; init; }

Property Value

T

Min

public T Min { get; init; }

Property Value

T

Methods

Clamp(T)

Clamps value so the result lies inside the inclusive range.

public T Clamp(T value)

Parameters

value T

Returns

T

Contains(T)

Returns true when value falls inside the inclusive range.

public bool Contains(T value)

Parameters

value T

Returns

bool

WithMax(T)

Returns a copy of the range with Max replaced.

public BOBNumericRange<T> WithMax(T max)

Parameters

max T

Returns

BOBNumericRange<T>

WithMin(T)

Returns a copy of the range with Min replaced.

public BOBNumericRange<T> WithMin(T min)

Parameters

min T

Returns

BOBNumericRange<T>