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/PiBondingMovementReactionTest.java
test_class.identifier: PiBondingMovementReactionTest
test_class.superclass: extends ReactionProcessTest
test_case.body: @Test
      @Override
      public void testInitiate_IAtomContainerSet_IAtomContainerSet() throws Exception {
          IReactionProcess type = new PiBondingMovementReaction();
          // C1=C(C)-C(C)=C-C=C1
          IAtomContainer molecule = builder.newInstance(IAtomContainer.class);
          molecule.addAtom(builder.newInstance(IAtom.class, "C"));
          molecule.addAtom(builder.newInstance(IAtom.class, "C"));
          molecule.addBond(0, 1, IBond.Order.DOUBLE);
          molecule.addAtom(builder.newInstance(IAtom.class, "C"));
          molecule.addBond(1, 2, IBond.Order.SINGLE);
          molecule.addAtom(builder.newInstance(IAtom.class, "C"));
          molecule.addBond(2, 3, IBond.Order.DOUBLE);
          molecule.addAtom(builder.newInstance(IAtom.class, "C"));
          molecule.addBond(3, 4, IBond.Order.SINGLE);
          molecule.addAtom(builder.newInstance(IAtom.class, "C"));
          molecule.addBond(4, 5, IBond.Order.DOUBLE);
          molecule.addBond(5, 0, IBond.Order.SINGLE);
  
          addExplicitHydrogens(molecule);
          AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(molecule);
          makeSureAtomTypesAreRecognized(molecule);
  
          IAtomContainerSet setOfReactants = DefaultChemObjectBuilder.getInstance().newInstance(IAtomContainerSet.class);
          setOfReactants.addAtomContainer(molecule);
  
          /* initiate */
          List<IParameterReact> paramList = new ArrayList<>();
          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(1, setOfReactions.getReaction(0).getProductCount());
  
          IAtomContainer product2 = setOfReactions.getReaction(0).getProducts().getAtomContainer(0);
  
          IQueryAtomContainer queryAtom = QueryAtomContainerCreator.createSymbolAndChargeQueryContainer(product2);
          Assert.assertTrue(new UniversalIsomorphismTester().isIsomorph(molecule, queryAtom));
  
      }
test_case.class_method_signature: PiBondingMovementReactionTest.testInitiate_IAtomContainerSet_IAtomContainerSet()
test_case.full_signature: @Test @Override public void testInitiate_IAtomContainerSet_IAtomContainerSet()
test_case.identifier: testInitiate_IAtomContainerSet_IAtomContainerSet
test_case.invocations: newInstance addAtom newInstance addAtom newInstance addBond addAtom newInstance addBond addAtom newInstance addBond addAtom newInstance addBond addAtom newInstance addBond addBond addExplicitHydrogens percieveAtomTypesAndConfigureAtoms makeSureAtomTypesAreRecognized newInstance getInstance addAtomContainer setParameter add setParameterList initiate assertEquals getReactionCount assertEquals getProductCount getReaction getAtomContainer getProducts getReaction 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(PiBondingMovementReaction.class)
focal_class.modifier: private static
focal_class.original_string: private static ILoggingTool logger = LoggingToolFactory.createLoggingTool(PiBondingMovementReaction.class);
focal_class.type: ILoggingTool
focal_class.var_name: logger
focal_class.file: base/reaction/src/main/java/org/openscience/cdk/reaction/type/PiBondingMovementReaction.java
focal_class.identifier: PiBondingMovementReaction
focal_class.interfaces: implements IReactionProcess
focal_class.class_method_signature: PiBondingMovementReaction.PiBondingMovementReaction()
focal_class.full_signature: public  PiBondingMovementReaction()
focal_class.identifier: PiBondingMovementReaction
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.signature:  PiBondingMovementReaction()
focal_class.class_method_signature: PiBondingMovementReaction.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: PiBondingMovementReaction.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: PiBondingMovementReaction.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: PiBondingMovementReaction");
  
          if (reactants.getAtomContainerCount() != 1) {
              throw new CDKException("PiBondingMovementReaction only expects one reactant");
          }
          if (agents != null) {
              throw new CDKException("PiBondingMovementReaction don't expects agents");
          }
  
          IReactionSet setOfReactions = reactants.getBuilder().newInstance(IReactionSet.class);
          IAtomContainer reactant = reactants.getAtomContainer(0);
  
          AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(reactant);
          /*
           * 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((Boolean)paramsMap.get("lookingSymmetry")){
          //			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);
  
              //only rings with even number of atoms
              int nrAtoms = ring.getAtomCount();
              if (nrAtoms % 2 == 0) {
                  int nrSingleBonds = 0;
                  for (IBond iBond : ring.bonds()) {
                      if (iBond.getOrder() == IBond.Order.SINGLE) nrSingleBonds++;
                  }
                  //if exactly half (nrAtoms/2==nrSingleBonds)
                  if (nrSingleBonds != 0 && nrAtoms / 2 == nrSingleBonds) {
                      Iterator<IBond> bondfs = ring.bonds().iterator();
                      boolean ringCompletActive = false;
                      while (bondfs.hasNext()) {
                          if (bondfs.next().getFlag(CDKConstants.REACTIVE_CENTER))
                              ringCompletActive = true;
                          else {
                              ringCompletActive = false;
                              break;
                          }
                      }
                      if (!ringCompletActive) continue;
  
                      IReaction reaction = reactants.getBuilder().newInstance(IReaction.class);
                      reaction.addReactant(reactant);
  
                      IAtomContainer reactantCloned;
                      try {
                          reactantCloned = reactant.clone();
                      } catch (CloneNotSupportedException e) {
                          throw new CDKException("Could not clone IAtomContainer!", e);
                      }
  
                      for (IBond bondi : ring.bonds()) {
                          int bondiP = reactant.indexOf(bondi);
                          if (bondi.getOrder() == IBond.Order.SINGLE)
                              BondManipulator.increaseBondOrder(reactantCloned.getBond(bondiP));
                          else
                              BondManipulator.decreaseBondOrder(reactantCloned.getBond(bondiP));
  
                      }
  
                      reaction.addProduct(reactantCloned);
                      setOfReactions.addReaction(reaction);
                  }
  
              }
          }
  
          return setOfReactions;
      }
focal_method.class_method_signature: PiBondingMovementReaction.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 getParameterClass isSetParameter setActiveCenters findAllRings getAtomContainerCount getAtomContainer getAtomCount bonds getOrder iterator bonds hasNext getFlag next newInstance getBuilder addReactant clone bonds indexOf getOrder increaseBondOrder getBond decreaseBondOrder getBond addProduct 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)