Пример #1
0
        private IFormulaComponent[] CreateComponents(ParseTreeElement rootElement)
        {
            IList list = new ArrayList();

            rootElement.AddAsRPN(list);

            var arr = new IFormulaComponent[list.Count];

            list.CopyTo(arr, 0);
            return(arr);
        }
Пример #2
0
        private void CloneComponents(Formula cloneFormula)
        {
            cloneFormula._components    = new IFormulaComponent[_components.Length];
            cloneFormula._rawReferences = new Reference[_rawReferences.Length];
            int index = 0;

            // We clone all the components and make sure that the component and its corresponding raw reference
            // are the same since this is how a new formula would be setup.
            for (int i = 0; i <= _components.Length - 1; i++)
            {
                IFormulaComponent component = _components[i];
                var cloneComponent          = (IFormulaComponent)component.Clone();
                cloneFormula._components[i] = cloneComponent;
                var @ref = cloneComponent as Reference;
                if (@ref != null)
                {
                    cloneFormula._rawReferences[index] = @ref;
                    index += 1;
                }
            }
        }