test_class.declarator: ATOMTYPE_LIST = "structgen_atomtypes.owl"
test_class.modifier: private final static
test_class.original_string: private final static String          ATOMTYPE_LIST = "structgen_atomtypes.owl";
test_class.type: String
test_class.var_name: ATOMTYPE_LIST
test_class.declarator: factory       = AtomTypeFactory.getInstance("org/openscience/cdk/config/data/"
                                                                 + ATOMTYPE_LIST, SilentChemObjectBuilder.getInstance())
test_class.modifier: private final static
test_class.original_string: private final static AtomTypeFactory factory       = AtomTypeFactory.getInstance("org/openscience/cdk/config/data/"
                                                                 + ATOMTYPE_LIST, SilentChemObjectBuilder.getInstance());
test_class.type: AtomTypeFactory
test_class.var_name: factory
test_class.declarator: testedAtomTypes = new HashMap<String, Integer>()
test_class.modifier: private static
test_class.original_string: private static Map<String, Integer> testedAtomTypes = new HashMap<String, Integer>();
test_class.type: Map<String, Integer>
test_class.var_name: testedAtomTypes
test_class.file: tool/structgen/src/test/java/org/openscience/cdk/atomtype/StructGenMatcherTest.java
test_class.identifier: StructGenMatcherTest
test_class.superclass: extends AbstractAtomTypeTest
test_case.body: @Test
      public void testP4() throws Exception {
          IAtomContainer mol = DefaultChemObjectBuilder.getInstance().newInstance(IAtomContainer.class);
          IAtom p = DefaultChemObjectBuilder.getInstance().newInstance(IAtom.class, "P");
          IAtom cl1 = DefaultChemObjectBuilder.getInstance().newInstance(IAtom.class, "Cl");
          IAtom cl2 = DefaultChemObjectBuilder.getInstance().newInstance(IAtom.class, "Cl");
          IAtom cl3 = DefaultChemObjectBuilder.getInstance().newInstance(IAtom.class, "Cl");
          IAtom s = DefaultChemObjectBuilder.getInstance().newInstance(IAtom.class, "S");
  
          IBond bond1 = DefaultChemObjectBuilder.getInstance().newInstance(IBond.class, p, cl1, IBond.Order.SINGLE);
          IBond bond2 = DefaultChemObjectBuilder.getInstance().newInstance(IBond.class, p, cl2, IBond.Order.SINGLE);
          IBond bond3 = DefaultChemObjectBuilder.getInstance().newInstance(IBond.class, p, cl3, IBond.Order.SINGLE);
          IBond bond4 = DefaultChemObjectBuilder.getInstance().newInstance(IBond.class, p, s, IBond.Order.DOUBLE);
  
          mol.addAtom(p);
          mol.addAtom(cl1);
          mol.addAtom(cl2);
          mol.addAtom(cl3);
          mol.addAtom(s);
  
          mol.addBond(bond1);
          mol.addBond(bond2);
          mol.addBond(bond3);
          mol.addBond(bond4);
  
          StructGenMatcher matcher = new StructGenMatcher();
          IAtomType matched;
  
          matched = matcher.findMatchingAtomType(mol, mol.getAtom(0));
          assertAtomType(testedAtomTypes, "P4", matched);
  
          matched = matcher.findMatchingAtomType(mol, mol.getAtom(4));
          assertAtomType(testedAtomTypes, "S2", matched);
  
          for (int i = 1; i < 4; i++) {
              matched = matcher.findMatchingAtomType(mol, mol.getAtom(i));
              assertAtomType(testedAtomTypes, "atom " + i + " failed to match", "Cl1", matched);
          }
      }
test_case.class_method_signature: StructGenMatcherTest.testP4()
test_case.full_signature: @Test public void testP4()
test_case.identifier: testP4
test_case.invocations: newInstance getInstance newInstance getInstance newInstance getInstance newInstance getInstance newInstance getInstance newInstance getInstance newInstance getInstance newInstance getInstance newInstance getInstance newInstance getInstance addAtom addAtom addAtom addAtom addAtom addBond addBond addBond addBond findMatchingAtomType getAtom assertAtomType findMatchingAtomType getAtom assertAtomType findMatchingAtomType getAtom assertAtomType
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testP4()
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(StructGenMatcher.class)
focal_class.modifier: private static
focal_class.original_string: private static ILoggingTool    logger  = LoggingToolFactory.createLoggingTool(StructGenMatcher.class);
focal_class.type: ILoggingTool
focal_class.var_name: logger
focal_class.file: tool/structgen/src/main/java/org/openscience/cdk/atomtype/StructGenMatcher.java
focal_class.identifier: StructGenMatcher
focal_class.interfaces: implements IAtomTypeMatcher
focal_class.class_method_signature: StructGenMatcher.StructGenMatcher()
focal_class.full_signature: public  StructGenMatcher()
focal_class.identifier: StructGenMatcher
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.signature:  StructGenMatcher()
focal_class.class_method_signature: StructGenMatcher.findMatchingAtomTypes(IAtomContainer atomContainer)
focal_class.full_signature: @Override public IAtomType[] findMatchingAtomTypes(IAtomContainer atomContainer)
focal_class.identifier: findMatchingAtomTypes
focal_class.modifiers: @Override public
focal_class.parameters: (IAtomContainer atomContainer)
focal_class.return: IAtomType[]
focal_class.signature: IAtomType[] findMatchingAtomTypes(IAtomContainer atomContainer)
focal_class.class_method_signature: StructGenMatcher.findMatchingAtomType(IAtomContainer atomContainer, IAtom atom)
focal_class.full_signature: @Override public IAtomType findMatchingAtomType(IAtomContainer atomContainer, IAtom atom)
focal_class.identifier: findMatchingAtomType
focal_class.modifiers: @Override public
focal_class.parameters: (IAtomContainer atomContainer, IAtom atom)
focal_class.return: IAtomType
focal_class.signature: IAtomType findMatchingAtomType(IAtomContainer atomContainer, IAtom atom)
focal_method.body: @Override
      public IAtomType findMatchingAtomType(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() == null ? 0 : atom.getImplicitHydrogenCount();
  
          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())) {
                  return type;
              }
          }
          logger.debug("    No Match");
  
          return null;
      }
focal_method.class_method_signature: StructGenMatcher.findMatchingAtomType(IAtomContainer atomContainer, IAtom atom)
focal_method.full_signature: @Override public IAtomType findMatchingAtomType(IAtomContainer atomContainer, IAtom atom)
focal_method.identifier: findMatchingAtomType
focal_method.invocations: getInstance getBuilder error getMessage debug getBondOrderSum getMaximumBondOrder getFormalCharge getImplicitHydrogenCount getImplicitHydrogenCount getAtomTypes getSymbol debug getBondOrderSum isHigherOrder getMaxBondOrder debug
focal_method.modifiers: @Override public
focal_method.parameters: (IAtomContainer atomContainer, IAtom atom)
focal_method.return: IAtomType
focal_method.signature: IAtomType findMatchingAtomType(IAtomContainer atomContainer, IAtom atom)