C# Класс Sharith.MathUtils.PositiveRange

a PositiveRange is an interval of integers, given by a lower bound Min and an upper bound Max, such that 0 <= Min and Min <= Max. a PositiveRange is immutable.
Наследование: ICloneable
Показать файл Открыть проект Примеры использования класса

Открытые свойства

Свойство Тип Описание
Max int
Min int

Открытые методы

Метод Описание
Clone ( ) : object

Overrides System.Object.Clone()

Contains ( PositiveRange range ) : bool

Checks if the given range is a subrange, bo.exp. this.Min <= range.Min and range.Max <= this.Max.

Contains ( int value ) : bool

Checks if the given value lies within the range, i.e. Min <= value and value <= Max.

ContainsOrFail ( PositiveRange range ) : bool

Checks if the given range is a subrange, bo.exp. this.Min <= range.Min and range.Max <= this.Max. If the range ist not contained an ArgumentOutOfRangeException will be raised.

ContainsOrFail ( int value ) : bool

Checks if the given value lies within the range, bo.exp. Min <= value and value <= Max. If the value ist not contained an ArgumentOutOfRangeException will be raised.

Equals ( PositiveRange that ) : bool

Compares this range to the specified range. The results is true if and only if the argument has the same values as this object.

Equals ( object obj ) : bool

Compares this range to the specified object. The results is true if and only if the argument is not null and is a PositiveRange object that has the same values as this object.

GetHashCode ( ) : int

a hash code value for this range.

PositiveRange ( int low, int high ) : System

Initializes a new instance of the PositiveRange class, i.e. a range of integers, such that 0 <= low <= high.

Size ( ) : int

The Size of the range.

ToString ( ) : string

Represents the range as a string, formatted as "[Min,Max]".

operator ( ) : bool

Compares this range to the specified range. The results is true if and only if the arguments do not have the same value.

Описание методов

Clone() публичный Метод

Overrides System.Object.Clone()
public Clone ( ) : object
Результат object

Contains() публичный Метод

Checks if the given range is a subrange, bo.exp. this.Min <= range.Min and range.Max <= this.Max.
public Contains ( PositiveRange range ) : bool
range PositiveRange The range to be checked.
Результат bool

Contains() публичный Метод

Checks if the given value lies within the range, i.e. Min <= value and value <= Max.
public Contains ( int value ) : bool
value int The value to checked.
Результат bool

ContainsOrFail() публичный Метод

Checks if the given range is a subrange, bo.exp. this.Min <= range.Min and range.Max <= this.Max. If the range ist not contained an ArgumentOutOfRangeException will be raised.
public ContainsOrFail ( PositiveRange range ) : bool
range PositiveRange The range to be checked.
Результат bool

ContainsOrFail() публичный Метод

Checks if the given value lies within the range, bo.exp. Min <= value and value <= Max. If the value ist not contained an ArgumentOutOfRangeException will be raised.
public ContainsOrFail ( int value ) : bool
value int The value to checked.
Результат bool

Equals() публичный Метод

Compares this range to the specified range. The results is true if and only if the argument has the same values as this object.
public Equals ( PositiveRange that ) : bool
that PositiveRange a positive range to compare with.
Результат bool

Equals() публичный Метод

Compares this range to the specified object. The results is true if and only if the argument is not null and is a PositiveRange object that has the same values as this object.
public Equals ( object obj ) : bool
obj object The object to compare with.
Результат bool

GetHashCode() публичный Метод

a hash code value for this range.
public GetHashCode ( ) : int
Результат int

PositiveRange() публичный Метод

Initializes a new instance of the PositiveRange class, i.e. a range of integers, such that 0 <= low <= high.
public PositiveRange ( int low, int high ) : System
low int The lower bound (Min) of the range.
high int The upper bound (Max) of the range.
Результат System

Size() публичный Метод

The Size of the range.
public Size ( ) : int
Результат int

ToString() публичный Метод

Represents the range as a string, formatted as "[Min,Max]".
public ToString ( ) : string
Результат string

operator() публичный статический Метод

Compares this range to the specified range. The results is true if and only if the arguments do not have the same value.
public static operator ( ) : bool
Результат bool

Описание свойств

Max публичное свойство

Gets upper bound (Max) of the interval.
public int Max
Результат int

Min публичное свойство

Gets the lower bound (Min) of the interval.
public int Min
Результат int