test_class.file: tool/hash/src/test/java/org/openscience/cdk/hash/stereo/GeometricCumulativeDoubleBondFactoryTest.java
test_class.identifier: GeometricCumulativeDoubleBondFactoryTest
test_case.body: @Test
      public void testCreate() throws Exception {
          IAtomContainer m = new AtomContainer();
          m.addAtom(carbonAt(-0.2994, 3.2084));
          m.addAtom(carbonAt(-1.1244, 3.2084));
          m.addAtom(carbonAt(-1.9494, 3.2084));
          m.addAtom(carbonAt(-2.3619, 2.4939));
          m.addAtom(carbonAt(0.1131, 3.9228));
          m.addBond(new Bond(m.getAtom(0), m.getAtom(1), IBond.Order.DOUBLE));
          m.addBond(new Bond(m.getAtom(1), m.getAtom(2), IBond.Order.DOUBLE));
          m.addBond(new Bond(m.getAtom(2), m.getAtom(3)));
          m.addBond(new Bond(m.getAtom(0), m.getAtom(4)));
  
          StereoEncoderFactory factory = new GeometricCumulativeDoubleBondFactory();
          // graph not used
          StereoEncoder encoder = factory.create(m, null);
          assertThat(encoder, is(instanceOf(MultiStereoEncoder.class)));
      }
test_case.class_method_signature: GeometricCumulativeDoubleBondFactoryTest.testCreate()
test_case.full_signature: @Test public void testCreate()
test_case.identifier: testCreate
test_case.invocations: addAtom carbonAt addAtom carbonAt addAtom carbonAt addAtom carbonAt addAtom carbonAt addBond getAtom getAtom addBond getAtom getAtom addBond getAtom getAtom addBond getAtom getAtom create assertThat is instanceOf
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testCreate()
focal_class.file: tool/hash/src/main/java/org/openscience/cdk/hash/stereo/GeometricCumulativeDoubleBondFactory.java
focal_class.identifier: GeometricCumulativeDoubleBondFactory
focal_class.interfaces: implements StereoEncoderFactory
focal_class.class_method_signature: GeometricCumulativeDoubleBondFactory.create(IAtomContainer container, int[][] graph)
focal_class.full_signature: @Override public StereoEncoder create(IAtomContainer container, int[][] graph)
focal_class.identifier: create
focal_class.modifiers: @Override public
focal_class.parameters: (IAtomContainer container, int[][] graph)
focal_class.return: StereoEncoder
focal_class.signature: StereoEncoder create(IAtomContainer container, int[][] graph)
focal_class.class_method_signature: GeometricCumulativeDoubleBondFactory.axialEncoder(IAtomContainer container, IAtom start, IAtom end)
focal_class.full_signature: static StereoEncoder axialEncoder(IAtomContainer container, IAtom start, IAtom end)
focal_class.identifier: axialEncoder
focal_class.modifiers: static
focal_class.parameters: (IAtomContainer container, IAtom start, IAtom end)
focal_class.return: StereoEncoder
focal_class.signature: StereoEncoder axialEncoder(IAtomContainer container, IAtom start, IAtom end)
focal_class.class_method_signature: GeometricCumulativeDoubleBondFactory.axial2DEncoder(IAtomContainer container, IAtom start, List<IBond> startBonds,
              IAtom end, List<IBond> endBonds)
focal_class.full_signature: private static StereoEncoder axial2DEncoder(IAtomContainer container, IAtom start, List<IBond> startBonds,
              IAtom end, List<IBond> endBonds)
focal_class.identifier: axial2DEncoder
focal_class.modifiers: private static
focal_class.parameters: (IAtomContainer container, IAtom start, List<IBond> startBonds,
              IAtom end, List<IBond> endBonds)
focal_class.return: StereoEncoder
focal_class.signature: StereoEncoder axial2DEncoder(IAtomContainer container, IAtom start, List<IBond> startBonds,
              IAtom end, List<IBond> endBonds)
focal_class.class_method_signature: GeometricCumulativeDoubleBondFactory.axial3DEncoder(IAtomContainer container, IAtom start, List<IBond> startBonds,
              IAtom end, List<IBond> endBonds)
