示例#1
0
 /// <summary>
 /// Joins two paths. The joint point is given by an atom
 /// which is shared by the two pathes. 
 /// </summary>
 /// <param name="path1">First path to join</param>
 /// <param name="path2">Second path to join</param>
 /// <param name="atom">The atom which is the joint point</param>
 /// <returns>The newly formed longer path</returns>
 public static Path join(Path path1, Path path2, IAtom atom)
 {
     Path newPath = new Path();
     Path tempPath = new Path();
     if (path1[0] == atom)
     {
         path1.revert();
     }
     newPath.AddRange(path1);
     if (path2[path2.Count-1] == atom)
     {
         path2.revert();
     }
     tempPath.AddRange(path2);
     tempPath.Remove(atom);
     newPath.AddRange(tempPath);
     return newPath;
 }
示例#2
0
 /// <summary>  Initialized the path graph
 /// See {@cdk.cite HAN96} for details
 /// 
 /// </summary>
 /// <param name="ac">     The AtomContainer with the original structure
 /// </param>
 /// <param name="pathes"> The pathes to initialize
 /// </param>
 private void initPathGraph(IAtomContainer ac, System.Collections.ArrayList pathes)
 {
     IBond bond = null;
     Path path = null;
     IBond[] bonds = ac.Bonds;
     for (int f = 0; f < bonds.Length; f++)
     {
         bond = bonds[f];
         path = new Path(bond.getAtomAt(0), bond.getAtomAt(1));
         pathes.Add(path);
         if (debug)
         {
             System.Console.Out.WriteLine("initPathGraph: " + path.toString(originalAc));
         }
     }
 }
示例#3
0
 public int getIntersectionSize(Path other)
 {
     IAtom a1, a2;
     int iSize = 0;
     for (int i = 0; i < Count; i++)
     {
         a1 = (IAtom)this[i];
         for (int j = 0; j < other.Count; j++)
         {
             a2 = (IAtom)other[j];
             if (a1 == a2) iSize++;
         }
     }
     return iSize;
 }