test_class.file: tool/hash/src/test/java/org/openscience/cdk/hash/stereo/TetrahedralElementEncoderFactoryTest.java
test_class.identifier: TetrahedralElementEncoderFactoryTest
test_case.body: @Test
      public void createExplicitH() throws Exception {
  
          IAtomContainer container = mock(IAtomContainer.class);
          when(container.getAtomCount()).thenReturn(5);
  
          IAtom c1 = mock(IAtom.class);
          IAtom o2 = mock(IAtom.class);
          IAtom n3 = mock(IAtom.class);
          IAtom c4 = mock(IAtom.class);
          IAtom h5 = mock(IAtom.class);
  
          when(container.getAtom(0)).thenReturn(c1);
          when(container.getAtom(1)).thenReturn(o2);
          when(container.getAtom(2)).thenReturn(n3);
          when(container.getAtom(3)).thenReturn(c4);
          when(container.getAtom(4)).thenReturn(h5);
  
          when(container.atoms()).thenReturn(Arrays.asList(c1, o2, n3, c4, h5));
  
          ITetrahedralChirality tc = mock(ITetrahedralChirality.class);
          when(tc.getChiralAtom()).thenReturn(c1);
          when(tc.getLigands()).thenReturn(new IAtom[]{o2, n3, c4, h5});
          when(tc.getStereo()).thenReturn(ITetrahedralChirality.Stereo.CLOCKWISE);
          when(container.stereoElements()).thenReturn(Collections.<IStereoElement> singleton(tc));
  
          StereoEncoder encoder = new TetrahedralElementEncoderFactory().create(container, new int[0][0]); // graph not used
  
          assertThat(getGeometricParity(encoder).parity(), is(-1)); // clockwise
      }
test_case.class_method_signature: TetrahedralElementEncoderFactoryTest.createExplicitH()
test_case.full_signature: @Test public void createExplicitH()
test_case.identifier: createExplicitH
test_case.invocations: mock thenReturn when getAtomCount mock mock mock mock mock thenReturn when getAtom thenReturn when getAtom thenReturn when getAtom thenReturn when getAtom thenReturn when getAtom thenReturn when atoms asList mock thenReturn when getChiralAtom thenReturn when getLigands 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 createExplicitH()
focal_class.file: tool/hash/src/main/java/org/openscience/cdk/hash/stereo/TetrahedralElementEncoderFactory.java
focal_class.identifier: TetrahedralElementEncoderFactory
focal_class.interfaces: implements StereoEncoderFactory
focal_class.class_method_signature: TetrahedralElementEncoderFactory.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: TetrahedralElementEncoderFactory.encoder(ITetrahedralChirality tc, Map<IAtom, Integer> atomToIndex)
focal_class.full_signature: private static GeometryEncoder encoder(ITetrahedralChirality tc, Map<IAtom, Integer> atomToIndex)
focal_class.identifier: encoder
focal_class.modifiers: private static
focal_class.parameters: (ITetrahedralChirality tc, Map<IAtom, Integer> atomToIndex)
focal_class.return: GeometryEncoder
focal_class.signature: GeometryEncoder encoder(ITetrahedralChirality tc, Map<IAtom, Integer> atomToIndex)
focal_class.class_method_signature: TetrahedralElementEncoderFactory.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 tetrahedral element - create a new encoder
          for (IStereoElement se : container.stereoElements()) {
              if (se instanceof ITetrahedralChirality) {
                  encoders.add(encoder((ITetrahedralChirality) se, atomToIndex = indexMap(atomToIndex, container)));
              }
          }
  
          return encoders.isEmpty() ? StereoEncoder.EMPTY : new MultiStereoEncoder(encoders);
      }
focal_method.class_method_signature: TetrahedralElementEncoderFactory.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)