Table of Contents

DiscreteInterval Class

Definition

Namespace
Bodu.Numerics
Assembly
Bodu.Numerics.dll
Package
Bodu.Numerics 1.0.0
Source
DiscreteInterval{T}.Helpers.cs

Provides type-inferring factory methods for DiscreteInterval<T>, mirroring the static factories on the type but inferring the endpoint type from the arguments.

public static class DiscreteInterval
Inheritance
DiscreteInterval
Inherited Members

Methods

AtLeast<T>(T)

Creates a lower-bounded interval [lower, +∞) with T inferred from the argument.

public static DiscreteInterval<T> AtLeast<T>(T lower) where T : IBinaryInteger<T>

Parameters

lower T

The inclusive lower bound.

Returns

DiscreteInterval<T>

An upper-unbounded interval.

Type Parameters

T

The integer endpoint type, inferred at the call site.

AtMost<T>(T)

Creates an upper-bounded interval (-∞, upper] with T inferred from the argument.

public static DiscreteInterval<T> AtMost<T>(T upper) where T : IBinaryInteger<T>

Parameters

upper T

The inclusive upper bound.

Returns

DiscreteInterval<T>

A lower-unbounded interval.

Type Parameters

T

The integer endpoint type, inferred at the call site.

ClosedOpen<T>(T, T)

Creates a closed-open interval [lower, upper) with T inferred from the arguments.

public static DiscreteInterval<T> ClosedOpen<T>(T lower, T upper) where T : IBinaryInteger<T>

Parameters

lower T

The inclusive lower bound.

upper T

The exclusive upper bound.

Returns

DiscreteInterval<T>

The canonicalized interval.

Type Parameters

T

The integer endpoint type, inferred at the call site.

Closed<T>(T, T)

Creates a closed interval [lower, upper] with T inferred from the arguments.

public static DiscreteInterval<T> Closed<T>(T lower, T upper) where T : IBinaryInteger<T>

Parameters

lower T

The inclusive lower bound.

upper T

The inclusive upper bound.

Returns

DiscreteInterval<T>

The interval.

Type Parameters

T

The integer endpoint type, inferred at the call site.

GreaterThan<T>(T)

Creates a lower-bounded interval (lower, +∞) with T inferred from the argument.

public static DiscreteInterval<T> GreaterThan<T>(T lower) where T : IBinaryInteger<T>

Parameters

lower T

The exclusive lower bound.

Returns

DiscreteInterval<T>

An upper-unbounded interval.

Type Parameters

T

The integer endpoint type, inferred at the call site.

LessThan<T>(T)

Creates an upper-bounded interval (-∞, upper) with T inferred from the argument.

public static DiscreteInterval<T> LessThan<T>(T upper) where T : IBinaryInteger<T>

Parameters

upper T

The exclusive upper bound.

Returns

DiscreteInterval<T>

A lower-unbounded interval.

Type Parameters

T

The integer endpoint type, inferred at the call site.

OpenClosed<T>(T, T)

Creates an open-closed interval (lower, upper] with T inferred from the arguments.

public static DiscreteInterval<T> OpenClosed<T>(T lower, T upper) where T : IBinaryInteger<T>

Parameters

lower T

The exclusive lower bound.

upper T

The inclusive upper bound.

Returns

DiscreteInterval<T>

The canonicalized interval.

Type Parameters

T

The integer endpoint type, inferred at the call site.

Open<T>(T, T)

Creates an open interval (lower, upper) with T inferred from the arguments.

public static DiscreteInterval<T> Open<T>(T lower, T upper) where T : IBinaryInteger<T>

Parameters

lower T

The exclusive lower bound.

upper T

The exclusive upper bound.

Returns

DiscreteInterval<T>

The canonicalized interval.

Type Parameters

T

The integer endpoint type, inferred at the call site.

Singleton<T>(T)

Creates a single-integer interval [value, value] with T inferred from the argument.

public static DiscreteInterval<T> Singleton<T>(T value) where T : IBinaryInteger<T>

Parameters

value T

The single integer.

Returns

DiscreteInterval<T>

A one-element interval.

Type Parameters

T

The integer endpoint type, inferred at the call site.

Applies to

ProductVersions
.NET8, 10