C# Class 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.
Inheritance: ICloneable
显示文件 Open project: PeterLuschny/Fast-Factorial-Functions Class Usage Examples

Public Properties

Property Type Description
Max int
Min int

Public Methods

Method Description
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.

Method Details

Clone() public method

Overrides System.Object.Clone()
public Clone ( ) : object
return object

Contains() public method

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.
return bool

Contains() public method

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.
return bool

ContainsOrFail() public method

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.
return bool

ContainsOrFail() public method

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.
return bool

Equals() public method

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.
return bool

Equals() public method

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.
return bool

GetHashCode() public method

a hash code value for this range.
public GetHashCode ( ) : int
return int

PositiveRange() public method

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.
return System

Size() public method

The Size of the range.
public Size ( ) : int
return int

ToString() public method

Represents the range as a string, formatted as "[Min,Max]".
public ToString ( ) : string
return string

operator() public static method

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
return bool

Property Details

Max public_oe property

Gets upper bound (Max) of the interval.
public int Max
return int

Min public_oe property

Gets the lower bound (Min) of the interval.
public int Min
return int