1 /* Copyright (C) 2002-2006  The Chemistry Development Kit (CDK) project
2  *
3  *  Contact: cdk-devel@lists.sourceforge.net
4  *
5  *  This program is free software; you can redistribute it and/or
6  *  modify it under the terms of the GNU Lesser General Public License
7  *  as published by the Free Software Foundation; either version 2.1
8  *  of the License, or (at your option) any later version.
9  *  All I ask is that proper credit is given for my work, which includes
10  *  - but is not limited to - adding the above copyright notice to the beginning
11  *  of your source code files, and to any copyright notice that you may distribute
12  *  with programs based on this work.
13  *
14  *  This program is distributed in the hope that it will be useful,
15  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17  *  GNU Lesser General Public License for more details.
18  *
19  *  You should have received a copy of the GNU Lesser General Public License
20  *  along with this program; if not, write to the Free Software
21  *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
22  *
23  */
24 package org.openscience.cdk.isomorphism.matchers.smarts;
25 
26 import org.openscience.cdk.interfaces.IAtom;
27 import org.openscience.cdk.interfaces.IChemObjectBuilder;
28 import org.openscience.cdk.tools.periodictable.PeriodicTable;
29 
30 /**
31  * This matcher checks the periodic group number of an atom.
32  *
33  * @cdk.module  smarts
34  * @cdk.githash
35  * @cdk.keyword SMARTS
36  */
37 
38 @Deprecated
39 public class PeriodicGroupNumberAtom extends SMARTSAtom {
40 
41     int groupNumber;
42 
43     /**
44      * Creates a new instance
45      *
46      * @param groupNumber the periodic group number
47      */
PeriodicGroupNumberAtom(int groupNumber, IChemObjectBuilder builder)48     public PeriodicGroupNumberAtom(int groupNumber, IChemObjectBuilder builder) {
49         super(builder);
50         this.groupNumber = groupNumber;
51     }
52 
53     /*
54      * (non-Javadoc)
55      * @see
56      * org.openscience.cdk.isomorphism.matchers.smarts.SMARTSAtom#matches(org
57      * .openscience.cdk.interfaces.IAtom)
58      */
59     @Override
matches(IAtom atom)60     public boolean matches(IAtom atom) {
61         String symbol = atom.getSymbol();
62         int group = PeriodicTable.getGroup(symbol);
63         return group == this.groupNumber;
64     }
65 
66     /*
67      * (non-Javadoc)
68      * @see org.openscience.cdk.PseudoAtom#toString()
69      */
70     @Override
toString()71     public String toString() {
72         return ("PeriodicGroupNumberAtom(" + this.groupNumber + ")");
73     }
74 
75 }
76