test_class.declarator: sp
test_class.modifier: private
test_class.original_string: private SmilesParser sp;
test_class.type: SmilesParser
test_class.var_name: sp
test_class.file: descriptor/qsarmolecular/src/test/java/org/openscience/cdk/qsar/descriptors/molecular/TPSADescriptorTest.java
test_class.identifier: TPSADescriptorTest
test_class.superclass: extends MolecularDescriptorTest
test_case.body: @Test
      public void testTPSA4() throws Exception {
          IAtomContainer mol = sp.parseSmiles("C#N=CC(CNC)N1CC1");
          addExplicitHydrogens(mol);
          Assert.assertEquals(28.632, ((DoubleResult) descriptor.calculate(mol).getValue()).doubleValue(), 0.01);
      }
test_case.class_method_signature: TPSADescriptorTest.testTPSA4()
test_case.full_signature: @Test public void testTPSA4()
test_case.identifier: testTPSA4
test_case.invocations: parseSmiles addExplicitHydrogens assertEquals doubleValue getValue calculate
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testTPSA4()
focal_class.declarator: checkAromaticity = false
focal_class.modifier: private
focal_class.original_string: private boolean               checkAromaticity = false;
focal_class.type: boolean
focal_class.var_name: checkAromaticity
focal_class.declarator: map
focal_class.modifier: private static
focal_class.original_string: private static HashMap<String,Double>        map;
focal_class.type: HashMap<String,Double>
focal_class.var_name: map
focal_class.declarator: NAMES            = {"TopoPSA"}
focal_class.modifier: private static final
focal_class.original_string: private static final String[] NAMES            = {"TopoPSA"};
focal_class.type: String[]
focal_class.var_name: NAMES
focal_class.file: descriptor/qsarmolecular/src/main/java/org/openscience/cdk/qsar/descriptors/molecular/TPSADescriptor.java
focal_class.identifier: TPSADescriptor
focal_class.interfaces: implements IMolecularDescriptor
focal_class.class_method_signature: TPSADescriptor.TPSADescriptor()
focal_class.full_signature: public  TPSADescriptor()
focal_class.identifier: TPSADescriptor
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.signature:  TPSADescriptor()
focal_class.class_method_signature: TPSADescriptor.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: TPSADescriptor.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: TPSADescriptor.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: TPSADescriptor.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: TPSADescriptor.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: TPSADescriptor.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: TPSADescriptor.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: TPSADescriptor.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: TPSADescriptor.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) {
          IAtomContainer ac;
          try {
              ac = (IAtomContainer) atomContainer.clone();
          } catch (CloneNotSupportedException e) {
              return getDummyDescriptorValue(e);
          }
          List<String> profiles = new ArrayList<String>();
  
          // calculate the set of all rings
          IRingSet rs;
          try {
              rs = (new AllRingsFinder()).findAllRings(ac);
          } catch (CDKException e) {
              return getDummyDescriptorValue(e);
          }
          // check aromaticity if the descriptor parameter is set to true
          if (checkAromaticity) {
              try {
                  AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(ac);
                  Aromaticity.cdkLegacy().apply(ac);
              } catch (CDKException e) {
                  return getDummyDescriptorValue(e);
              }
          }
  
          // iterate over all atoms of ac
          for (IAtom atom : ac.atoms()) {
              if (atom.getAtomicNumber() == IElement.N || atom.getAtomicNumber() == IElement.O || atom.getAtomicNumber() == IElement.S
                      || atom.getAtomicNumber() == IElement.P) {
                  int singleBondCount = 0;
                  int doubleBondCount = 0;
                  int tripleBondCount = 0;
                  int aromaticBondCount = 0;
                  double maxBondOrder = 0;
                  double bondOrderSum = 0;
                  int hCount = 0;
                  int isIn3MemberRing = 0;
  
                  // counting the number of single/double/triple/aromatic bonds
                  List<IBond> connectedBonds = ac.getConnectedBondsList(atom);
                  for (IBond connectedBond : connectedBonds) {
                      if (connectedBond.getFlag(CDKConstants.ISAROMATIC))
                          aromaticBondCount++;
                      else if (connectedBond.getOrder() == Order.SINGLE)
                          singleBondCount++;
                      else if (connectedBond.getOrder() == Order.DOUBLE)
                          doubleBondCount++;
                      else if (connectedBond.getOrder() == Order.TRIPLE) tripleBondCount++;
                  }
                  int formalCharge = atom.getFormalCharge();
                  List<IAtom> connectedAtoms = ac.getConnectedAtomsList(atom);
                  int numberOfNeighbours = connectedAtoms.size();
  
                  // EXPLICIT hydrogens: count the number of hydrogen atoms
                  for (int neighbourIndex = 0; neighbourIndex < numberOfNeighbours; neighbourIndex++)
                      if (((IAtom) connectedAtoms.get(neighbourIndex)).getAtomicNumber() == IElement.H) hCount++;
                  // IMPLICIT hydrogens: count the number of hydrogen atoms and adjust other atom profile properties
                  Integer implicitHAtoms = atom.getImplicitHydrogenCount();
                  if (implicitHAtoms == CDKConstants.UNSET) {
                      implicitHAtoms = 0;
                  }
  
                  for (int hydrogenIndex = 0; hydrogenIndex < implicitHAtoms; hydrogenIndex++) {
                      hCount++;
                      numberOfNeighbours++;
                      singleBondCount++;
                  }
                  // Calculate bond order sum using the counters of single/double/triple/aromatic bonds
                  bondOrderSum += singleBondCount * 1.0;
                  bondOrderSum += doubleBondCount * 2.0;
                  bondOrderSum += tripleBondCount * 3.0;
                  bondOrderSum += aromaticBondCount * 1.5;
                  // setting maxBondOrder
                  if (singleBondCount > 0) maxBondOrder = 1.0;
                  if (aromaticBondCount > 0) maxBondOrder = 1.5;
                  if (doubleBondCount > 0) maxBondOrder = 2.0;
                  if (tripleBondCount > 0) maxBondOrder = 3.0;
  
                  // isIn3MemberRing checker
                  if (rs.contains(atom)) {
                      IRingSet rsAtom = rs.getRings(atom);
                      for (int ringSetIndex = 0; ringSetIndex < rsAtom.getAtomContainerCount(); ringSetIndex++) {
                          IRing ring = (IRing) rsAtom.getAtomContainer(ringSetIndex);
                          if (ring.getRingSize() == 3) isIn3MemberRing = 1;
                      }
                  }
                  // create a profile of the current atom (atoms[atomIndex]) according to the profile definition in the constructor
                  String profile = atom.getSymbol() + "+" + maxBondOrder + "+" + bondOrderSum + "+" + numberOfNeighbours
                          + "+" + hCount + "+" + formalCharge + "+" + aromaticBondCount + "+" + isIn3MemberRing + "+"
                          + singleBondCount + "+" + doubleBondCount + "+" + tripleBondCount;
                  //logger.debug("tpsa profile: "+ profile);
                  profiles.add(profile);
              }
          }
          // END OF ATOM LOOP
          // calculate the tpsa for the AtomContainer ac
          double tpsa = 0;
          for (int profileIndex = 0; profileIndex < profiles.size(); profileIndex++) {
              if (map.containsKey(profiles.get(profileIndex))) {
                  tpsa += (Double) map.get(profiles.get(profileIndex));
                  //logger.debug("tpsa contribs: " + profiles.elementAt(profileIndex) + "\t" + ((Double)map.get(profiles.elementAt(profileIndex))).doubleValue());
              }
          }
          profiles.clear(); // remove all profiles from the profiles-Vector
          //logger.debug("tpsa: " + tpsa);
  
          return new DescriptorValue(getSpecification(), getParameterNames(), getParameters(), new DoubleResult(tpsa),
                  getDescriptorNames());
  
      }
focal_method.class_method_signature: TPSADescriptor.calculate(IAtomContainer atomContainer)
focal_method.full_signature: @Override public DescriptorValue calculate(IAtomContainer atomContainer)
focal_method.identifier: calculate
focal_method.invocations: clone getDummyDescriptorValue findAllRings getDummyDescriptorValue percieveAtomTypesAndConfigureAtoms apply cdkLegacy getDummyDescriptorValue atoms getAtomicNumber getAtomicNumber getAtomicNumber getAtomicNumber getConnectedBondsList getFlag getOrder getOrder getOrder getFormalCharge getConnectedAtomsList size getAtomicNumber get getImplicitHydrogenCount contains getRings getAtomContainerCount getAtomContainer getRingSize getSymbol add size containsKey get get get clear 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)