Precondition

Description

static class CodeX.Precondition

Common precondition checks for method arguments.

Public / Methods

Empty


[Pure]
public static method Empty → (1)

str in : string

The string.

returns → bool

true if the string is empty, false if not.

Is the given string empty, i.e. it is null or has a length of 0?

Not​Power​Of​Two

2 overloads


[Pure]
public static method NotPowerOfTwo1 → (1)

number in : int32

The number.

returns → bool

true if number in is not a power of two, false if it is.

Is the given number not a power of two?


[Pure]
public static method NotPowerOfTwo2 → (1)

number in : int64

The number.

returns → bool

true if number in is not a power of two, false if it is.

Is the given number not a power of two?

Not​Power​Of​Two​Plus​One

2 overloads


[Pure]
public static method NotPowerOfTwoPlusOne1 → (1)

number in : int32

The number.

returns → bool

true if number in is not a power of two plus one, false if it is.

Is the given number not a power of two plus one?


[Pure]
public static method NotPowerOfTwoPlusOne2 → (1)

number in : int64

The number.

returns → bool

true if number in is not a power of two plus one, false if it is.

Is the given number not a power of two plus one?

Not​Within​Interval

4 overloads


[Pure]
public static method NotWithinInterval1 → (3)

value in : int32

The value.

minimum in : int32

The lower interval bound (inclusive).

maximum in : int32

The upper interval bound (inclusive).

returns → bool

true if value in is outside of the interval, false if it is inside of it.

Is the given value outside of the specified interval?


[Pure]
public static method NotWithinInterval2 → (3)

value in : int64

The value.

minimum in : int64

The lower interval bound (inclusive).

maximum in : int64

The upper interval bound (inclusive).

returns → bool

true if value in is outside of the interval, false if it is inside of it.

Is the given value outside of the specified interval?


[Pure]
public static method NotWithinInterval3 → (3)

value in : float32

The value.

minimum in : float32

The lower interval bound (inclusive).

maximum in : float32

The upper interval bound (inclusive).

returns → bool

true if value in is outside of the interval, false if it is inside of it.

Is the given value outside of the specified interval?


[Pure]
public static method NotWithinInterval4 → (3)

value in : float64

The value.

minimum in : float64

The lower interval bound (inclusive).

maximum in : float64

The upper interval bound (inclusive).

returns → bool

true if value in is outside of the interval, false if it is inside of it.

Is the given value outside of the specified interval?

Not​Within​Range

2 overloads


[Pure]
public static method NotWithinRange1 → (3)

value in : string

The value that contains the element sequence.

first in : int32

The index of the first element in value in.

count in : int32

The element count (starting at first in).

returns → bool

true if all aggregated checks have passed (see remarks),
false if some have failed.

Is the specified index range fully inside the element sequence of the given value?

This precondition check is a shortcut for the following aggregated checks:

  1. value in is not null.

  2. first in is within [0..N], where N is element count of value in.

  3. count in is within [0..N-first].


[Pure]
public static method NotWithinRange2 → (3)<T>

value in : T [ ]

The value that contains the element sequence.

first in : int32

The index of the first element in value in.

count in : int32

The element count (starting at first in).

returns → bool

true if all aggregated checks have passed (see remarks),
false if some have failed.

Is the specified index range fully inside the element sequence of the given value?

This precondition check is a shortcut for the following aggregated checks:

  1. value in is not null.

  2. first in is within [0..N], where N is element count of value in.

  3. count in is within [0..N-first].

Not​Within​Range​Auto

2 overloads


[Pure]
public static method NotWithinRangeAuto1 → (3)

value in : string

The value that contains the element sequence.

first in : int32

The index of the first element in value in.

count in : int32

The element count (starting at first in) or -1.

returns → bool

true if all aggregated checks have passed (see remarks),
false if some have failed.

Is the specified index range fully inside the element sequence of the given value?

This precondition check is a shortcut for the following aggregated checks:

  1. value in is not null.

  2. first in is within [0..N], where N is element count of value in.

  3. count in is within [-1..N-first], where -1 means all elements after first in.


[Pure]
public static method NotWithinRangeAuto2 → (3)<T>

value in : T [ ]

The value that contains the element sequence.

first in : int32

The index of the first element in value in.

count in : int32

The element count (starting at first in) or -1.

returns → bool

true if all aggregated checks have passed (see remarks),
false if some have failed.

Is the specified index range fully inside the element sequence of the given value?

This precondition check is a shortcut for the following aggregated checks:

  1. value in is not null.

  2. first in is within [0..N], where N is element count of value in.

  3. count in is within [-1..N-first], where -1 means all elements after first in.

Not​Within​Range​Closed

2 overloads


[Pure]
public static method NotWithinRangeClosed1 → (2)

value in : string

The value that contains the element sequence.

index in : int32

The index of the element in value in.

returns → bool

true if all aggregated checks have passed (see remarks),
false if some have failed.

Is the specified index fully inside the element sequence of the given value?

This precondition check is a shortcut for the following aggregated checks:

  1. value in is not null.

  2. index in is within [0..N], where N is element count of value in.


[Pure]
public static method NotWithinRangeClosed2 → (2)<T>

value in : T [ ]

The value that contains the element sequence.

index in : int32

The index of the element in value in.

returns → bool

true if all aggregated checks have passed (see remarks),
false if some have failed.

Is the specified index fully inside the element sequence of the given value?

This precondition check is a shortcut for the following aggregated checks:

  1. value in is not null.

  2. index in is within [0..N], where N is element count of value in.

Not​Within​Range​Open

2 overloads


[Pure]
public static method NotWithinRangeOpen1 → (2)

value in : string

The value that contains the element sequence.

index in : int32

The index of the element in value in.

returns → bool

true if all aggregated checks have passed (see remarks),
false if some have failed.

Is the specified index fully inside the element sequence of the given value?

This precondition check is a shortcut for the following aggregated checks:

  1. value in is not null.

  2. index in is within [0..N-1], where N is element count of value in.


[Pure]
public static method NotWithinRangeOpen2 → (2)<T>

value in : T [ ]

The value that contains the element sequence.

index in : int32

The index of the element in value in.

returns → bool

true if all aggregated checks have passed (see remarks),
false if some have failed.

Is the specified index fully inside the element sequence of the given value?

This precondition check is a shortcut for the following aggregated checks:

  1. value in is not null.

  2. index in is within [0..N-1], where N is element count of value in.