test_class.declarator: molecule
test_class.modifier: private static
test_class.original_string: private static IAtomContainer molecule;
test_class.type: IAtomContainer
test_class.var_name: molecule
test_class.declarator: ligands
test_class.modifier: private static
test_class.original_string: private static ILigand[]      ligands;
test_class.type: ILigand[]
test_class.var_name: ligands
test_class.file: descriptor/cip/src/test/java/org/openscience/cdk/geometry/cip/LigancyFourChiralityTest.java
test_class.identifier: LigancyFourChiralityTest
test_class.superclass: extends CDKTestCase
test_case.body: @Test
      public void testProject() {
          LigancyFourChirality chirality = new LigancyFourChirality(molecule.getAtom(1), ligands, Stereo.CLOCKWISE);
          chirality.project(ligands);
          Assert.assertEquals(Stereo.CLOCKWISE, chirality.getStereo());
      }
test_case.class_method_signature: LigancyFourChiralityTest.testProject()
test_case.full_signature: @Test public void testProject()
test_case.identifier: testProject
test_case.invocations: getAtom project assertEquals getStereo
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testProject()
focal_class.declarator: chiralAtom
focal_class.modifier: private
focal_class.original_string: private IAtom                        chiralAtom;
focal_class.type: IAtom
focal_class.var_name: chiralAtom
focal_class.declarator: ligands
focal_class.modifier: private
focal_class.original_string: private ILigand[]                    ligands;
focal_class.type: ILigand[]
focal_class.var_name: ligands
focal_class.declarator: stereo
focal_class.modifier: private
focal_class.original_string: private ITetrahedralChirality.Stereo stereo;
focal_class.type: ITetrahedralChirality.Stereo
focal_class.var_name: stereo
focal_class.file: descriptor/cip/src/main/java/org/openscience/cdk/geometry/cip/LigancyFourChirality.java
focal_class.identifier: LigancyFourChirality
focal_class.class_method_signature: LigancyFourChirality.LigancyFourChirality(IAtom chiralAtom, ILigand[] ligands, ITetrahedralChirality.Stereo stereo)
focal_class.full_signature: public  LigancyFourChirality(IAtom chiralAtom, ILigand[] ligands, ITetrahedralChirality.Stereo stereo)
focal_class.identifier: LigancyFourChirality
focal_class.modifiers: public
focal_class.parameters: (IAtom chiralAtom, ILigand[] ligands, ITetrahedralChirality.Stereo stereo)
focal_class.signature:  LigancyFourChirality(IAtom chiralAtom, ILigand[] ligands, ITetrahedralChirality.Stereo stereo)
focal_class.class_method_signature: LigancyFourChirality.LigancyFourChirality(IAtomContainer container, ITetrahedralChirality cdkChirality)
focal_class.full_signature: public  LigancyFourChirality(IAtomContainer container, ITetrahedralChirality cdkChirality)
focal_class.identifier: LigancyFourChirality
focal_class.modifiers: public
focal_class.parameters: (IAtomContainer container, ITetrahedralChirality cdkChirality)
focal_class.signature:  LigancyFourChirality(IAtomContainer container, ITetrahedralChirality cdkChirality)
focal_class.class_method_signature: LigancyFourChirality.getLigands()
focal_class.full_signature: public ILigand[] getLigands()
focal_class.identifier: getLigands
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: ILigand[]
focal_class.signature: ILigand[] getLigands()
focal_class.class_method_signature: LigancyFourChirality.getChiralAtom()
focal_class.full_signature: public IAtom getChiralAtom()
focal_class.identifier: getChiralAtom
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: IAtom
focal_class.signature: IAtom getChiralAtom()
focal_class.class_method_signature: LigancyFourChirality.getStereo()
focal_class.full_signature: public ITetrahedralChirality.Stereo getStereo()
focal_class.identifier: getStereo
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: ITetrahedralChirality.Stereo
focal_class.signature: ITetrahedralChirality.Stereo getStereo()
focal_class.class_method_signature: LigancyFourChirality.project(ILigand[] newOrder)
focal_class.full_signature: public LigancyFourChirality project(ILigand[] newOrder)
focal_class.identifier: project
focal_class.modifiers: public
focal_class.parameters: (ILigand[] newOrder)
focal_class.return: LigancyFourChirality
focal_class.signature: LigancyFourChirality project(ILigand[] newOrder)
focal_class.class_method_signature: LigancyFourChirality.swap(ILigand[] ligands, int first, int second)
focal_class.full_signature: private void swap(ILigand[] ligands, int first, int second)
focal_class.identifier: swap
focal_class.modifiers: private
focal_class.parameters: (ILigand[] ligands, int first, int second)
focal_class.return: void
focal_class.signature: void swap(ILigand[] ligands, int first, int second)
focal_method.body: public LigancyFourChirality project(ILigand[] newOrder) {
          ITetrahedralChirality.Stereo newStereo = this.stereo;
          // copy the current ordering, and work with that
          ILigand[] newAtoms = new ILigand[4];
          System.arraycopy(this.ligands, 0, newAtoms, 0, 4);
  
          // now move atoms around to match the newOrder
          for (int i = 0; i < 3; i++) {
              if (!newAtoms[i].getLigandAtom().equals(newOrder[i].getLigandAtom())) {
                  // OK, not in the right position
                  // find the incorrect, old position
                  for (int j = i; j < 4; j++) {
                      if (newAtoms[j].getLigandAtom().equals(newOrder[i].getLigandAtom())) {
                          // found the incorrect position
                          swap(newAtoms, i, j);
                          // and swap the stereochemistry
                          if (newStereo == Stereo.CLOCKWISE) {
                              newStereo = Stereo.ANTI_CLOCKWISE;
                          } else {
                              newStereo = Stereo.CLOCKWISE;
                          }
                      }
                  }
              }
          }
          return new LigancyFourChirality(chiralAtom, newAtoms, newStereo);
      }
focal_method.class_method_signature: LigancyFourChirality.project(ILigand[] newOrder)
focal_method.full_signature: public LigancyFourChirality project(ILigand[] newOrder)
focal_method.identifier: project
focal_method.invocations: arraycopy equals getLigandAtom getLigandAtom equals getLigandAtom getLigandAtom swap
focal_method.modifiers: public
focal_method.parameters: (ILigand[] newOrder)
focal_method.return: LigancyFourChirality
focal_method.signature: LigancyFourChirality project(ILigand[] newOrder)