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
TNumeric 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
MinTMaxT
Properties
IsValid
public bool IsValid { get; }
Property Value
- bool
Length
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
valueT
Returns
- T
Contains(T)
Returns true when value falls inside the inclusive range.
public bool Contains(T value)
Parameters
valueT
Returns
- bool
WithMax(T)
Returns a copy of the range with Max replaced.
public BOBNumericRange<T> WithMax(T max)
Parameters
maxT
Returns
WithMin(T)
Returns a copy of the range with Min replaced.
public BOBNumericRange<T> WithMin(T min)
Parameters
minT