test_class.file: descriptor/qsarmolecular/src/test/java/org/openscience/cdk/qsar/descriptors/molecular/HBondDonorCountDescriptorTest.java
test_class.identifier: HBondDonorCountDescriptorTest
test_class.superclass: extends MolecularDescriptorTest
test_case.body: @Test
      public void testCID9257() {
          IChemObjectBuilder builder = DefaultChemObjectBuilder.getInstance();
          IAtomContainer mol = builder.newInstance(IAtomContainer.class);
          IAtom a1 = builder.newInstance(IAtom.class, "N");
          a1.setFormalCharge(0);
          a1.setPoint3d(new Point3d(0.5509, 0.9639, 0.0));
          mol.addAtom(a1);
          IAtom a2 = builder.newInstance(IAtom.class, "N");
          a2.setFormalCharge(0);
          a2.setPoint3d(new Point3d(1.1852, -0.2183, 1.0E-4));
          mol.addAtom(a2);
          IAtom a3 = builder.newInstance(IAtom.class, "N");
          a3.setFormalCharge(0);
          a3.setPoint3d(new Point3d(-1.087, -0.4827, 2.0E-4));
          mol.addAtom(a3);
          IAtom a4 = builder.newInstance(IAtom.class, "C");
          a4.setFormalCharge(0);
          a4.setPoint3d(new Point3d(-0.7991, 0.7981, -1.0E-4));
          mol.addAtom(a4);
          IAtom a5 = builder.newInstance(IAtom.class, "C");
          a5.setFormalCharge(0);
          a5.setPoint3d(new Point3d(0.15, -1.0609, -2.0E-4));
          mol.addAtom(a5);
          IAtom a6 = builder.newInstance(IAtom.class, "H");
          a6.setFormalCharge(0);
          a6.setPoint3d(new Point3d(1.094, 1.8191, 1.0E-4));
          mol.addAtom(a6);
          IAtom a7 = builder.newInstance(IAtom.class, "H");
          a7.setFormalCharge(0);
          a7.setPoint3d(new Point3d(-1.4981, 1.6215, -2.0E-4));
          mol.addAtom(a7);
          IAtom a8 = builder.newInstance(IAtom.class, "H");
          a8.setFormalCharge(0);
          a8.setPoint3d(new Point3d(0.3019, -2.13, -2.0E-4));
          mol.addAtom(a8);
          IBond b1 = builder.newInstance(IBond.class, a1, a2, IBond.Order.SINGLE);
          mol.addBond(b1);
          IBond b2 = builder.newInstance(IBond.class, a1, a4, IBond.Order.SINGLE);
          mol.addBond(b2);
          IBond b3 = builder.newInstance(IBond.class, a1, a6, IBond.Order.SINGLE);
          mol.addBond(b3);
          IBond b4 = builder.newInstance(IBond.class, a2, a5, IBond.Order.DOUBLE);
          mol.addBond(b4);
          IBond b5 = builder.newInstance(IBond.class, a3, a4, IBond.Order.DOUBLE);
          mol.addBond(b5);
          IBond b6 = builder.newInstance(IBond.class, a3, a5, IBond.Order.SINGLE);
          mol.addBond(b6);
          IBond b7 = builder.newInstance(IBond.class, a4, a7, IBond.Order.SINGLE);
          mol.addBond(b7);
          IBond b8 = builder.newInstance(IBond.class, a5, a8, IBond.Order.SINGLE);
          mol.addBond(b8);
  
          Assert.assertEquals(1, ((IntegerResult) descriptor.calculate(mol).getValue()).intValue());
      }
