/// A class for dealing with integer value ranges.
/// </summary>
publicclassIntRange
{
/// <summary>
/// The min value for the range.
/// </summary>
publicintmin;
/// <summary>
/// The max value for the range.
/// </summary>
publicintmax;
publicIntRange()
{
}
/// <summary>
/// Constructor.
/// </summary>
/// <param name="SingleValue">The single value to be tested on for min and max. Note that this will fail every test except for ContainsInclusive.</param>
publicIntRange(intSingleValue)
{
this.min=this.max=SingleValue;
}
/// <summary>
/// Constructor.
/// </summary>
/// <param name="Min">The min value.</param>
/// <param name="Max">The max value.</param>
publicIntRange(intMin,intMax)
{
this.min=Min;
this.max=Max;
}
/// <summary>
/// Checks to see if the value is inside the range.
/// </summary>
/// <param name="value"></param>
/// <returns></returns>
publicboolContainsInclusive(intvalue)
{
if(value>=this.min&&value<=this.max)returntrue;
elsereturnfalse;
}
/// <summary>
/// Checks to see if the value is greater/equal than the min but less than the max.
/// </summary>
/// <param name="value"></param>
/// <returns></returns>
publicboolContainsExclusiveCeil(intvalue)
{
if(value>=this.min&&value<this.max)returntrue;
elsereturnfalse;
}
/// <summary>
/// Checks to see if the value is greater than the min and less/equal to the max.
/// </summary>
/// <param name="value"></param>
/// <returns></returns>
publicboolContainsExclusiveFloor(intvalue)
{
if(value>=this.min&&value<this.max)returntrue;
elsereturnfalse;
}
/// <summary>
/// Checks to see if the value is inside of the range but not equal to min or max.