focal_class.full_signature: private static StereoEncoder axial3DEncoder(IAtomContainer container, IAtom start, List<IBond> startBonds,
              IAtom end, List<IBond> endBonds)
focal_class.identifier: axial3DEncoder
focal_class.modifiers: private static
focal_class.parameters: (IAtomContainer container, IAtom start, List<IBond> startBonds,
              IAtom end, List<IBond> endBonds)
focal_class.return: StereoEncoder
focal_class.signature: StereoEncoder axial3DEncoder(IAtomContainer container, IAtom start, List<IBond> startBonds,
              IAtom end, List<IBond> endBonds)
focal_class.class_method_signature: GeometricCumulativeDoubleBondFactory.fill2DCoordinates(IAtomContainer container, IAtom a, List<IBond> connected,
              Point2d[] coordinates, int[] elevations, int offset)
focal_class.full_signature: private static PermutationParity fill2DCoordinates(IAtomContainer container, IAtom a, List<IBond> connected,
              Point2d[] coordinates, int[] elevations, int offset)
focal_class.identifier: fill2DCoordinates
focal_class.modifiers: private static
focal_class.parameters: (IAtomContainer container, IAtom a, List<IBond> connected,
              Point2d[] coordinates, int[] elevations, int offset)
focal_class.return: PermutationParity
focal_class.signature: PermutationParity fill2DCoordinates(IAtomContainer container, IAtom a, List<IBond> connected,
              Point2d[] coordinates, int[] elevations, int offset)
focal_class.class_method_signature: GeometricCumulativeDoubleBondFactory.fill3DCoordinates(IAtomContainer container, IAtom a, List<IBond> connected,
              Point3d[] coordinates, int offset)
focal_class.full_signature: private static PermutationParity fill3DCoordinates(IAtomContainer container, IAtom a, List<IBond> connected,
              Point3d[] coordinates, int offset)
focal_class.identifier: fill3DCoordinates
focal_class.modifiers: private static
focal_class.parameters: (IAtomContainer container, IAtom a, List<IBond> connected,
              Point3d[] coordinates, int offset)
focal_class.return: PermutationParity
focal_class.signature: PermutationParity fill3DCoordinates(IAtomContainer container, IAtom a, List<IBond> connected,
              Point3d[] coordinates, int offset)
