test_class.declarator: lpcheck = new LonePairElectronChecker()
test_class.modifier: private final
test_class.original_string: private final LonePairElectronChecker lpcheck = new LonePairElectronChecker();
test_class.type: LonePairElectronChecker
test_class.var_name: lpcheck
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/AdductionProtonPBReactionTest.java
test_class.identifier: AdductionProtonPBReactionTest
test_class.superclass: extends ReactionProcessTest
test_case.body: @Test
      @Override
      public void testInitiate_IAtomContainerSet_IAtomContainerSet() throws Exception {
  
          IReactionProcess type = new AdductionProtonPBReaction();
  
          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(2, setOfReactions.getReactionCount());
          Assert.assertEquals(1, setOfReactions.getReaction(0).getProductCount());
  
          IAtomContainer product = setOfReactions.getReaction(0).getProducts().getAtomContainer(0);
  
          IAtomContainer molecule2 = getExpectedProducts().getAtomContainer(0);
  
          IQueryAtomContainer queryAtom = QueryAtomContainerCreator.createSymbolAndChargeQueryContainer(product);
          Assert.assertTrue(new UniversalIsomorphismTester().isIsomorph(molecule2, queryAtom));
  
      }
test_case.class_method_signature: AdductionProtonPBReactionTest.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 createSymbolAndChargeQueryContainer assertTrue isIsomorph
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(AdductionProtonPBReaction.class)
focal_class.modifier: private static
focal_class.original_string: private static ILoggingTool logger = LoggingToolFactory.createLoggingTool(AdductionProtonPBReaction.class);
focal_class.type: ILoggingTool
focal_class.var_name: logger
focal_class.file: base/reaction/src/main/java/org/openscience/cdk/reaction/type/AdductionProtonPBReaction.java
focal_class.identifier: AdductionProtonPBReaction
focal_class.interfaces: implements IReactionProcess
focal_class.class_method_signature: AdductionProtonPBReaction.AdductionProtonPBReaction()
focal_class.full_signature: public  AdductionProtonPBReaction()
focal_class.identifier: AdductionProtonPBReaction
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.signature:  AdductionProtonPBReaction()
focal_class.class_method_signature: AdductionProtonPBReaction.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: AdductionProtonPBReaction.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: AdductionProtonPBReaction.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: AdductionProtonPBReaction");
  
          if (reactants.getAtomContainerCount() != 1) {
              throw new CDKException("AdductionProtonPBReaction only expects one reactant");
          }
          if (agents != null) {
              throw new CDKException("AdductionProtonPBReaction 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);
  
          if (AtomContainerManipulator.getTotalCharge(reactant) != 0) return setOfReactions;
  
          Iterator<IBond> bondis = reactant.bonds().iterator();
          while (bondis.hasNext()) {
              IBond bondi = bondis.next();
  
              if (bondi.getFlag(CDKConstants.REACTIVE_CENTER)
                      && ((bondi.getOrder() == IBond.Order.DOUBLE) || (bondi.getOrder() == IBond.Order.TRIPLE))
                      && bondi.getBegin().getFlag(CDKConstants.REACTIVE_CENTER)
                      && bondi.getEnd().getFlag(CDKConstants.REACTIVE_CENTER)) {
                  int chargeAtom0 = bondi.getBegin().getFormalCharge() == null ? 0 : bondi.getBegin().getFormalCharge();
                  int chargeAtom1 = bondi.getEnd().getFormalCharge() == null ? 0 : bondi.getEnd().getFormalCharge();
                  if (chargeAtom0 >= 0 && chargeAtom1 >= 0
                          && reactant.getConnectedSingleElectronsCount(bondi.getBegin()) == 0
                          && reactant.getConnectedSingleElectronsCount(bondi.getEnd()) == 0
                          && reactant.getConnectedLonePairsCount(bondi.getBegin()) == 0
                          && reactant.getConnectedLonePairsCount(bondi.getEnd()) == 0) {
  
                      /**/
                      for (int j = 0; j < 2; j++) {
  
                          ArrayList<IAtom> atomList = new ArrayList<IAtom>();
                          if (j == 0) {
                              atomList.add(bondi.getBegin());
                              atomList.add(bondi.getEnd());
                          } else {
                              atomList.add(bondi.getEnd());
                              atomList.add(bondi.getBegin());
                          }
                          IAtom atomH = reactant.getBuilder().newInstance(IAtom.class, "H");
                          atomH.setFormalCharge(1);
                          atomList.add(atomH);
  
                          ArrayList<IBond> bondList = new ArrayList<IBond>();
                          bondList.add(bondi);
  
                          IAtomContainerSet moleculeSet = reactant.getBuilder().newInstance(IAtomContainerSet.class);
                          moleculeSet.addAtomContainer(reactant);
                          IAtomContainer adduct = reactant.getBuilder().newInstance(IAtomContainer.class);
                          adduct.addAtom(atomH);
                          moleculeSet.addAtomContainer(adduct);
  
                          IReaction reaction = mechanism.initiate(moleculeSet, atomList, bondList);
                          if (reaction == null)
                              continue;
                          else
                              setOfReactions.addReaction(reaction);
  
                      }
  
                  }
  
              }
          }
  
          return setOfReactions;
      }
focal_method.class_method_signature: AdductionProtonPBReaction.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 getTotalCharge iterator bonds hasNext next getFlag getOrder getOrder getFlag getBegin getFlag getEnd getFormalCharge getBegin getFormalCharge getBegin getFormalCharge getEnd getFormalCharge getEnd getConnectedSingleElectronsCount getBegin getConnectedSingleElectronsCount getEnd getConnectedLonePairsCount getBegin getConnectedLonePairsCount getEnd add getBegin add getEnd add getEnd add getBegin newInstance getBuilder setFormalCharge add add newInstance getBuilder addAtomContainer newInstance getBuilder addAtom 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)