using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Revitalize.Framework.Utilities
{
///
/// A class for dealing with integer value ranges.
///
public class IntRange
{
///
/// The min value for the range.
///
public int min;
///
/// The max value for the range.
///
public int max;
public IntRange()
{
}
///
/// Constructor.
///
/// The single value to be tested on for min and max. Note that this will fail every test except for ContainsInclusive.
public IntRange(int SingleValue)
{
this.min = this.max = SingleValue;
}
///
/// Constructor.
///
/// The min value.
/// The max value.
public IntRange(int Min, int Max)
{
this.min = Min;
this.max = Max;
}
///
/// Checks to see if the value is inside the range.
///
///
///
public bool ContainsInclusive(int value)
{
if (value >= this.min && value <= this.max) return true;
else return false;
}
///
/// Checks to see if the value is greater/equal than the min but less than the max.
///
///
///
public bool ContainsExclusiveCeil(int value)
{
if (value >= this.min && value < this.max) return true;
else return false;
}
///
/// Checks to see if the value is greater than the min and less/equal to the max.
///
///
///
public bool ContainsExclusiveFloor(int value)
{
if (value >= this.min && value < this.max) return true;
else return false;
}
///
/// Checks to see if the value is inside of the range but not equal to min or max.
///
///
///
public bool ContainsExclusive(int value)
{
if (value > this.min && value < this.max) return true;
else return false;
}
}
}