Beispiel #1
0
        public override object Parse(MathCell ownerMathCell)
        {
            ownerMathCell.ResetReferences();

            string formula = ownerMathCell.Formula;

            if (AddressesHandler.HasAnyAddress(formula))
            {
                List <string> formulaReferences = AddressesHandler.GetAddresses(formula);
                for (int i = 0; i < formulaReferences.Count; ++i)
                {
                    string reference = formulaReferences[i];

                    MathCell refCell =
                        MathCellsProvider.GetInstance.GetMathCell(reference);

                    if (!ownerMathCell.References.Contains(refCell))
                    {
                        ownerMathCell.InsertReference(refCell);
                    }

                    if (!refCell.Dependents.Contains(ownerMathCell))
                    {
                        refCell.InsertDependent(ownerMathCell);
                    }
                }
            }

            return(base.Parse(ownerMathCell));
        }
Beispiel #2
0
        public override object Parse(MathCell ownerMathCell)
        {
            // Removes spaces for proper parsing
            string formula = ownerMathCell.Formula = RemoveSpaces(ownerMathCell.Formula);

            List <string> refAddresses = AddressesHandler.GetAddresses(formula);

            if (refAddresses.Count != 0 && formula.First() != '=')
            {
                ownerMathCell.ResetReferences();
                throw new InvalidReferenceFormat();
            }

            if (string.IsNullOrEmpty(formula) || formula.First() != '=')
            {
                ownerMathCell.ResetReferences();
                return(formula);
            }

            return(base.Parse(ownerMathCell)); // Proceed
        }