RangeFactory
Helper class to instantiate IRange derived types, where strong typing is required underneath but the runtime type of IRange is not known
Methods
public static IRange NewRange(IComparable min, IComparable max)
result = RangeFactory.NewRange(min, max)
Creates a new IRange instance of the same type as the min, max range with the specified Min and Max
- min
- The min value of the new range
- max
- The max value of the new range
Returns: A new IRange derived instance of the same type as the input values
public static IRange NewRange(Type rangeType, IComparable min, IComparable max)
result = RangeFactory.NewRange(rangeType, min, max)
Creates a new IRange instance of desired type, setting the min and max value
- rangeType
- Type of the range to create, e.g. IndexRange or DoubleRange.
- min
- The min value of the new range
- max
- The max value of the new range
Returns: A new IRange derived instance of the same type as the input values
public static IRange NewWithMinMax(IRange originalRange, IComparable min, IComparable max)
result = RangeFactory.NewWithMinMax(originalRange, min, max)
Creates a new IRange derived instance of the same type as originalRange with the specified Min and Max
- originalRange
- The original range to use as a reference
- min
- The min value of the new range
- max
- The max value of the new range
Returns: A new IRange derived instance of the same type as originalRange
public static IRange NewWithMinMax(IRange originalRange, double min, double max, IRange rangeLimit)
result = RangeFactory.NewWithMinMax(originalRange, min, max, rangeLimit)
Creates a new IRange derived instance of the same type as originalRange with the specified Min and Max, with a Range Limit to clip min, max to.
- originalRange
- The original range to use as a reference
- min
- The min value of the new range
- max
- The max value of the new range
- rangeLimit
- The range limit to clip Min and Max to.
Returns: A new IRange derived instance of the same type as originalRange