Ejemplo n.º 1
0
        internal void SetTree(ObjectFormulaTree tree,
                              bool next,
                              AssociatedAddition addition,
                              IList <IMeasurement> list)
        {
            string dn = "D" + symbol;

            this.tree = tree;
            IDistribution d = DeltaFunction.GetDistribution(tree);

            if (next)
            {
                if (d != null)
                {
                    temp = new FormulaMeasurementDerivationDistribution(tree, null, symbol, addition);
                }
                else
                {
                    temp = new FormulaMeasurementDerivation(tree, null, symbol, addition);
                }
                derivation = temp;
                list.Add(derivation);
                return;
            }
            if (d != null)
            {
                derivation = new FormulaMeasurementDistribution(tree, symbol, addition);
            }
            else
            {
                derivation = new FormulaMeasurement(tree, symbol, addition);
            }
            list.Add(derivation);
            return;
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Iterates calculation of derivation
        /// </summary>
        /// <param name="next">The "next" msign</param>
        /// <param name="addition">Associated addition</param>
        /// <returns>Next derivation iteration</returns>
        public FormulaMeasurementDerivation Iterate(bool next, AssociatedAddition addition)
        {
            string             dn = "D" + name;
            ObjectFormulaTree  t  = tree.Derivation("d/dt");
            IDistribution      d  = DeltaFunction.GetDistribution(t);
            AssociatedAddition aa = FormulaMeasurementDerivation.Create(associated);

            if (next)
            {
                FormulaMeasurementDerivation der = null;
                if (d != null)
                {
                    der = new FormulaMeasurementDerivationDistribution(t, dn, aa);
                }
                else
                {
                    der = new FormulaMeasurementDerivation(t, dn, aa);
                }
                derivation = der;
                return(der);
            }
            if (d != null)
            {
                derivation = new FormulaMeasurementDistribution(t, dn, aa);
            }
            else
            {
                derivation = new FormulaMeasurement(t, dn, aa);
            }
            return(null);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Creates measure
        /// </summary>
        /// <param name="tree">Tree</param>
        /// <param name="n">Number of tree</param>
        /// <param name="name">Name</param>
        /// <param name="associated">Associated addition</param>
        /// <returns>Measurement</returns>
        public static FormulaMeasurement Create(ObjectFormulaTree tree, int n,
                                                string name, AssociatedAddition associated)
        {
            object ret = null;

            try
            {
                ret = tree.Result;
            }
            catch (Exception ex)
            {
                ex.ShowError(-1);
            }
            FormulaMeasurement fm;

            if (n == 0)
            {
                IDistribution d = DeltaFunction.GetDistribution(tree);
                if (d != null)
                {
                    return(new FormulaMeasurementDistribution(tree, name, associated));
                }
                fm     = new FormulaMeasurement(tree, name, associated);
                fm.ret = ret;
                return(fm);
            }
            string            dn = "D" + name;
            ObjectFormulaTree t  = tree.Derivation("d/dt");

            if (t == null)
            {
                throw new Exception("VariableMeasure.Derivation");
            }
            AssociatedAddition aa  = FormulaMeasurementDerivation.Create(associated);
            FormulaMeasurement der = Create(t, n - 1, dn, aa);

            fm = new FormulaMeasurementDerivation(tree, der, name, aa);
            try
            {
                fm.ret = t.Result;
            }
            catch (Exception exc)
            {
                exc.ShowError(10);
            }
            return(fm);
        }
Ejemplo n.º 4
0
        internal void Iterate(bool next)
        {
            AssociatedAddition aa = FormulaMeasurementDerivation.Create(addition);

            temp = temp.Iterate(next, aa);
        }