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 com.google.common.base.Preconditions;
27 import org.openscience.cdk.interfaces.IAtom;
28 import org.openscience.cdk.interfaces.IChemObjectBuilder;
29 
30 /**
31  * This matches an atom using the atomic number.
32  *
33  * @cdk.module smarts
34  * @cdk.githash
35  * @cdk.keyword SMARTS
36  */
37 @Deprecated
38 public class AtomicNumberAtom extends SMARTSAtom {
39 
40     /**
41      * Creates a new instance.
42      *
43      * @param atomicNumber
44      */
AtomicNumberAtom(int atomicNumber, IChemObjectBuilder builder)45     public AtomicNumberAtom(int atomicNumber, IChemObjectBuilder builder) {
46         super(builder);
47         this.setAtomicNumber(atomicNumber);
48     }
49 
50     /*
51      * (non-Javadoc)
52      * @see
53      * org.openscience.cdk.isomorphism.matchers.smarts.SMARTSAtom#matches(org
54      * .openscience.cdk.interfaces.IAtom)
55      */
56     @Override
matches(IAtom atom)57     public boolean matches(IAtom atom) {
58         return Preconditions.checkNotNull(atom.getAtomicNumber(), "Atomic number is not set.").equals(
59                 this.getAtomicNumber());
60     }
61 }
62