当前位置: 首页>>代码示例>>C#>>正文


C# IAtomContainer.removeAtomAndConnectedElectronContainers方法代码示例

本文整理汇总了C#中IAtomContainer.removeAtomAndConnectedElectronContainers方法的典型用法代码示例。如果您正苦于以下问题:C# IAtomContainer.removeAtomAndConnectedElectronContainers方法的具体用法?C# IAtomContainer.removeAtomAndConnectedElectronContainers怎么用?C# IAtomContainer.removeAtomAndConnectedElectronContainers使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IAtomContainer的用法示例。


在下文中一共展示了IAtomContainer.removeAtomAndConnectedElectronContainers方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: remove

        /// <summary>  Removes an atom from the AtomContainer under certain conditions.
        /// See {@cdk.cite HAN96} for details
        /// 
        /// 
        /// </summary>
        /// <param name="atom">             The atom to be removed
        /// </param>
        /// <param name="ac">               The AtomContainer to work on
        /// </param>
        /// <param name="pathes">           The pathes to manipulate
        /// </param>
        /// <param name="rings">            The ringset to be extended
        /// </param>
        /// <exception cref="CDKException"> Thrown if something goes wrong or if the timeout is exceeded
        /// </exception>
        private void remove(IAtom atom, IAtomContainer ac, System.Collections.ArrayList pathes, IRingSet rings)
        {
            Path path1 = null;
            Path path2 = null;
            Path union = null;
            int intersectionSize = 0;
            newPathes.Clear();
            removePathes.Clear();
            potentialRings.Clear();
            if (debug)
            {
                System.Console.Out.WriteLine("*** Removing atom " + originalAc.getAtomNumber(atom) + " ***");
            }

            for (int i = 0; i < pathes.Count; i++)
            {
                path1 = (Path)pathes[i];
                if (path1[0] == atom || path1[path1.Count - 1] == atom)
                {
                    for (int j = i + 1; j < pathes.Count; j++)
                    {
                        //System.out.print(".");
                        path2 = (Path)pathes[j];
                        if (path2[0] == atom || path2[path2.Count - 1] == atom)
                        {
                            intersectionSize = path1.getIntersectionSize(path2);
                            if (intersectionSize < 3)
                            {
                                //if (debug) System.out.println("Joining " + path1.toString(originalAc) + " and " + path2.toString(originalAc));
                                union = Path.join(path1, path2, atom);
                                if (intersectionSize == 1)
                                {
                                    newPathes.Add(union);
                                }
                                else
                                {
                                    potentialRings.Add(union);
                                }
                                //if (debug) System.out.println("Intersection Size: " + intersectionSize);
                                //if (debug) System.out.println("Union: " + union.toString(originalAc));
                                /*
                                *  Now we know that path1 and
                                *  path2 share the Atom atom.
                                */
                                removePathes.Add(path1);
                                removePathes.Add(path2);
                            }
                        }
                        checkTimeout();
                    }
                }
            }
            for (int f = 0; f < removePathes.Count; f++)
            {
                pathes.Remove(removePathes[f]);
            }
            for (int f = 0; f < newPathes.Count; f++)
            {
                pathes.Add(newPathes[f]);
            }
            detectRings(potentialRings, rings, originalAc);
            ac.removeAtomAndConnectedElectronContainers(atom);
            if (debug)
            {
                System.Console.Out.WriteLine("\n" + pathes.Count + " pathes and " + ac.AtomCount + " atoms left.");
            }
        }
开发者ID:xuchuansheng,项目名称:GenXSource,代码行数:82,代码来源:AllRingsFinder.cs

示例2: removeAliphatic

 /// <summary>  Removes all external aliphatic chains by chopping them off from the
 /// ends
 /// 
 /// </summary>
 /// <param name="ac">               The AtomContainer to work with
 /// </param>
 /// <exception cref="CDKException"> An exception thrown if something goes wrong or if the timeout limit is reached
 /// </exception>
 private void removeAliphatic(IAtomContainer ac)
 {
     bool removedSomething;
     IAtom atom = null;
     do
     {
         removedSomething = false;
         //UPGRADE_TODO: Method 'java.util.Enumeration.hasMoreElements' was converted to 'System.Collections.IEnumerator.MoveNext' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javautilEnumerationhasMoreElements'"
         for (System.Collections.IEnumerator e = ac.atoms(); e.MoveNext(); )
         {
             //UPGRADE_TODO: Method 'java.util.Enumeration.nextElement' was converted to 'System.Collections.IEnumerator.Current' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javautilEnumerationnextElement'"
             atom = (IAtom)e.Current;
             if (ac.getBondCount(atom) == 1)
             {
                 ac.removeAtomAndConnectedElectronContainers(atom);
                 removedSomething = true;
             }
         }
     }
     while (removedSomething);
 }
开发者ID:xuchuansheng,项目名称:GenXSource,代码行数:29,代码来源:AllRingsFinder.cs


注:本文中的IAtomContainer.removeAtomAndConnectedElectronContainers方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。