3
* $Date: 2007-02-07 23:20:44 +0100 (Wed, 07 Feb 2007) $
6
* Copyright (C) 2004-2007 The Chemistry Development Kit (CDK) project
8
* Contact: cdk-devel@lists.sourceforge.net
10
* This program is free software; you can redistribute it and/or
11
* modify it under the terms of the GNU Lesser General Public License
12
* as published by the Free Software Foundation; either version 2.1
13
* of the License, or (at your option) any later version.
15
* This program is distributed in the hope that it will be useful,
16
* but WITHOUT ANY WARRANTY; without even the implied warranty of
17
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18
* GNU Lesser General Public License for more details.
20
* You should have received a copy of the GNU Lesser General Public License
21
* along with this program; if not, write to the Free Software
22
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
24
package org.openscience.cdk.qsar.descriptors.atomic;
26
import org.openscience.cdk.exception.CDKException;
27
import org.openscience.cdk.interfaces.IAtom;
28
import org.openscience.cdk.interfaces.IAtomContainer;
29
import org.openscience.cdk.qsar.DescriptorSpecification;
30
import org.openscience.cdk.qsar.DescriptorValue;
31
import org.openscience.cdk.qsar.IAtomicDescriptor;
32
import org.openscience.cdk.qsar.result.IntegerResult;
35
* This class returns the number of not-Hs substituents of an atom, also defined as "atom degree".
37
* <p>This descriptor uses these parameters:
42
* <td>Description</td>
47
* <td>no parameters</td>
52
* @cdk.created 2004-11-13
54
* @cdk.set qsar-descriptors
55
* @cdk.dictref qsar-descriptors:atomDegree
57
public class AtomDegreeDescriptor implements IAtomicDescriptor {
59
public DescriptorSpecification getSpecification() {
60
return new DescriptorSpecification(
61
"http://www.blueobelisk.org/ontologies/chemoinformatics-algorithms/#atomDegree",
62
this.getClass().getName(),
63
"$Id: AtomDegreeDescriptor.java 7895 2007-02-07 22:20:44Z egonw $",
64
"The Chemistry Development Kit");
68
* This descriptor does not have any parameter to be set.
70
public void setParameters(Object[] params) throws CDKException {
76
* Gets the parameters attribute of the AtomDegreeDescriptor object.
78
*@return The parameters value
81
public Object[] getParameters() {
87
* This method calculates the number of not-H substituents of an atom.
89
* @param atom The IAtom for which the DescriptorValue is requested
90
* @param container The {@link IAtomContainer} for which this descriptor is to be calculated for
91
* @return The number of bonds on the shortest path between two atoms
92
* @throws CDKException NOT CLEAR
94
public DescriptorValue calculate(IAtom atom, IAtomContainer container) throws CDKException {
96
java.util.List neighboors = container.getConnectedAtomsList(atom);
97
for (int i =0; i< neighboors.size();i++) {
98
if(!((IAtom)neighboors.get(i)).getSymbol().equals("H")) atomDegree+=1;
100
return new DescriptorValue(getSpecification(), getParameterNames(), getParameters(), new IntegerResult(atomDegree));
105
* Gets the parameterNames attribute of the AtomDegreeDescriptor object.
107
* @return The parameterNames value
109
public String[] getParameterNames() {
110
return new String[0];
115
* Gets the parameterType attribute of the AtomDegreeDescriptor object.
117
* @param name Description of the Parameter
118
* @return An Object of class equal to that of the parameter being requested
120
public Object getParameterType(String name) {