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.declarator: uiTester
test_class.modifier: private
test_class.original_string: private UniversalIsomorphismTester    uiTester;
test_class.type: UniversalIsomorphismTester
test_class.var_name: uiTester
test_class.file: base/reaction/src/test/java/org/openscience/cdk/reaction/type/HeterolyticCleavageSBReactionTest.java
test_class.identifier: HeterolyticCleavageSBReactionTest
test_class.superclass: extends ReactionProcessTest
test_case.body: @Test
      public void testCspSingleB() throws Exception {
          //Smiles("C#CC")
          IAtomContainer molecule = builder.newInstance(IAtomContainer.class);
          molecule.addAtom(builder.newInstance(IAtom.class, "C"));
          molecule.addAtom(builder.newInstance(IAtom.class, "C"));
          molecule.addAtom(builder.newInstance(IAtom.class, "C"));
          molecule.addBond(0, 1, IBond.Order.TRIPLE);
          molecule.addBond(1, 2, IBond.Order.SINGLE);
          molecule.addAtom(builder.newInstance(IAtom.class, "H"));
          molecule.addAtom(builder.newInstance(IAtom.class, "H"));
          molecule.addAtom(builder.newInstance(IAtom.class, "H"));
          molecule.addAtom(builder.newInstance(IAtom.class, "H"));
          molecule.addBond(0, 3, IBond.Order.SINGLE);
          molecule.addBond(2, 4, IBond.Order.SINGLE);
          molecule.addBond(2, 5, IBond.Order.SINGLE);
          molecule.addBond(2, 6, IBond.Order.SINGLE);
          AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(molecule);
  
          molecule.getAtom(1).setFlag(CDKConstants.REACTIVE_CENTER, true);
          molecule.getAtom(2).setFlag(CDKConstants.REACTIVE_CENTER, true);
          molecule.getBond(1).setFlag(CDKConstants.REACTIVE_CENTER, true);
  
          IAtomContainerSet setOfReactants = DefaultChemObjectBuilder.getInstance().newInstance(IAtomContainerSet.class);
          setOfReactants.addAtomContainer(molecule);
  
          IReactionProcess type = new HeterolyticCleavageSBReaction();
          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);
  
          Assert.assertEquals(2, setOfReactions.getReactionCount());
  
          // expected products
  
          //Smiles("C#[C-]")
          IAtomContainer expected1 = builder.newInstance(IAtomContainer.class);
          expected1.addAtom(builder.newInstance(IAtom.class, "C"));
          expected1.addAtom(builder.newInstance(IAtom.class, "C"));
          expected1.getAtom(1).setFormalCharge(-1);
          expected1.addBond(0, 1, IBond.Order.TRIPLE);
          expected1.addAtom(builder.newInstance(IAtom.class, "H"));
          expected1.addBond(0, 2, IBond.Order.SINGLE);
          AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(expected1);
          IAtomContainer product1 = setOfReactions.getReaction(1).getProducts().getAtomContainer(0);
          QueryAtomContainer queryAtom = QueryAtomContainerCreator.createSymbolAndChargeQueryContainer(expected1);
          Assert.assertTrue(uiTester.isIsomorph(product1, queryAtom));
  
          //Smiles("[C+]")
          IAtomContainer expected2 = builder.newInstance(IAtomContainer.class);
          expected2.addAtom(builder.newInstance(IAtom.class, "C"));
          expected2.getAtom(0).setFormalCharge(+1);
          expected2.addAtom(builder.newInstance(IAtom.class, "H"));
          expected2.addAtom(builder.newInstance(IAtom.class, "H"));
          expected2.addAtom(builder.newInstance(IAtom.class, "H"));
          expected2.addBond(0, 1, IBond.Order.SINGLE);
          expected2.addBond(0, 2, IBond.Order.SINGLE);
          expected2.addBond(0, 3, IBond.Order.SINGLE);
          AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(expected2);
          lpcheck.saturate(expected2);
          IAtomContainer product2 = setOfReactions.getReaction(1).getProducts().getAtomContainer(1);
          queryAtom = QueryAtomContainerCreator.createSymbolAndChargeQueryContainer(expected2);
          Assert.assertTrue(uiTester.isIsomorph(product2, queryAtom));
  
          //Smiles("C#[C+]")
          expected1.getAtom(1).setFormalCharge(+1);
          AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(expected1);
          lpcheck.saturate(expected1);
          product1 = setOfReactions.getReaction(0).getProducts().getAtomContainer(0);
          queryAtom = QueryAtomContainerCreator.createSymbolAndChargeQueryContainer(expected1);
          Assert.assertTrue(uiTester.isIsomorph(product1, queryAtom));
  
          //Smiles("[C-]")
          expected2.getAtom(0).setFormalCharge(-1);
          AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(expected2);
          product2 = setOfReactions.getReaction(0).getProducts().getAtomContainer(1);
          queryAtom = QueryAtomContainerCreator.createSymbolAndChargeQueryContainer(expected2);
          Assert.assertTrue(uiTester.isIsomorph(product2, queryAtom));
  
      }
