test_class.file: tool/hash/src/test/java/org/openscience/cdk/hash/stereo/DoubleBondElementEncoderFactoryTest.java
test_class.identifier: DoubleBondElementEncoderFactoryTest
test_case.body: @Test
      public void opposite() throws Exception {
  
          IAtomContainer container = mock(IAtomContainer.class);
          when(container.getAtomCount()).thenReturn(4);
  
          IAtom c1 = mock(IAtom.class);
          IAtom c2 = mock(IAtom.class);
          IAtom cl3 = mock(IAtom.class);
          IAtom cl4 = mock(IAtom.class);
  
          when(container.getAtom(0)).thenReturn(c1);
          when(container.getAtom(1)).thenReturn(c2);
          when(container.getAtom(2)).thenReturn(cl3);
          when(container.getAtom(3)).thenReturn(cl4);
  
          when(container.atoms()).thenReturn(Arrays.asList(c1, c2, cl3, cl4));
  
          IBond stereoBond = mock(IBond.class);
          IBond left = mock(IBond.class);
          IBond right = mock(IBond.class);
  
          when(stereoBond.getBegin()).thenReturn(c1);
          when(stereoBond.getEnd()).thenReturn(c2);
          when(left.getOther(c1)).thenReturn(cl3);
          when(right.getOther(c2)).thenReturn(cl4);
  
          IDoubleBondStereochemistry dbs = mock(IDoubleBondStereochemistry.class);
          when(dbs.getStereoBond()).thenReturn(stereoBond);
          when(dbs.getBonds()).thenReturn(new IBond[]{left, right});
          when(dbs.getStereo()).thenReturn(IDoubleBondStereochemistry.Conformation.OPPOSITE);
          when(container.stereoElements()).thenReturn(Collections.<IStereoElement> singleton(dbs));
  
          StereoEncoder encoder = new DoubleBondElementEncoderFactory().create(container, new int[][]{{1, 2}, {0, 3},
                  {0}, {1}});
  
          assertThat(getGeometricParity(encoder).parity(), is(1));
      }
test_case.class_method_signature: DoubleBondElementEncoderFactoryTest.opposite()
test_case.full_signature: @Test public void opposite()
test_case.identifier: opposite
test_case.invocations: mock thenReturn when getAtomCount mock mock mock mock thenReturn when getAtom thenReturn when getAtom thenReturn when getAtom thenReturn when getAtom thenReturn when atoms asList mock mock mock thenReturn when getBegin thenReturn when getEnd thenReturn when getOther thenReturn when getOther mock thenReturn when getStereoBond thenReturn when getBonds thenReturn when getStereo thenReturn when stereoElements singleton create assertThat parity getGeometricParity is
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void opposite()
focal_class.file: tool/hash/src/main/java/org/openscience/cdk/hash/stereo/DoubleBondElementEncoderFactory.java
focal_class.identifier: DoubleBondElementEncoderFactory
focal_class.interfaces: implements StereoEncoderFactory
focal_class.class_method_signature: DoubleBondElementEncoderFactory.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: DoubleBondElementEncoderFactory.encoder(IDoubleBondStereochemistry dbs, Map<IAtom, Integer> atomToIndex,
              int[][] graph)
focal_class.full_signature: private static GeometryEncoder encoder(IDoubleBondStereochemistry dbs, Map<IAtom, Integer> atomToIndex,
              int[][] graph)
focal_class.identifier: encoder
focal_class.modifiers: private static
focal_class.parameters: (IDoubleBondStereochemistry dbs, Map<IAtom, Integer> atomToIndex,
              int[][] graph)
focal_class.return: GeometryEncoder
focal_class.signature: GeometryEncoder encoder(IDoubleBondStereochemistry dbs, Map<IAtom, Integer> atomToIndex,
              int[][] graph)
focal_class.class_method_signature: DoubleBondElementEncoderFactory.findOther(int[] vs, int u, int x)
focal_class.full_signature: private static int findOther(int[] vs, int u, int x)
focal_class.identifier: findOther
focal_class.modifiers: private static
focal_class.parameters: (int[] vs, int u, int x)
focal_class.return: int
focal_class.signature: int findOther(int[] vs, int u, int x)
focal_class.class_method_signature: DoubleBondElementEncoderFactory.indexMap(Map<IAtom, Integer> map, IAtomContainer container)
focal_class.full_signature: private static Map<IAtom, Integer> indexMap(Map<IAtom, Integer> map, IAtomContainer container)
focal_class.identifier: indexMap
focal_class.modifiers: private static
focal_class.parameters: (Map<IAtom, Integer> map, IAtomContainer container)
focal_class.return: Map<IAtom, Integer>
focal_class.signature: Map<IAtom, Integer> indexMap(Map<IAtom, Integer> map, IAtomContainer container)
focal_method.body: @Override
      public StereoEncoder create(IAtomContainer container, int[][] graph) {
  
          // index atoms for quick lookup - wish we didn't have to do this
          // but the it's better than calling getAtomNumber every time - we use
          // a lazy creation so it's only created if there was a need for it
          Map<IAtom, Integer> atomToIndex = null;
  
          List<StereoEncoder> encoders = new ArrayList<StereoEncoder>();
  
          // for each double-bond element - create a new encoder
          for (IStereoElement se : container.stereoElements()) {
              if (se instanceof IDoubleBondStereochemistry) {
                  encoders.add(encoder((IDoubleBondStereochemistry) se, atomToIndex = indexMap(atomToIndex, container),
                          graph));
              }
          }
  
          return encoders.isEmpty() ? StereoEncoder.EMPTY : new MultiStereoEncoder(encoders);
      }
focal_method.class_method_signature: DoubleBondElementEncoderFactory.create(IAtomContainer container, int[][] graph)
focal_method.full_signature: @Override public StereoEncoder create(IAtomContainer container, int[][] graph)
focal_method.identifier: create
focal_method.invocations: stereoElements add encoder indexMap 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)