/// <summary>
        /// Constructor
        /// </summary>
        /// <param name="selection">Selection</param>
        /// <param name="formula">Formula</param>
        public FormulaStructuredCalculator(IArgumentSelection selection, VectorFormulaConsumer formula)
        {
            this.formula    = formula;
            this.selection  = selection;
            vectorDimension = selection.VectorDimension;
            measurements    = formula;
            if (vectorDimension != measurements.Count)
            {
                throw new Exception("Illegal dimension");
            }
            variables = selection.Variables;
            IList <string> l = formula.AliasNames;

            parameters = new ArrayList();
            foreach (string n in l)
            {
                parameters.Add(n);
            }
            foreach (string str in variables)
            {
                if (!parameters.Contains(str))
                {
                    throw new Exception("Illegal variable");
                }
                parameters.Remove(str);
            }
            parameters.Sort();
        }
예제 #2
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="formulas">Formula consumer</param>
        public FormulaArrayCalculator(VectorFormulaConsumer formulas)
        {
            this.formulas = formulas;
            IMeasurements  m  = formulas;
            IList <string> al = formulas.AliasNames;
            List <string>  a  = new List <string>();

            for (int i = 0; i < al.Count; i++)
            {
                a.Add(al[i]);
            }
            a.Sort();
            arguments = new string[al.Count];
            for (int i = 0; i < a.Count; i++)
            {
                arguments[i] = a[i] as string;
            }
            dim        = formulas.Count;
            calculator = new ArrayCalculator(calculate);
            number     = staticNumber;
            //AddCalculator(calculator);
        }