test_class.declarator: builder = SilentChemObjectBuilder.getInstance()
test_class.modifier: private
test_class.original_string: private IChemObjectBuilder builder = SilentChemObjectBuilder.getInstance();
test_class.type: IChemObjectBuilder
test_class.var_name: builder
test_class.file: base/reaction/src/test/java/org/openscience/cdk/reaction/type/RadicalSiteRrAlphaReactionTest.java
test_class.identifier: RadicalSiteRrAlphaReactionTest
test_class.superclass: extends ReactionProcessTest
test_case.body: @Test
      public void testMapping() throws Exception {
          IReactionProcess type = new RadicalSiteRrAlphaReaction();
  
          IAtomContainerSet setOfReactants = getExampleReactants();
          IAtomContainer molecule = setOfReactants.getAtomContainer(0);
  
          /* automatic search of the center active */
          molecule.getAtom(0).setFlag(CDKConstants.REACTIVE_CENTER, true);
          molecule.getAtom(1).setFlag(CDKConstants.REACTIVE_CENTER, true);
          molecule.getAtom(3).setFlag(CDKConstants.REACTIVE_CENTER, true);
          molecule.getBond(0).setFlag(CDKConstants.REACTIVE_CENTER, true);
  
          List<IParameterReact> paramList = new ArrayList<IParameterReact>();
          IParameterReact param = new SetReactionCenter();
          param.setParameter(Boolean.TRUE);
          paramList.add(param);
          type.setParameterList(paramList);
  
          /* initiate */
          IReactionSet setOfReactions = type.initiate(setOfReactants, null);
  
          IAtomContainer product = setOfReactions.getReaction(0).getProducts().getAtomContainer(0);
  
          Assert.assertEquals(22, setOfReactions.getReaction(0).getMappingCount());
          IAtom mappedProductA1 = (IAtom) ReactionManipulator.getMappedChemObject(setOfReactions.getReaction(0),
                  molecule.getAtom(0));
          Assert.assertEquals(mappedProductA1, product.getAtom(0));
          IAtom mappedProductA2 = (IAtom) ReactionManipulator.getMappedChemObject(setOfReactions.getReaction(0),
                  molecule.getAtom(1));
          Assert.assertEquals(mappedProductA2, product.getAtom(1));
          IAtom mappedProductA3 = (IAtom) ReactionManipulator.getMappedChemObject(setOfReactions.getReaction(0),
                  molecule.getAtom(3));
          Assert.assertEquals(mappedProductA3, product.getAtom(3));
      }
