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/RadicalSiteInitiationReactionTest.java
test_class.identifier: RadicalSiteInitiationReactionTest
test_class.superclass: extends ReactionProcessTest
test_case.body: @Test
      @Override
      public void testInitiate_IAtomContainerSet_IAtomContainerSet() throws Exception {
          IReactionProcess type = new RadicalSiteInitiationReaction();
          IAtomContainerSet setOfReactants = getExampleReactants();
  
          /* initiate */
  
          List<IParameterReact> paramList = new ArrayList<IParameterReact>();
          IParameterReact param = new SetReactionCenter();
          param.setParameter(Boolean.FALSE);
          paramList.add(param);
          type.setParameterList(paramList);
          IReactionSet setOfReactions = type.initiate(setOfReactants, null);
  
          Assert.assertEquals(1, setOfReactions.getReactionCount());
          Assert.assertEquals(2, setOfReactions.getReaction(0).getProductCount());
  
          IAtomContainer product1 = setOfReactions.getReaction(0).getProducts().getAtomContainer(0);
  
          /* C=C */
          IAtomContainer molecule1 = getExpectedProducts().getAtomContainer(0);
  
          assertEquals(molecule1, product1);
  
          IAtomContainer product2 = setOfReactions.getReaction(0).getProducts().getAtomContainer(1);
  
          /* [C*] */
          IAtomContainer molecule2 = getExpectedProducts().getAtomContainer(1);
  
          assertEquals(molecule2, product2);
      }
test_case.class_method_signature: RadicalSiteInitiationReactionTest.testInitiate_IAtomContainerSet_IAtomContainerSet()
test_case.full_signature: @Test @Override public void testInitiate_IAtomContainerSet_IAtomContainerSet()
test_case.identifier: testInitiate_IAtomContainerSet_IAtomContainerSet
test_case.invocations: getExampleReactants setParameter add setParameterList initiate assertEquals getReactionCount assertEquals getProductCount getReaction getAtomContainer getProducts getReaction getAtomContainer getExpectedProducts assertEquals getAtomContainer getProducts getReaction getAtomContainer getExpectedProducts assertEquals
test_case.modifiers: @Test @Override public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testInitiate_IAtomContainerSet_IAtomContainerSet()
focal_class.declarator: logger = LoggingToolFactory.createLoggingTool(RadicalSiteInitiationReaction.class)
focal_class.modifier: private static
focal_class.original_string: private static ILoggingTool logger = LoggingToolFactory.createLoggingTool(RadicalSiteInitiationReaction.class);
focal_class.type: ILoggingTool
focal_class.var_name: logger
focal_class.file: base/reaction/src/main/java/org/openscience/cdk/reaction/type/RadicalSiteInitiationReaction.java
focal_class.identifier: RadicalSiteInitiationReaction
focal_class.interfaces: implements IReactionProcess
focal_class.class_method_signature: RadicalSiteInitiationReaction.RadicalSiteInitiationReaction()
focal_class.full_signature: public  RadicalSiteInitiationReaction()
focal_class.identifier: RadicalSiteInitiationReaction
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.signature:  RadicalSiteInitiationReaction()
focal_class.class_method_signature: RadicalSiteInitiationReaction.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: RadicalSiteInitiationReaction.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: RadicalSiteInitiationReaction.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: RadicalSiteInitiationReaction");
  
          if (reactants.getAtomContainerCount() != 1) {
              throw new CDKException("RadicalSiteInitiationReaction only expects one reactant");
          }
          if (agents != null) {
              throw new CDKException("RadicalSiteInitiationReaction don't expects agents");
          }
  
          IReactionSet setOfReactions = reactants.getBuilder().newInstance(IReactionSet.class);
          IAtomContainer reactant = reactants.getAtomContainer(0);
  
          /*
           * 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);
  
          Iterator<IAtom> atoms = reactants.getAtomContainer(0).atoms().iterator();
          while (atoms.hasNext()) {
              IAtom atomi = atoms.next();
              if (atomi.getFlag(CDKConstants.REACTIVE_CENTER) && reactant.getConnectedSingleElectronsCount(atomi) == 1
                      && atomi.getFormalCharge() == 0) {
  
                  Iterator<IBond> bondis = reactant.getConnectedBondsList(atomi).iterator();
  
                  while (bondis.hasNext()) {
                      IBond bondi = bondis.next();
  
                      if (bondi.getFlag(CDKConstants.REACTIVE_CENTER) && bondi.getOrder() == IBond.Order.SINGLE) {
  
                          IAtom atomj = bondi.getOther(atomi);
                          if (atomj.getFlag(CDKConstants.REACTIVE_CENTER) && atomj.getFormalCharge() == 0) {
  
                              Iterator<IBond> bondjs = reactant.getConnectedBondsList(atomj).iterator();
                              while (bondjs.hasNext()) {
                                  IBond bondj = bondjs.next();
  
                                  if (bondj.equals(bondi)) continue;
  
                                  if (bondj.getFlag(CDKConstants.REACTIVE_CENTER)
                                          && bondj.getOrder() == IBond.Order.SINGLE) {
  
                                      IAtom atomk = bondj.getOther(atomj);
                                      if (atomk.getFlag(CDKConstants.REACTIVE_CENTER) && atomk.getSymbol().equals("C")
                                              && atomk.getFormalCharge() == 0) {
  
                                          ArrayList<IAtom> atomList = new ArrayList<IAtom>();
                                          atomList.add(atomi);
                                          atomList.add(atomj);
                                          atomList.add(atomk);
                                          ArrayList<IBond> bondList = new ArrayList<IBond>();
                                          bondList.add(bondi);
                                          bondList.add(bondj);
  
                                          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: RadicalSiteInitiationReaction.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 getParameterClass isSetParameter setActiveCenters iterator atoms getAtomContainer hasNext next getFlag getConnectedSingleElectronsCount getFormalCharge iterator getConnectedBondsList hasNext next getFlag getOrder getOther getFlag getFormalCharge iterator getConnectedBondsList hasNext next equals getFlag getOrder getOther getFlag equals getSymbol getFormalCharge add add add add add 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)