Ejemplo n.º 1
0
        /// <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");
            }
        }
Ejemplo n.º 2
0
        /// <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;
        }
Ejemplo n.º 3
0
        /// <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;
        }
Ejemplo n.º 4
0
        /// <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;
        }
Ejemplo n.º 5
0
 public StringSpace(IPUCNumber maxChars)
     : this(null, null, maxChars)
 {
 }
Ejemplo n.º 6
0
 public StringSpace(IPUCNumber minChars, IPUCNumber maxChars)
     : this(minChars, null, maxChars)
 {
 }
Ejemplo n.º 7
0
        /*
         * Constructor
         */

        public StringSpace(IPUCNumber minChars, IPUCNumber aveChars, IPUCNumber maxChars)
        {
            _minCharacters = minChars;
            _aveCharacters = aveChars;
            _maxCharacters = maxChars;
        }