test_class.file: legacy/src/test/java/org/openscience/cdk/aromaticity/AromaticityCalculatorTest.java
test_class.identifier: AromaticityCalculatorTest
test_class.superclass: extends CDKTestCase
test_case.body: @Test
      public void testIsAromatic_IRing_IAtomContainer() throws Exception {
          SmilesParser sp = new SmilesParser(DefaultChemObjectBuilder.getInstance());
  
          IAtomContainer mol = sp.parseSmiles("c1ccncc1");
          IRingSet rs = (new AllRingsFinder()).findAllRings(mol);
  
          Assert.assertEquals(1, rs.getAtomContainerCount());
          Assert.assertTrue(AromaticityCalculator.isAromatic((IRing) rs.getAtomContainer(0), mol));
      }
test_case.class_method_signature: AromaticityCalculatorTest.testIsAromatic_IRing_IAtomContainer()
test_case.full_signature: @Test public void testIsAromatic_IRing_IAtomContainer()
test_case.identifier: testIsAromatic_IRing_IAtomContainer
test_case.invocations: getInstance parseSmiles findAllRings assertEquals getAtomContainerCount assertTrue isAromatic getAtomContainer
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testIsAromatic_IRing_IAtomContainer()
focal_class.file: legacy/src/main/java/org/openscience/cdk/aromaticity/AromaticityCalculator.java
focal_class.identifier: AromaticityCalculator
focal_class.class_method_signature: AromaticityCalculator.isAromatic(IRing ring, IAtomContainer atomContainer)
focal_class.full_signature: public static boolean isAromatic(IRing ring, IAtomContainer atomContainer)
focal_class.identifier: isAromatic
focal_class.modifiers: public static
focal_class.parameters: (IRing ring, IAtomContainer atomContainer)
focal_class.return: boolean
focal_class.signature: boolean isAromatic(IRing ring, IAtomContainer atomContainer)
focal_method.body: public static boolean isAromatic(IRing ring, IAtomContainer atomContainer) {
  
          java.util.Iterator<IAtom> ringAtoms = ring.atoms().iterator();
          int eCount = 0;
          java.util.List<IBond> conectedBonds;
          int numDoubleBond = 0;
          boolean allConnectedBondsSingle;
  
          while (ringAtoms.hasNext()) {
              IAtom atom = ringAtoms.next();
              numDoubleBond = 0;
              allConnectedBondsSingle = true;
              conectedBonds = atomContainer.getConnectedBondsList(atom);
              for (IBond conectedBond : conectedBonds) {
                  if (conectedBond.getOrder() == IBond.Order.DOUBLE && ring.contains(conectedBond)) {
                      numDoubleBond++;
                  }
  
                  // Count the Electron if bond order = 1.5
                  else if (conectedBond.getFlag(CDKConstants.ISAROMATIC) && ring.contains(conectedBond)) {
                      numDoubleBond = 1;
                  }
  
                  if (conectedBond.getOrder() != IBond.Order.SINGLE) {
                      allConnectedBondsSingle = false;
                  }
              }
              if (numDoubleBond == 1) {
                  //C or heteroatoms both contibute 1 electron in sp2 hybridized form
                  eCount++;
              } else if (!atom.getSymbol().equals("C")) {
                  //Heteroatom probably in sp3 hybrid therefore 2 electrons contributed.
                  eCount = eCount + 2;
              } else if (atom.getFlag(CDKConstants.ISAROMATIC)) {
                  eCount++;
              } else if (allConnectedBondsSingle && atom.getSymbol().equals("C") && atom.getFormalCharge() == 1.0) {
                  // This is for tropylium and kinds.
                  // Dependence on hybridisation would be better:
                  // empty p-orbital is needed
                  continue;
              } else {
                  return false;
              }
          }
          return eCount - 2 != 0 && (eCount - 2) % 4 == 0;
      }
focal_method.class_method_signature: AromaticityCalculator.isAromatic(IRing ring, IAtomContainer atomContainer)
focal_method.full_signature: public static boolean isAromatic(IRing ring, IAtomContainer atomContainer)
focal_method.identifier: isAromatic
focal_method.invocations: iterator atoms hasNext next getConnectedBondsList getOrder contains getFlag contains getOrder equals getSymbol getFlag equals getSymbol getFormalCharge
focal_method.modifiers: public static
focal_method.parameters: (IRing ring, IAtomContainer atomContainer)
focal_method.return: boolean
focal_method.signature: boolean isAromatic(IRing ring, IAtomContainer atomContainer)