test_case.class_method_signature: HBondDonorCountDescriptorTest.testCID9257()
test_case.full_signature: @Test public void testCID9257()
test_case.identifier: testCID9257
test_case.invocations: getInstance newInstance newInstance setFormalCharge setPoint3d addAtom newInstance setFormalCharge setPoint3d addAtom newInstance setFormalCharge setPoint3d addAtom newInstance setFormalCharge setPoint3d addAtom newInstance setFormalCharge setPoint3d addAtom newInstance setFormalCharge setPoint3d addAtom newInstance setFormalCharge setPoint3d addAtom newInstance setFormalCharge setPoint3d addAtom newInstance addBond newInstance addBond newInstance addBond newInstance addBond newInstance addBond newInstance addBond newInstance addBond newInstance addBond assertEquals intValue getValue calculate
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testCID9257()
focal_class.declarator: NAMES = {"nHBDon"}
focal_class.modifier: private static final
focal_class.original_string: private static final String[] NAMES = {"nHBDon"};
focal_class.type: String[]
focal_class.var_name: NAMES
focal_class.file: descriptor/qsarmolecular/src/main/java/org/openscience/cdk/qsar/descriptors/molecular/HBondDonorCountDescriptor.java
focal_class.identifier: HBondDonorCountDescriptor
focal_class.interfaces: implements IMolecularDescriptor
focal_class.class_method_signature: HBondDonorCountDescriptor.HBondDonorCountDescriptor()
focal_class.full_signature: public  HBondDonorCountDescriptor()
focal_class.identifier: HBondDonorCountDescriptor
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.signature:  HBondDonorCountDescriptor()
focal_class.class_method_signature: HBondDonorCountDescriptor.getSpecification()
focal_class.full_signature: @Override public DescriptorSpecification getSpecification()
focal_class.identifier: getSpecification
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: DescriptorSpecification
focal_class.signature: DescriptorSpecification getSpecification()
focal_class.class_method_signature: HBondDonorCountDescriptor.setParameters(Object[] params)
focal_class.full_signature: @Override public void setParameters(Object[] params)
focal_class.identifier: setParameters
focal_class.modifiers: @Override public
focal_class.parameters: (Object[] params)
focal_class.return: void
focal_class.signature: void setParameters(Object[] params)
focal_class.class_method_signature: HBondDonorCountDescriptor.getParameters()
focal_class.full_signature: @Override public Object[] getParameters()
focal_class.identifier: getParameters
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: Object[]
focal_class.signature: Object[] getParameters()
focal_class.class_method_signature: HBondDonorCountDescriptor.getDescriptorNames()
focal_class.full_signature: @Override public String[] getDescriptorNames()
focal_class.identifier: getDescriptorNames
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: String[]
focal_class.signature: String[] getDescriptorNames()
focal_class.class_method_signature: HBondDonorCountDescriptor.getDummyDescriptorValue(Exception e)
focal_class.full_signature: private DescriptorValue getDummyDescriptorValue(Exception e)
focal_class.identifier: getDummyDescriptorValue
focal_class.modifiers: private
focal_class.parameters: (Exception e)
focal_class.return: DescriptorValue
focal_class.signature: DescriptorValue getDummyDescriptorValue(Exception e)
focal_class.class_method_signature: HBondDonorCountDescriptor.calculate(IAtomContainer atomContainer)
focal_class.full_signature: @Override public DescriptorValue calculate(IAtomContainer atomContainer)
focal_class.identifier: calculate
focal_class.modifiers: @Override public
focal_class.parameters: (IAtomContainer atomContainer)
focal_class.return: DescriptorValue
focal_class.signature: DescriptorValue calculate(IAtomContainer atomContainer)
focal_class.class_method_signature: HBondDonorCountDescriptor.getDescriptorResultType()
focal_class.full_signature: @Override public IDescriptorResult getDescriptorResultType()
focal_class.identifier: getDescriptorResultType
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: IDescriptorResult
focal_class.signature: IDescriptorResult getDescriptorResultType()
focal_class.class_method_signature: HBondDonorCountDescriptor.getParameterNames()
focal_class.full_signature: @Override public String[] getParameterNames()
focal_class.identifier: getParameterNames
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: String[]
focal_class.signature: String[] getParameterNames()
focal_class.class_method_signature: HBondDonorCountDescriptor.getParameterType(String name)
focal_class.full_signature: @Override public Object getParameterType(String name)
focal_class.identifier: getParameterType
focal_class.modifiers: @Override public
focal_class.parameters: (String name)
focal_class.return: Object
focal_class.signature: Object getParameterType(String name)
focal_class.superclass: extends AbstractMolecularDescriptor
focal_method.body: @Override
      public DescriptorValue calculate(IAtomContainer atomContainer) {
          int hBondDonors = 0;
  
          IAtomContainer ac;
          try {
              ac = (IAtomContainer) atomContainer.clone();
          } catch (CloneNotSupportedException e) {
              return getDummyDescriptorValue(e);
          }
  
          //org.openscience.cdk.interfaces.IAtom[] atoms = ac.getAtoms();
          // iterate over all atoms of this AtomContainer; use label atomloop to allow for labelled continue
          atomloop: for (int atomIndex = 0; atomIndex < ac.getAtomCount(); atomIndex++) {
              IAtom atom = (IAtom) ac.getAtom(atomIndex);
              // checking for O and N atoms where the formal charge is >= 0
              if ((atom.getAtomicNumber() == IElement.O || atom.getAtomicNumber() == IElement.N) && atom.getFormalCharge() >= 0) {
                  // implicit hydrogens
                  Integer implicitH = atom.getImplicitHydrogenCount();
                  if (implicitH == CDKConstants.UNSET) implicitH = 0;
                  if (implicitH > 0) {
                      hBondDonors++;
                      continue atomloop; // we skip the explicit hydrogens part cause we found implicit hydrogens
                  }
                  // explicit hydrogens
                  java.util.List neighbours = ac.getConnectedAtomsList(atom);
                  for (Object neighbour : neighbours) {
                      if (((IAtom) neighbour).getAtomicNumber() == IElement.H) {
                          hBondDonors++;
                          continue atomloop;
                      }
                  }
              }
          }
  
          return new DescriptorValue(getSpecification(), getParameterNames(), getParameters(), new IntegerResult(
                  hBondDonors), getDescriptorNames());
      }
focal_method.class_method_signature: HBondDonorCountDescriptor.calculate(IAtomContainer atomContainer)
focal_method.full_signature: @Override public DescriptorValue calculate(IAtomContainer atomContainer)
focal_method.identifier: calculate
focal_method.invocations: clone getDummyDescriptorValue getAtomCount getAtom getAtomicNumber getAtomicNumber getFormalCharge getImplicitHydrogenCount getConnectedAtomsList getAtomicNumber getSpecification getParameterNames getParameters getDescriptorNames
focal_method.modifiers: @Override public
focal_method.parameters: (IAtomContainer atomContainer)
focal_method.return: DescriptorValue
focal_method.signature: DescriptorValue calculate(IAtomContainer atomContainer)