# RangeL

## Description

`struct` `Tinman.Core.Math.RangeL`

A half-closed range of numbers (64-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` → `(RangeL)`

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` → `(RangeL)`

A range that contains all 64-bit integers.

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

### Pos

`public` `static` `readonly` `attribute` `Pos` → `(RangeL)`

A range that contains all positive 64-bit integers.

### Zero

`public` `static` `readonly` `attribute` `Zero` → `(RangeL)`

A range at offset zero with zero length.

## Public / Constructors

### Closed

`[Pure]`
`public` `static` `method` `Closed` → `(2)`

in : int64

Left value of interval.

in : int64

Right value of interval.

returns → RangeL

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

`[Pure]`
`public` `static` `method` `Of1` → `(1)`

in : int64

The value to contain.

returns → RangeL

The range value.

Returns the shortest possible range that contains the given value.

`[Pure]`
`public` `static` `method` `Of2` → `(2)`

in : int64

First value to contain.

in : int64

Second value to contain.

returns → RangeL

The range value.

Returns the shortest possible range that contains the given values.

`[Pure]`
`public` `static` `method` `Of3` → `(3)`

in : int64

First value to contain.

in : int64

Second value to contain.

in : int64

Third value to contain.

returns → RangeL

The range value.

Returns the shortest possible range that contains the given values.

### Open

`[Pure]`
`public` `static` `method` `Open` → `(2)`

in : int64

Left value of interval.

in : int64

Right value of interval.

returns → RangeL

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 : int64

Left value of interval.

in : int64

Right value of interval.

returns → RangeL

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 : int64

Left value of interval.

in : int64

Right value of interval.

returns → RangeL

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 / Methods

### Clamp

`[Pure]`
`public` `method` `Clamp` → `(1)`

value in : int64

The value to clamp.

returns → int64

The clamped value.

Clamps the given value to this range.

### Contains

`[Pure]`
`public` `method` `Contains1` → `(1)`

value in : int64

The value.

returns → bool

`true` if value in is contained in this range, `false` if not.

Checks if this range contains the given value.

`[Pure]`
`public` `method` `Contains2` → `(1)`

range in : RangeL

The range.

returns → bool

`true` if range in is fully contained in this range, `false` if not.

Checks if this range fully contains the given range.

### Grow

`[Pure]`
`public` `method` `Grow1` → `(1)`

value in : int64

The value.

returns → RangeL

The resulting range.

Grows this range so that it contains the given value.

`[Pure]`
`public` `method` `Grow2` → `(1)`

range in : RangeL

The range.

returns → RangeL

The resulting range.

Grows this range so that it fully contains the given range.

### Intersection

`[Pure]`
`public` `method` `Intersection` → `(1)`

other in : RangeL

The other range.

returns → RangeL

The resulting range.

Intersects this range with the given one.

### Intersects

`[Pure]`
`public` `method` `Intersects` → `(1)`

other in : RangeL

The other range.

returns → bool

`true` if both ranges intersect, `false` if not.

Checks if this range intersects with the given one.

### Transform

`[Pure]`
`public` `method` `Transform` → `(2)`

value in : float64

The value to transform.

target in : RangeD

The target range.

returns → float64

The transformed value.

Transforms the given value from this range to the given range.

The method maps Start to target in. RangeF.Start and Last to target in. RangeF.End.
No clamping is performed by this method.

## Public / Attributes

### End

`public` `attribute` `End` → `(get)`

value : int64

End of number range (exclusive).

End of number range (exclusive).

### Is​Empty

`public` `attribute` `IsEmpty` → `(get)`

value : bool

`true` if this range is empty, `false` if it is not.

Is this number range empty?

### Last

`public` `readonly` `attribute` `Last` → `(int64)`

End of number range (inclusive).

### Length

`public` `attribute` `Length` → `(get)`

value : int64

The range length.

Length of this number range.

### Start

`public` `readonly` `attribute` `Start` → `(int64)`

Start of number range (inclusive).

## Serialization

### Serializer

`public` `static` `readonly` `attribute` `Serializer` → `(ITypeSerializer<RangeL>)`

The serialization helper object for values of RangeL.