/// <summary> /// Class constructor that creates a ranged FloatingPtSpace. /// </summary> /// <param name="min">the inclusive minimum of the range</param> /// <param name="max">the inclusive maximum of the range</param> public FloatingPtSpace(IPUCNumber min, IPUCNumber max) { _ranged = true; _min = min; _max = max; if (_min.GetDoubleValue() >= _max.GetDoubleValue() && !(_min is NumberConstraint) && !(_max is NumberConstraint)) { throw new ArgumentException("FloatingPtSpace: minimum must be less than maximum"); } }
/// <summary> /// Class constructor that creates a ranged, incremented IntegerSpace. /// Incremented means that the value of this space must equal /// <code>min + n * increment</code> for some integer n. /// </summary> /// <param name="min">the inclusive minimum of the range</param> /// <param name="max">the inclusive maximum of the range</param> /// <param name="increment">the increment of the IntegerSpace</param> public IntegerSpace(IPUCNumber min, IPUCNumber max, IPUCNumber increment) { _ranged = true; _min = min; _max = max; if (_min.GetIntValue() > _max.GetIntValue()) { throw new ArgumentException("IntegerSpace: minimum must be less or equal to maximum"); } _incremented = true; _increment = increment; }
/// <summary> /// Class constructor that creates a ranged IntegerSpace. /// </summary> /// <param name="min">the inclusive minimum of the range</param> /// <param name="max">the inclusive maximum of the range</param> public IntegerSpace(IPUCNumber min, IPUCNumber max) { _ranged = true; _min = min; _max = max; if (_min.GetIntValue() > _max.GetIntValue() && !(_min is NumberConstraint) && !(_max is NumberConstraint)) { throw new ArgumentException("IntegerSpace: minimum must be less than maximum"); } _incremented = false; }
/// <summary> /// Class constructor that creates a ranged, incremented FixedPtSpace. /// Incremented means that the value of this space must equal /// <code>min + n * increment</code> for some integer n. /// </summary> /// <param name="pointpos">the location of the decimal point counting from right</param> /// <param name="min">the inclusive minimum of the range</param> /// <param name="max">the inclusive maximum of the range</param> /// <param name="increment">the increment of the FixedPtSpace</param> /// <exception cref="ArgumentException">thrown if pos is less than 0</exception> public FixedPtSpace(int pointpos, IPUCNumber min, IPUCNumber max, IPUCNumber increment) { if (pointpos < 0) { throw new ArgumentException("Point position of FixedPtSpace must be >= 0"); } _pointpos = pointpos; _pointCorrectionFactor = calculateCorrectionFactor(_pointpos); _ranged = true; _min = min; _max = max; if (_min.GetDoubleValue() >= _max.GetDoubleValue()) { throw new ArgumentException("FixedPtSpace: minimum must be less than maximum"); } _incremented = true; _increment = increment; }
public StringSpace(IPUCNumber maxChars) : this(null, null, maxChars) { }
public StringSpace(IPUCNumber minChars, IPUCNumber maxChars) : this(minChars, null, maxChars) { }
/* * Constructor */ public StringSpace(IPUCNumber minChars, IPUCNumber aveChars, IPUCNumber maxChars) { _minCharacters = minChars; _aveCharacters = aveChars; _maxCharacters = maxChars; }