test_class.file: tool/hash/src/test/java/org/openscience/cdk/hash/stereo/GeometricDoubleBondEncoderFactoryTest.java
test_class.identifier: GeometricDoubleBondEncoderFactoryTest
test_case.body: @Test
      public void testCreate() throws Exception {
  
          IAtomContainer mol = mock(IAtomContainer.class);
  
          // a       d    0       3
          //  \     /      \     /
          //   b = c        1 = 2
          //  /     \      /     \
          // e       f    4       5
          IAtom a = mock(IAtom.class); // 0
          IAtom b = mock(IAtom.class); // 1
          IAtom c = mock(IAtom.class); // 2
          IAtom d = mock(IAtom.class); // 3
          IAtom e = mock(IAtom.class); // 4
          IAtom f = mock(IAtom.class); // 5
  
          when(mol.indexOf(a)).thenReturn(0);
          when(mol.indexOf(b)).thenReturn(1);
          when(mol.indexOf(c)).thenReturn(2);
          when(mol.indexOf(d)).thenReturn(3);
          when(mol.indexOf(e)).thenReturn(4);
          when(mol.indexOf(f)).thenReturn(5);
  
          when(mol.getAtom(0)).thenReturn(a);
          when(mol.getAtom(1)).thenReturn(b);
          when(mol.getAtom(2)).thenReturn(c);
          when(mol.getAtom(3)).thenReturn(d);
          when(mol.getAtom(4)).thenReturn(e);
          when(mol.getAtom(5)).thenReturn(f);
  
          when(b.getHybridization()).thenReturn(IAtomType.Hybridization.SP2);
          when(c.getHybridization()).thenReturn(IAtomType.Hybridization.SP2);
  
          when(a.getPoint2d()).thenReturn(new Point2d());
          when(b.getPoint2d()).thenReturn(new Point2d());
          when(c.getPoint2d()).thenReturn(new Point2d());
          when(d.getPoint2d()).thenReturn(new Point2d());
          when(e.getPoint2d()).thenReturn(new Point2d());
          when(f.getPoint2d()).thenReturn(new Point2d());
  
          IBond ba = mock(IBond.class);
          IBond be = mock(IBond.class);
          IBond bc = mock(IBond.class);
          IBond cd = mock(IBond.class);
          IBond cf = mock(IBond.class);
  
          when(ba.getBegin()).thenReturn(b);
          when(ba.getEnd()).thenReturn(a);
          when(be.getBegin()).thenReturn(b);
          when(be.getEnd()).thenReturn(e);
          when(bc.getBegin()).thenReturn(b);
          when(bc.getEnd()).thenReturn(c);
          when(cd.getBegin()).thenReturn(c);
          when(cd.getEnd()).thenReturn(d);
          when(cf.getBegin()).thenReturn(c);
          when(cf.getEnd()).thenReturn(f);
  
          when(bc.getOrder()).thenReturn(IBond.Order.DOUBLE);
          when(mol.bonds()).thenReturn(Arrays.asList(ba, be, bc, cd, cf));
  
          when(mol.getConnectedBondsList(a)).thenReturn(Arrays.asList(ba));
          when(mol.getConnectedBondsList(b)).thenReturn(Arrays.asList(ba, bc, be));
          when(mol.getConnectedBondsList(c)).thenReturn(Arrays.asList(bc, cd, cf));
          when(mol.getConnectedBondsList(d)).thenReturn(Arrays.asList(cd));
          when(mol.getConnectedBondsList(e)).thenReturn(Arrays.asList(be));
          when(mol.getConnectedBondsList(f)).thenReturn(Arrays.asList(cf));
  
          StereoEncoderFactory factory = new GeometricDoubleBondEncoderFactory();
  
          int[][] g = new int[][]{{1}, {0, 2, 4}, {1, 3, 5}, {2}, {1}, {2}};
  
          assertTrue(factory.create(mol, g) instanceof MultiStereoEncoder);
      }
test_case.class_method_signature: GeometricDoubleBondEncoderFactoryTest.testCreate()
test_case.full_signature: @Test public void testCreate()
test_case.identifier: testCreate
test_case.invocations: mock mock mock mock mock mock mock thenReturn when indexOf thenReturn when indexOf thenReturn when indexOf thenReturn when indexOf thenReturn when indexOf thenReturn when indexOf thenReturn when getAtom thenReturn when getAtom thenReturn when getAtom thenReturn when getAtom thenReturn when getAtom thenReturn when getAtom thenReturn when getHybridization thenReturn when getHybridization thenReturn when getPoint2d thenReturn when getPoint2d thenReturn when getPoint2d thenReturn when getPoint2d thenReturn when getPoint2d thenReturn when getPoint2d mock mock mock mock mock thenReturn when getBegin thenReturn when getEnd thenReturn when getBegin thenReturn when getEnd thenReturn when getBegin thenReturn when getEnd thenReturn when getBegin thenReturn when getEnd thenReturn when getBegin thenReturn when getEnd thenReturn when getOrder thenReturn when bonds asList thenReturn when getConnectedBondsList asList thenReturn when getConnectedBondsList asList thenReturn when getConnectedBondsList asList thenReturn when getConnectedBondsList asList thenReturn when getConnectedBondsList asList thenReturn when getConnectedBondsList asList assertTrue create
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/GeometricDoubleBondEncoderFactory.java
focal_class.identifier: GeometricDoubleBondEncoderFactory
focal_class.interfaces: implements StereoEncoderFactory
focal_class.class_method_signature: GeometricDoubleBondEncoderFactory.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: GeometricDoubleBondEncoderFactory.newEncoder(IAtomContainer container, IAtom left, IAtom leftParent, IAtom right,
              IAtom rightParent, int[][] graph)
