test_class.file: tool/structgen/src/test/java/org/openscience/cdk/atomtype/StructGenAtomTypeGuesserTest.java
test_class.identifier: StructGenAtomTypeGuesserTest
test_class.superclass: extends CDKTestCase
test_case.body: @Test
      public void testPossibleAtomTypes_IAtomContainer_IAtom() throws java.lang.Exception {
          IAtomContainer mol = new AtomContainer();
          Atom atom = new Atom("C");
          atom.setImplicitHydrogenCount(3);
          Atom atom2 = new Atom("N");
          atom2.setImplicitHydrogenCount(2);
          mol.addAtom(atom);
          mol.addAtom(atom2);
          mol.addBond(new Bond(atom, atom2, IBond.Order.SINGLE));
  
          StructGenAtomTypeGuesser atm = new StructGenAtomTypeGuesser();
          List<IAtomType> matched = atm.possibleAtomTypes(mol, atom);
          Assert.assertNotNull(matched);
          Assert.assertTrue(matched.size() > 0);
          Assert.assertTrue(matched.get(0) instanceof IAtomType);
  
          Assert.assertEquals("C", ((IAtomType) matched.get(0)).getSymbol());
      }
test_case.class_method_signature: StructGenAtomTypeGuesserTest.testPossibleAtomTypes_IAtomContainer_IAtom()
test_case.full_signature: @Test public void testPossibleAtomTypes_IAtomContainer_IAtom()
test_case.identifier: testPossibleAtomTypes_IAtomContainer_IAtom
test_case.invocations: setImplicitHydrogenCount setImplicitHydrogenCount addAtom addAtom addBond possibleAtomTypes assertNotNull assertTrue size assertTrue get assertEquals getSymbol get
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testPossibleAtomTypes_IAtomContainer_IAtom()
focal_class.declarator: factory = null
focal_class.modifier: private static
focal_class.original_string: private static AtomTypeFactory factory = null;
focal_class.type: AtomTypeFactory
focal_class.var_name: factory
focal_class.declarator: logger  = LoggingToolFactory.createLoggingTool(StructGenAtomTypeGuesser.class)
focal_class.modifier: private static
focal_class.original_string: private static ILoggingTool    logger  = LoggingToolFactory.createLoggingTool(StructGenAtomTypeGuesser.class);
focal_class.type: ILoggingTool
focal_class.var_name: logger
focal_class.file: tool/structgen/src/main/java/org/openscience/cdk/atomtype/StructGenAtomTypeGuesser.java
focal_class.identifier: StructGenAtomTypeGuesser
focal_class.interfaces: implements IAtomTypeGuesser
focal_class.class_method_signature: StructGenAtomTypeGuesser.StructGenAtomTypeGuesser()
focal_class.full_signature: public  StructGenAtomTypeGuesser()
focal_class.identifier: StructGenAtomTypeGuesser
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.signature:  StructGenAtomTypeGuesser()
focal_class.class_method_signature: StructGenAtomTypeGuesser.possibleAtomTypes(IAtomContainer atomContainer, IAtom atom)
focal_class.full_signature: @Override public List<IAtomType> possibleAtomTypes(IAtomContainer atomContainer, IAtom atom)
focal_class.identifier: possibleAtomTypes
focal_class.modifiers: @Override public
focal_class.parameters: (IAtomContainer atomContainer, IAtom atom)
focal_class.return: List<IAtomType>
focal_class.signature: List<IAtomType> possibleAtomTypes(IAtomContainer atomContainer, IAtom atom)
focal_method.body: @Override
      public List<IAtomType> possibleAtomTypes(IAtomContainer atomContainer, IAtom atom) throws CDKException {
          if (factory == null) {
              try {
                  factory = AtomTypeFactory.getInstance("org/openscience/cdk/config/data/structgen_atomtypes.xml",
                          atom.getBuilder());
              } catch (Exception ex1) {
                  logger.error(ex1.getMessage());
                  logger.debug(ex1);
                  throw new CDKException("Could not instantiate the AtomType list!", ex1);
              }
          }
  
          double bondOrderSum = atomContainer.getBondOrderSum(atom);
          IBond.Order maxBondOrder = atomContainer.getMaximumBondOrder(atom);
          int charge = atom.getFormalCharge();
          int hcount = atom.getImplicitHydrogenCount();
  
          List<IAtomType> matchingTypes = new ArrayList<IAtomType>();
          IAtomType[] types = factory.getAtomTypes(atom.getSymbol());
          for (IAtomType type : types) {
              logger.debug("   ... matching atom ", atom, " vs ", type);
              if (bondOrderSum - charge + hcount <= type.getBondOrderSum()
                      && !BondManipulator.isHigherOrder(maxBondOrder, type.getMaxBondOrder())) {
                  matchingTypes.add(type);
              }
          }
          logger.debug("    No Match");
  
          return matchingTypes;
      }
focal_method.class_method_signature: StructGenAtomTypeGuesser.possibleAtomTypes(IAtomContainer atomContainer, IAtom atom)
focal_method.full_signature: @Override public List<IAtomType> possibleAtomTypes(IAtomContainer atomContainer, IAtom atom)
focal_method.identifier: possibleAtomTypes
focal_method.invocations: getInstance getBuilder error getMessage debug getBondOrderSum getMaximumBondOrder getFormalCharge getImplicitHydrogenCount getAtomTypes getSymbol debug getBondOrderSum isHigherOrder getMaxBondOrder add debug
focal_method.modifiers: @Override public
focal_method.parameters: (IAtomContainer atomContainer, IAtom atom)
focal_method.return: List<IAtomType>
focal_method.signature: List<IAtomType> possibleAtomTypes(IAtomContainer atomContainer, IAtom atom)