test_case.class_method_signature: HeterolyticCleavageSBReactionTest.testCspSingleB()
test_case.full_signature: @Test public void testCspSingleB()
test_case.identifier: testCspSingleB
test_case.invocations: newInstance addAtom newInstance addAtom newInstance addAtom newInstance addBond addBond addAtom newInstance addAtom newInstance addAtom newInstance addAtom newInstance addBond addBond addBond addBond percieveAtomTypesAndConfigureAtoms setFlag getAtom setFlag getAtom setFlag getBond newInstance getInstance addAtomContainer setParameter add setParameterList initiate assertEquals getReactionCount newInstance addAtom newInstance addAtom newInstance setFormalCharge getAtom addBond addAtom newInstance addBond percieveAtomTypesAndConfigureAtoms getAtomContainer getProducts getReaction createSymbolAndChargeQueryContainer assertTrue isIsomorph newInstance addAtom newInstance setFormalCharge getAtom addAtom newInstance addAtom newInstance addAtom newInstance addBond addBond addBond percieveAtomTypesAndConfigureAtoms saturate getAtomContainer getProducts getReaction createSymbolAndChargeQueryContainer assertTrue isIsomorph setFormalCharge getAtom percieveAtomTypesAndConfigureAtoms saturate getAtomContainer getProducts getReaction createSymbolAndChargeQueryContainer assertTrue isIsomorph setFormalCharge getAtom percieveAtomTypesAndConfigureAtoms getAtomContainer getProducts getReaction createSymbolAndChargeQueryContainer assertTrue isIsomorph
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testCspSingleB()
focal_class.declarator: logger = LoggingToolFactory.createLoggingTool(HeterolyticCleavageSBReaction.class)
focal_class.modifier: private static
focal_class.original_string: private static ILoggingTool logger = LoggingToolFactory.createLoggingTool(HeterolyticCleavageSBReaction.class);
focal_class.type: ILoggingTool
focal_class.var_name: logger
focal_class.file: base/reaction/src/main/java/org/openscience/cdk/reaction/type/HeterolyticCleavageSBReaction.java
focal_class.identifier: HeterolyticCleavageSBReaction
focal_class.interfaces: implements IReactionProcess
focal_class.class_method_signature: HeterolyticCleavageSBReaction.HeterolyticCleavageSBReaction()
focal_class.full_signature: public  HeterolyticCleavageSBReaction()
focal_class.identifier: HeterolyticCleavageSBReaction
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.signature:  HeterolyticCleavageSBReaction()
focal_class.class_method_signature: HeterolyticCleavageSBReaction.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: HeterolyticCleavageSBReaction.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: HeterolyticCleavageSBReaction.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: HeterolyticCleavageSBReaction");
  
          if (reactants.getAtomContainerCount() != 1) {
              throw new CDKException("HeterolyticCleavageSBReaction only expects one reactant");
          }
          if (agents != null) {
              throw new CDKException("HeterolyticCleavageSBReaction 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<IBond> bondis = reactant.bonds().iterator();
          while (bondis.hasNext()) {
              IBond bondi = bondis.next();
              IAtom atom1 = bondi.getBegin();
              IAtom atom2 = bondi.getEnd();
              if (bondi.getFlag(CDKConstants.REACTIVE_CENTER) && bondi.getOrder() == IBond.Order.SINGLE
                      && atom1.getFlag(CDKConstants.REACTIVE_CENTER) && atom2.getFlag(CDKConstants.REACTIVE_CENTER)
                      && (atom1.getFormalCharge() == CDKConstants.UNSET ? 0 : atom1.getFormalCharge()) == 0
                      && (atom2.getFormalCharge() == CDKConstants.UNSET ? 0 : atom2.getFormalCharge()) == 0
                      && reactant.getConnectedSingleElectronsCount(atom1) == 0
                      && reactant.getConnectedSingleElectronsCount(atom2) == 0) {
  
                  /**/
                  for (int j = 0; j < 2; j++) {
  
                      ArrayList<IAtom> atomList = new ArrayList<IAtom>();
                      if (j == 0) {
                          atomList.add(atom1);
                          atomList.add(atom2);
                      } else {
                          atomList.add(atom2);
                          atomList.add(atom1);
                      }
                      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: HeterolyticCleavageSBReaction.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 bonds hasNext next getBegin getEnd getFlag getOrder getFlag getFlag getFormalCharge getFormalCharge getFormalCharge getFormalCharge getConnectedSingleElectronsCount getConnectedSingleElectronsCount 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)