test_case.class_method_signature: RadicalSiteRrAlphaReactionTest.testMapping()
test_case.full_signature: @Test public void testMapping()
test_case.identifier: testMapping
test_case.invocations: getExampleReactants getAtomContainer setFlag getAtom setFlag getAtom setFlag getAtom setFlag getBond setParameter add setParameterList initiate getAtomContainer getProducts getReaction assertEquals getMappingCount getReaction getMappedChemObject getReaction getAtom assertEquals getAtom getMappedChemObject getReaction getAtom assertEquals getAtom getMappedChemObject getReaction getAtom assertEquals getAtom
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testMapping()
focal_class.declarator: logger = LoggingToolFactory.createLoggingTool(RadicalSiteRrAlphaReaction.class)
focal_class.modifier: private static
focal_class.original_string: private static ILoggingTool logger = LoggingToolFactory.createLoggingTool(RadicalSiteRrAlphaReaction.class);
focal_class.type: ILoggingTool
focal_class.var_name: logger
focal_class.file: base/reaction/src/main/java/org/openscience/cdk/reaction/type/RadicalSiteRrAlphaReaction.java
focal_class.identifier: RadicalSiteRrAlphaReaction
focal_class.interfaces: implements IReactionProcess
focal_class.class_method_signature: RadicalSiteRrAlphaReaction.RadicalSiteRrAlphaReaction()
focal_class.full_signature: public  RadicalSiteRrAlphaReaction()
focal_class.identifier: RadicalSiteRrAlphaReaction
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.signature:  RadicalSiteRrAlphaReaction()
focal_class.class_method_signature: RadicalSiteRrAlphaReaction.getSpecification()
focal_class.full_signature: @Override public ReactionSpecification getSpecification()
focal_class.identifier: getSpecification
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: ReactionSpecification
focal_class.signature: ReactionSpecification getSpecification()
focal_class.class_method_signature: RadicalSiteRrAlphaReaction.initiate(IAtomContainerSet reactants, IAtomContainerSet agents)
focal_class.full_signature: @Override public IReactionSet initiate(IAtomContainerSet reactants, IAtomContainerSet agents)
focal_class.identifier: initiate
focal_class.modifiers: @Override public
focal_class.parameters: (IAtomContainerSet reactants, IAtomContainerSet agents)
focal_class.return: IReactionSet
focal_class.signature: IReactionSet initiate(IAtomContainerSet reactants, IAtomContainerSet agents)
focal_class.class_method_signature: RadicalSiteRrAlphaReaction.setActiveCenters(IAtomContainer reactant)
focal_class.full_signature: private void setActiveCenters(IAtomContainer reactant)
focal_class.identifier: setActiveCenters
focal_class.modifiers: private
focal_class.parameters: (IAtomContainer reactant)
focal_class.return: void
focal_class.signature: void setActiveCenters(IAtomContainer reactant)
focal_class.superclass: extends ReactionEngine
focal_method.body: @Override
      public IReactionSet initiate(IAtomContainerSet reactants, IAtomContainerSet agents) throws CDKException {
  
          logger.debug("initiate reaction: RadicalSiteRrAlphaReaction");
  
          if (reactants.getAtomContainerCount() != 1) {
              throw new CDKException("RadicalSiteRrAlphaReaction only expects one reactant");
          }
          if (agents != null) {
              throw new CDKException("RadicalSiteRrAlphaReaction don't expects agents");
          }
  
          IReactionSet setOfReactions = reactants.getBuilder().newInstance(IReactionSet.class);
          IAtomContainer reactant = reactants.getAtomContainer(0);
  
          AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(reactant);
          Aromaticity.cdkLegacy().apply(reactant);
          AllRingsFinder arf = new AllRingsFinder();
          IRingSet ringSet = arf.findAllRings(reactant);
          for (int ir = 0; ir < ringSet.getAtomContainerCount(); ir++) {
              IRing ring = (IRing) ringSet.getAtomContainer(ir);
              for (int jr = 0; jr < ring.getAtomCount(); jr++) {
                  IAtom aring = ring.getAtom(jr);
                  aring.setFlag(CDKConstants.ISINRING, true);
              }
          }
          /*
           * if the parameter hasActiveCenter is not fixed yet, set the active
           * centers
           */
          IParameterReact ipr = super.getParameterClass(SetReactionCenter.class);
          if (ipr != null && !ipr.isSetParameter()) setActiveCenters(reactant);
  
          HOSECodeGenerator hcg = new HOSECodeGenerator();
          Iterator<IAtom> atomis = reactant.atoms().iterator();
          while (atomis.hasNext()) {
              IAtom atomi = atomis.next();
              if (atomi.getFlag(CDKConstants.REACTIVE_CENTER) && reactant.getConnectedSingleElectronsCount(atomi) == 1) {
  
                  hcg.getSpheres(reactant, atomi, 1, true);
                  List<IAtom> atom1s = hcg.getNodesInSphere(1);
  
                  hcg.getSpheres(reactant, atomi, 2, true);
                  Iterator<IAtom> atomls = hcg.getNodesInSphere(2).iterator();
                  while (atomls.hasNext()) {
                      IAtom atoml = atomls.next();
                      if (atoml != null && atoml.getFlag(CDKConstants.REACTIVE_CENTER)
                              && !atoml.getFlag(CDKConstants.ISINRING)
                              && (atoml.getFormalCharge() == CDKConstants.UNSET ? 0 : atoml.getFormalCharge()) == 0
                              && !atoml.getSymbol().equals("H") && reactant.getMaximumBondOrder(atoml) == IBond.Order.SINGLE) {
  
                          Iterator<IAtom> atomRs = reactant.getConnectedAtomsList(atoml).iterator();
                          while (atomRs.hasNext()) {
                              IAtom atomR = atomRs.next();
                              if (atom1s.contains(atomR)) continue;
                              if (reactant.getBond(atomR, atoml).getFlag(CDKConstants.REACTIVE_CENTER)
                                      && atomR.getFlag(CDKConstants.REACTIVE_CENTER)
                                      && (atomR.getFormalCharge() == CDKConstants.UNSET ? 0 : atomR.getFormalCharge()) == 0) {
  
                                  ArrayList<IAtom> atomList = new ArrayList<IAtom>();
                                  atomList.add(atomR);
                                  atomList.add(atomi);
                                  atomList.add(atoml);
                                  ArrayList<IBond> bondList = new ArrayList<IBond>();
                                  bondList.add(reactant.getBond(atomR, atoml));
  
                                  IAtomContainerSet moleculeSet = reactant.getBuilder().newInstance(
                                          IAtomContainerSet.class);
                                  moleculeSet.addAtomContainer(reactant);
                                  IReaction reaction = mechanism.initiate(moleculeSet, atomList, bondList);
                                  if (reaction == null)
                                      continue;
                                  else
                                      setOfReactions.addReaction(reaction);
  
                              }
  
                          }
  
                      }
                  }
              }
          }
          return setOfReactions;
      }
focal_method.class_method_signature: RadicalSiteRrAlphaReaction.initiate(IAtomContainerSet reactants, IAtomContainerSet agents)
focal_method.full_signature: @Override public IReactionSet initiate(IAtomContainerSet reactants, IAtomContainerSet agents)
focal_method.identifier: initiate
focal_method.invocations: debug getAtomContainerCount newInstance getBuilder getAtomContainer percieveAtomTypesAndConfigureAtoms apply cdkLegacy findAllRings getAtomContainerCount getAtomContainer getAtomCount getAtom setFlag getParameterClass isSetParameter setActiveCenters iterator atoms hasNext next getFlag getConnectedSingleElectronsCount getSpheres getNodesInSphere getSpheres iterator getNodesInSphere hasNext next getFlag getFlag getFormalCharge getFormalCharge equals getSymbol getMaximumBondOrder iterator getConnectedAtomsList hasNext next contains getFlag getBond getFlag getFormalCharge getFormalCharge add add add add getBond newInstance getBuilder addAtomContainer initiate addReaction
focal_method.modifiers: @Override public
focal_method.parameters: (IAtomContainerSet reactants, IAtomContainerSet agents)
focal_method.return: IReactionSet
focal_method.signature: IReactionSet initiate(IAtomContainerSet reactants, IAtomContainerSet agents)