Public Member Functions | |
| RangeT (T minimum, T maximum, T increment) | |
| Initializes a new instance of the RangeT<T> class with specified minimum, maximum, and increment values. | |
| T | Clamp (T value) |
| Clamps a value to the bounds of this range. | |
| T | Constrain (T value) |
| Returns a value that is constrained to this range. | |
| override bool | Equals (object? obj) |
| Determines whether the specified object is equal to the current range. | |
| override int | GetHashCode () |
| Returns a hash code for the current range. | |
| override string | ToString () |
| Returns a string representation of the range. | |
Properties | |
| T | Minimum [get] |
| Gets the lower boundary of the range. | |
| T | Maximum [get] |
| Gets the upper boundary of the range. | |
| T | Increment [get] |
| Gets the increment value associated with this range. | |
Represents a numeric range with defined boundaries and a fixed increment. A Range models a continuous sequence of values starting from a minimum value, ending at a maximum value, and progressing in steps defined by an increment. It supports integers and floating-point numbers. This class ensures that the increment does not exceed the total span between the minimum and maximum bounds. The range is inclusive of its boundary values.
| T | The type of the parameters. Must be a value type implementing IComparable. |
| T | : | struct | |
| T | : | IComparable<T> |
|
inline |
Initializes a new instance of the RangeT<T> class with specified minimum, maximum, and increment values.
| minimum | The inclusive starting (lower) boundary of the range. |
| maximum | The inclusive ending (upper) boundary of the range. |
| increment | The step size or increment between values within the range. |
| CommonInvalidParameterException | Thrown when minimum is greater than maximum or when increment is larger than the total range. |
|
inline |
Clamps a value to the bounds of this range.
Values below the minimum are adjusted to the minimum value, while values above the maximum are adjusted to the maximum value.
| value | The value to clamp. |
|
inline |
Returns a value that is constrained to this range.
The value is adjusted to the nearest valid increment and clamped between the minimum and maximum boundaries of this range.
| value | The value to constrain. |
|
inline |
Determines whether the specified object is equal to the current range.
| obj | The object to compare with the current range. |
true if the specified object is equal to the current range; otherwise, false.
|
inline |
Returns a hash code for the current range.
|
inline |
Returns a string representation of the range.
|
get |
Gets the increment value associated with this range.
|
get |
Gets the upper boundary of the range.
|
get |
Gets the lower boundary of the range.