Esempio n. 1
0
        public IUPACCompound(string iupacName)
        {
            string mainChainDescription = FindMainChainPart(iupacName);

            Enums.ChainTypes chaintype;

            if (mainChainDescription.StartsWith("cyclo"))
            {
                chaintype            = Enums.ChainTypes.Cyclo;
                mainChainDescription = UtilStrings.RemoveAtStart(mainChainDescription, "cyclo");
            }
            else
            {
                chaintype = Enums.ChainTypes.Straight;
            }

            int mainChainLength = CarbonMainChain.FindMainChainLength(mainChainDescription);

            string remaining;

            if (iupacName.Contains(Constants.EndBracket))
            {
                remaining = UtilStrings.RemoveEverythingAfter(iupacName, Constants.EndBracket);
            }
            else
            {
                remaining = UtilStrings.RemoveEverythingAfter(iupacName, Constants.SubChainEnd);
            }

            List <int> doubleBondLocations, tripleBondLocations;

            GetDoubleAndTripleBondLocations(iupacName, out doubleBondLocations, out tripleBondLocations);
            Formula = new Formula(chaintype, 0, mainChainLength, doubleBondLocations, tripleBondLocations, remaining);
        }
        public static string RemoveMultiplyingAffixName(string line)
        {
            List <string> affixNames = GetAllNames();
            string        affixName  = UtilStrings.FindPattern(line, affixNames, UtilStrings.SearchDirection.Forward);

            if (!String.IsNullOrEmpty(affixName))
            {
                return(UtilStrings.RemoveAtStart(line, affixName));
            }
            else
            {
                return(line);
            }
        }