Class OpenInterval<T>
Represents an open interval to the one direction from a given value.
public record OpenInterval<T> : IEquatable<OpenInterval<T>> where T : IComparable<T>
Type Parameters
TThe type of the reference value for the open interval.
- Inheritance
-
OpenInterval<T>
- Implements
- Inherited Members
- Extension Methods
Constructors
OpenInterval(T, ComparisonKinds)
Represents an open interval to the one direction from a given value.
public OpenInterval(T Value, ComparisonKinds ComparisonKinds)
Parameters
ValueTThe open interval's reference value.
ComparisonKindsComparisonKindsThe comparison kinds representing the direction of the open interval. It is applied to the left side of the reference value, for instance >= 4.
Properties
ComparisonKinds
The comparison kinds representing the direction of the open interval. It is applied to the left side of the reference value, for instance >= 4.
public ComparisonKinds ComparisonKinds { get; init; }
Property Value
Value
The open interval's reference value.
public T Value { get; init; }
Property Value
- T
Methods
Contains(T)
Determines whether a value is contained in this open interval.
public bool Contains(T other)
Parameters
otherTThe other value to compare against this open interval.
Returns
- bool
true if the value is contained in the open interval, meaning that
other[comparison] Value is true, otherwise false.
Operators
implicit operator OpenInterval<T>(T)
Converts a value into an OpenInterval<T>, considering the open interval as the single value interval, ranging between the same value.
public static implicit operator OpenInterval<T>(T value)
Parameters
valueTThe reference value of the open interval.
Returns
- OpenInterval<T>