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/SharingChargeDBReactionTest.java
test_class.identifier: SharingChargeDBReactionTest
test_class.superclass: extends ReactionProcessTest
test_case.body: @Test
      public void testMapping() throws Exception {
          IReactionProcess type = new SharingChargeDBReaction();
  
          IAtomContainerSet setOfReactants = getExampleReactants();
          IAtomContainer molecule = setOfReactants.getAtomContainer(0);
  
          /* automatic search of the center active */
          List<IParameterReact> paramList = new ArrayList<IParameterReact>();
          IParameterReact param = new SetReactionCenter();
          param.setParameter(Boolean.FALSE);
          paramList.add(param);
          type.setParameterList(paramList);
          /* initiate */
  
          IReactionSet setOfReactions = type.initiate(setOfReactants, null);
  
          IAtomContainer product = setOfReactions.getReaction(0).getProducts().getAtomContainer(0);
  
          Assert.assertEquals(8, setOfReactions.getReaction(0).getMappingCount());
  
          IAtom mappedProductA1 = (IAtom) ReactionManipulator.getMappedChemObject(setOfReactions.getReaction(0),
                  molecule.getAtom(1));
          Assert.assertEquals(mappedProductA1, product.getAtom(1));
          mappedProductA1 = (IAtom) ReactionManipulator.getMappedChemObject(setOfReactions.getReaction(0),
                  molecule.getAtom(2));
          Assert.assertEquals(mappedProductA1, product.getAtom(2));
  
      }
test_case.class_method_signature: SharingChargeDBReactionTest.testMapping()
test_case.full_signature: @Test public void testMapping()
test_case.identifier: testMapping
test_case.invocations: getExampleReactants getAtomContainer setParameter add setParameterList initiate getAtomContainer getProducts getReaction assertEquals getMappingCount getReaction 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(SharingChargeDBReaction.class)
focal_class.modifier: private static
focal_class.original_string: private static ILoggingTool logger = LoggingToolFactory.createLoggingTool(SharingChargeDBReaction.class);
focal_class.type: ILoggingTool
focal_class.var_name: logger
focal_class.file: base/reaction/src/main/java/org/openscience/cdk/reaction/type/SharingChargeDBReaction.java
focal_class.identifier: SharingChargeDBReaction
focal_class.interfaces: implements IReactionProcess
focal_class.class_method_signature: SharingChargeDBReaction.SharingChargeDBReaction()
focal_class.full_signature: public  SharingChargeDBReaction()
focal_class.identifier: SharingChargeDBReaction
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.signature:  SharingChargeDBReaction()
focal_class.class_method_signature: SharingChargeDBReaction.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: SharingChargeDBReaction.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: SharingChargeDBReaction.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: SharingChargeDBReaction");
  
          if (reactants.getAtomContainerCount() != 1) {
              throw new CDKException("SharingChargeDBReaction only expects one reactant");
          }
          if (agents != null) {
              throw new CDKException("SharingChargeDBReaction 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> atomis = reactant.atoms().iterator();
          while (atomis.hasNext()) {
              IAtom atomi = atomis.next();
  
              if (atomi.getFlag(CDKConstants.REACTIVE_CENTER) && atomi.getFormalCharge() == 1) {
  
                  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)
                              if (reactant.getConnectedSingleElectronsCount(atomj) == 0) {
  
                                  ArrayList<IAtom> atomList = new ArrayList<IAtom>();
                                  atomList.add(atomj);
                                  atomList.add(atomi);
                                  ArrayList<IBond> bondList = new ArrayList<IBond>();
                                  bondList.add(bondi);
  
                                  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: SharingChargeDBReaction.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 hasNext next getFlag getFormalCharge iterator getConnectedBondsList hasNext next getFlag getOrder getOther getFlag getFormalCharge getConnectedSingleElectronsCount 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)