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.IAtomType;
28 import org.openscience.cdk.interfaces.IChemObjectBuilder;
29 
30 /**
31  * This matcher checks the hybridization state of an atom.
32  *
33  * @cdk.module smarts
34  * @cdk.githash
35  * @cdk.keyword SMARTS
36  */
37 
38 @Deprecated
39 public class HybridizationNumberAtom extends SMARTSAtom {
40 
41     /**
42      * Creates a new instance
43      *
44      * @param hybridizationNumber the hybridiation
45      */
HybridizationNumberAtom(int hybridizationNumber, IChemObjectBuilder builder)46     public HybridizationNumberAtom(int hybridizationNumber, IChemObjectBuilder builder) {
47         super(builder);
48         switch (hybridizationNumber) {
49             case 1:
50                 setHybridization(IAtomType.Hybridization.SP1);
51                 break;
52             case 2:
53                 setHybridization(IAtomType.Hybridization.SP2);
54                 break;
55             case 3:
56                 setHybridization(IAtomType.Hybridization.SP3);
57                 break;
58             case 4:
59                 setHybridization(IAtomType.Hybridization.SP3D1);
60                 break;
61             case 5:
62                 setHybridization(IAtomType.Hybridization.SP3D2);
63                 break;
64             case 6:
65                 setHybridization(IAtomType.Hybridization.SP3D3);
66                 break;
67             case 7:
68                 setHybridization(IAtomType.Hybridization.SP3D4);
69                 break;
70             case 8:
71                 setHybridization(IAtomType.Hybridization.SP3D5);
72                 break;
73         }
74     }
75 
76     /*
77      * (non-Javadoc)
78      * @see
79      * org.openscience.cdk.isomorphism.matchers.smarts.SMARTSAtom#matches(org
80      * .openscience.cdk.interfaces.IAtom)
81      */
82     @Override
matches(IAtom atom)83     public boolean matches(IAtom atom) {
84         return getHybridization() == atom.getHybridization();
85     }
86 
87     /*
88      * (non-Javadoc)
89      * @see org.openscience.cdk.PseudoAtom#toString()
90      */
91     @Override
toString()92     public String toString() {
93         return ("HybridizationNumberAtom(" + getHybridization() + ")");
94     }
95 
96 }
97