RangeI

Description

struct Tinman.Core.Math.RangeI

A half-closed range of numbers (32-bit integers): [Start..End[

                    Last := End - 1
                    vvvvv
+----+----+----+----+----+----+----+----+----+
| -4 | -3 | -2 | -1 |  0 |  1 |  2 |  3 |  4 |-->  Number axis
+----+----+----+----+----+----+----+----+----+
     ^^^^^               ^^^^^
     Start (inclusive)   End (exclusive)
     \___________________/
      Length := End - Start

Public / Constants

Inv


public static readonly attribute Inv → (RangeI)

The value of Max, with swapped start and end values.

This range can be used as the initial value for finding the minimum/maximum of a series of numbers (see Grow).

Max


public static readonly attribute Max → (RangeI)

A range that contains all 32-bit integers.

Note that the length of this range is 2^32 (4294967296), which cannot be expressed using 32-bits. So instead 0 is returned.

Pos


public static readonly attribute Pos → (RangeI)

A range that contains all positive 32-bit integers, including zero.

Zero


public static readonly attribute Zero → (RangeI)

A range at offset zero with zero length.

Public / Constructors

Closed


[Pure]
public static method Closed → (2)

in : int32

Left value of interval.

in : int32

Right value of interval.

returns → RangeI

The range value.

Returns a range that represents the closed interval [a..b] (i.e. both a and b are contained in the range).

Of

3 overloads


[Pure]
public static method Of1 → (1)

in : int32

The value to contain.

returns → RangeI

The range value.

Returns the shortest possible range that contains the given value.


[Pure]
public static method Of2 → (2)

in : int32

First value to contain.

in : int32

Second value to contain.

returns → RangeI

The range value.

Returns the shortest possible range that contains the given values.


[Pure]
public static method Of3 → (3)

in : int32

First value to contain.

in : int32

Second value to contain.

in : int32

Third value to contain.

returns → RangeI

The range value.

Returns the shortest possible range that contains the given values.

Open


[Pure]
public static method Open → (2)

in : int32

Left value of interval.

in : int32

Right value of interval.

returns → RangeI

The range value.

Returns a range that represents the open interval ]a..b[ (i.e. neither a nor b is contained in the range).

Open​Left


[Pure]
public static method OpenLeft → (2)

in : int32

Left value of interval.

in : int32

Right value of interval.

returns → RangeI

The range value.

Returns a range that represents the half-open interval ]a..b] (i.e. a is not contained in the range but b is).

Open​Right


[Pure]
public static method OpenRight → (2)

in : int32

Left value of interval.

in : int32

Right value of interval.

returns → RangeI

The range value.

Returns a range that represents the half-open interval [a..b[ (i.e. a is contained in the range but b is not).

Public / Attributes

End


public attribute End → (get)

value : int32

End of number range (exclusive).

End of number range (exclusive).

Last


public readonly attribute Last → (int32)

End of number range (inclusive).

Start


public readonly attribute Start → (int32)

Start of number range (inclusive).

Serialization

Serializer


public static readonly attribute Serializer → (ITypeSerializer<RangeI>)

The serialization helper object for values of RangeI.