focal_class.full_signature: static StereoEncoder newEncoder(IAtomContainer container, IAtom left, IAtom leftParent, IAtom right,
              IAtom rightParent, int[][] graph)
focal_class.identifier: newEncoder
focal_class.modifiers: static
focal_class.parameters: (IAtomContainer container, IAtom left, IAtom leftParent, IAtom right,
              IAtom rightParent, int[][] graph)
focal_class.return: StereoEncoder
focal_class.signature: StereoEncoder newEncoder(IAtomContainer container, IAtom left, IAtom leftParent, IAtom right,
              IAtom rightParent, int[][] graph)
focal_class.class_method_signature: GeometricDoubleBondEncoderFactory.geometric(IAtomContainer mol, int l, int r, int l1, int l2, int r1, int r2)
focal_class.full_signature: static GeometricParity geometric(IAtomContainer mol, int l, int r, int l1, int l2, int r1, int r2)
focal_class.identifier: geometric
focal_class.modifiers: static
focal_class.parameters: (IAtomContainer mol, int l, int r, int l1, int l2, int r1, int r2)
focal_class.return: GeometricParity
focal_class.signature: GeometricParity geometric(IAtomContainer mol, int l, int r, int l1, int l2, int r1, int r2)
focal_class.class_method_signature: GeometricDoubleBondEncoderFactory.permutation(int[] neighbors)
focal_class.full_signature: static PermutationParity permutation(int[] neighbors)
focal_class.identifier: permutation
focal_class.modifiers: static
focal_class.parameters: (int[] neighbors)
focal_class.return: PermutationParity
focal_class.signature: PermutationParity permutation(int[] neighbors)
focal_class.class_method_signature: GeometricDoubleBondEncoderFactory.moveToBack(int[] neighbors, int v)
focal_class.full_signature: static int[] moveToBack(int[] neighbors, int v)
focal_class.identifier: moveToBack
focal_class.modifiers: static
focal_class.parameters: (int[] neighbors, int v)
focal_class.return: int[]
focal_class.signature: int[] moveToBack(int[] neighbors, int v)
focal_class.class_method_signature: GeometricDoubleBondEncoderFactory.accept(IAtom atom, List<IBond> bonds)
focal_class.full_signature: static boolean accept(IAtom atom, List<IBond> bonds)
focal_class.identifier: accept
focal_class.modifiers: static
focal_class.parameters: (IAtom atom, List<IBond> bonds)
focal_class.return: boolean
focal_class.signature: boolean accept(IAtom atom, List<IBond> bonds)
focal_method.body: @Override
      public StereoEncoder create(IAtomContainer container, int[][] graph) {
  
          List<StereoEncoder> encoders = new ArrayList<StereoEncoder>(5);
  
          for (IBond bond : container.bonds()) {
  
              // if double bond and not E or Z query bond
              if (DOUBLE.equals(bond.getOrder()) && !E_OR_Z.equals(bond.getStereo())) {
  
                  IAtom left = bond.getBegin();
                  IAtom right = bond.getEnd();
  
                  // skip -N=N- double bonds which exhibit inversion
                  if (Integer.valueOf(7).equals(left.getAtomicNumber())
                          && Integer.valueOf(7).equals(right.getAtomicNumber())) continue;
  
                  StereoEncoder encoder = newEncoder(container, left, right, right, left, graph);
  
                  if (encoder != null) {
                      encoders.add(encoder);
                  }
              }
          }
  
          return encoders.isEmpty() ? StereoEncoder.EMPTY : new MultiStereoEncoder(encoders);
      }
focal_method.class_method_signature: GeometricDoubleBondEncoderFactory.create(IAtomContainer container, int[][] graph)
focal_method.full_signature: @Override public StereoEncoder create(IAtomContainer container, int[][] graph)
focal_method.identifier: create
focal_method.invocations: bonds equals getOrder equals getStereo getBegin getEnd equals valueOf getAtomicNumber equals valueOf getAtomicNumber newEncoder 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)