public DistributionSpaceIteratorSpecification(IDistribution d)
        {
            _specs = new List <DistributionParameterIteratorSpecification>();

            for (int i = 0; i < d.Params; i++)
            {
                DistributionParameterIteratorSpecification pis = new DistributionParameterIteratorSpecification();
                pis.ID   = i;
                pis.Name = d.getParamName(i);
                pis.Min  = d.getParamMin(i);
                pis.Max  = d.getParamMax(i);
                pis.Step = DEFAULT_STEP;
                _specs.Add(pis);
            }
        }
        public int[] ApplyToDistribution(IDistribution d)
        {
            if (d.Params != _specs.Count)
            {
                throw new Exception("Incompatible Param count " + d.Params + " != " + _specs.Count + " between DistributionSpaceIteratorSpecification and IDistribution");
            }

            int [] steps = new int [d.Params];

            /*
             * foreach (DistributionParameterIteratorSpecification pis in _specs) {
             *      int i = pis.ID;
             *      Console.WriteLine ("" + i + ": " + d.getParamName (i));
             * }
             */

            for (int pnum = 0; pnum < d.Params; pnum++)
            {
                string d_paramname = d.getParamName(pnum);

                DistributionParameterIteratorSpecification pis_found = null;
                foreach (DistributionParameterIteratorSpecification pis in _specs)
                {
                    int i = pis.ID;
                    if (d_paramname == pis.Name)
                    {
                        pis_found = pis;
                        break;
                    }
                }
                if (pis_found == null)
                {
                    throw new Exception("Incompatible Parameter# " + pnum + " d:" + d_paramname + " not in DistributionSpaceIteratorSpecification");
                }

                d.setParamMin(pnum, pis_found.Min);
                d.setParamMax(pnum, pis_found.Max);
                steps[pnum] = pis_found.Step;
            }

            return(steps);
        }