focal_class.class_method_signature: GeometricCumulativeDoubleBondFactory.has2DCoordinates(List<IBond> bonds)
focal_class.full_signature: private static boolean has2DCoordinates(List<IBond> bonds)
focal_class.identifier: has2DCoordinates
focal_class.modifiers: private static
focal_class.parameters: (List<IBond> bonds)
focal_class.return: boolean
focal_class.signature: boolean has2DCoordinates(List<IBond> bonds)
focal_class.class_method_signature: GeometricCumulativeDoubleBondFactory.has3DCoordinates(List<IBond> bonds)
focal_class.full_signature: private static boolean has3DCoordinates(List<IBond> bonds)
focal_class.identifier: has3DCoordinates
focal_class.modifiers: private static
focal_class.parameters: (List<IBond> bonds)
focal_class.return: boolean
focal_class.signature: boolean has3DCoordinates(List<IBond> bonds)
focal_class.class_method_signature: GeometricCumulativeDoubleBondFactory.elevation(IBond bond, IAtom a)
focal_class.full_signature: static int elevation(IBond bond, IAtom a)
focal_class.identifier: elevation
focal_class.modifiers: static
focal_class.parameters: (IBond bond, IAtom a)
focal_class.return: int
focal_class.signature: int elevation(IBond bond, IAtom a)
focal_class.class_method_signature: GeometricCumulativeDoubleBondFactory.elevation(IBond bond)
focal_class.full_signature: static int elevation(IBond bond)
focal_class.identifier: elevation
focal_class.modifiers: static
focal_class.parameters: (IBond bond)
focal_class.return: int
focal_class.signature: int elevation(IBond bond)
focal_class.class_method_signature: GeometricCumulativeDoubleBondFactory.isOdd(int x)
focal_class.full_signature: private static boolean isOdd(int x)
focal_class.identifier: isOdd
focal_class.modifiers: private static
focal_class.parameters: (int x)
focal_class.return: boolean
focal_class.signature: boolean isOdd(int x)
focal_class.class_method_signature: GeometricCumulativeDoubleBondFactory.isDoubleBond(IBond bond)
focal_class.full_signature: private static boolean isDoubleBond(IBond bond)
focal_class.identifier: isDoubleBond
focal_class.modifiers: private static
focal_class.parameters: (IBond bond)
focal_class.return: boolean
focal_class.signature: boolean isDoubleBond(IBond bond)
focal_method.body: @Override
      public StereoEncoder create(IAtomContainer container, int[][] graph) {
  
          int n = container.getAtomCount();
          BondMap map = new BondMap(n);
  
          List<StereoEncoder> encoders = new ArrayList<StereoEncoder>(1);
  
          // index double bonds by their atoms
          for (IBond bond : container.bonds()) {
              if (isDoubleBond(bond)) map.add(bond);
          }
  
          Set<IAtom> visited = new HashSet<IAtom>(n);
  
          // find atoms which are connected between two double bonds
          for (IAtom a : map.atoms()) {
  
              List<IBond> bonds = map.bonds(a);
              if (bonds.size() == 2) {
  
                  // (s)tart/(e)nd of cumulated system: -s=a=e-
                  IAtom s = bonds.get(0).getOther(a);
                  IAtom e = bonds.get(1).getOther(a);
                  // need the parents to re-use the double bond encoder
                  IAtom sParent = a;
                  IAtom eParent = a;
  
                  visited.add(a);
                  visited.add(s);
                  visited.add(e);
  
                  int size = 2;
  
                  // expand out from 'l'
                  while (s != null && map.cumulated(s)) {
                      IAtom p = map.bonds(s).get(0).getOther(s);
                      IAtom q = map.bonds(s).get(1).getOther(s);
                      sParent = s;
                      s = visited.add(p) ? p : visited.add(q) ? q : null;
                      size++;
                  }
  
                  // expand from 'r'
                  while (e != null && map.cumulated(e)) {
                      IAtom p = map.bonds(e).get(0).getOther(e);
                      IAtom q = map.bonds(e).get(1).getOther(e);
                      eParent = e;
                      e = visited.add(p) ? p : visited.add(q) ? q : null;
                      size++;
                  }
  
                  // s and e are null if we had a cumulative cycle...
                  if (s != null && e != null) {
  
                      // system has now be expanded, size is the number of double
                      // bonds. For odd numbers we use E/Z whilst for even are
                      // axial M/P.
                      //  \           /
                      //   s = = = = e
                      //  /           \
                      if (isOdd(size)) {
                          StereoEncoder encoder = GeometricDoubleBondEncoderFactory.newEncoder(container, s, sParent, e,
                                  eParent, graph);
                          if (encoder != null) {
                              encoders.add(encoder);
                          }
                      } else {
                          StereoEncoder encoder = axialEncoder(container, s, e);
                          if (encoder != null) {
                              encoders.add(encoder);
                          }
                      }
                  }
              }
          }
  
          return encoders.isEmpty() ? StereoEncoder.EMPTY : new MultiStereoEncoder(encoders);
      }
focal_method.class_method_signature: GeometricCumulativeDoubleBondFactory.create(IAtomContainer container, int[][] graph)
focal_method.full_signature: @Override public StereoEncoder create(IAtomContainer container, int[][] graph)
focal_method.identifier: create
focal_method.invocations: getAtomCount bonds isDoubleBond add atoms bonds size getOther get getOther get add add add cumulated getOther get bonds getOther get bonds add add cumulated getOther get bonds getOther get bonds add add isOdd newEncoder add axialEncoder add isEmpty
focal_method.modifiers: @Override public
focal_method.parameters: (IAtomContainer container, int[][] graph)
focal_method.return: StereoEncoder
focal_method.signature: StereoEncoder create(IAtomContainer container, int[][] graph)