1 /* Copyright (C) 2004-2007  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  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18  */
19 package org.openscience.cdk.isomorphism.matchers.smarts;
20 
21 import org.openscience.cdk.interfaces.IAtom;
22 import org.openscience.cdk.interfaces.IChemObjectBuilder;
23 import org.openscience.cdk.isomorphism.matchers.IQueryAtom;
24 import org.openscience.cdk.isomorphism.matchers.QueryAtom;
25 
26 /**
27  * Abstract smarts atom.
28  *
29  * @cdk.module smarts
30  * @cdk.githash
31  * @cdk.keyword SMARTS
32  */
33 @Deprecated
34 public abstract class SMARTSAtom extends QueryAtom implements IQueryAtom {
35 
SMARTSAtom(IChemObjectBuilder builder)36     public SMARTSAtom(IChemObjectBuilder builder) {
37         super(builder);
38     }
39 
40     /**
41      * Access the atom invariants for this atom. If the invariants have not been
42      * set an exception is thrown.
43      *
44      * @param atom the atom to obtain the invariants of
45      * @return the atom invariants for the atom
46      * @throws NullPointerException thrown if the invariants were not set
47      */
invariants(final IAtom atom)48     final SMARTSAtomInvariants invariants(final IAtom atom) {
49         final SMARTSAtomInvariants inv = atom.getProperty(SMARTSAtomInvariants.KEY);
50         if (inv == null)
51             throw new NullPointerException(
52                     "Missing SMARTSAtomInvariants - please compute these values before matching.");
53         return inv;
54     }
55 
56     @Override
matches(IAtom atom)57     public boolean matches(IAtom atom) {
58         return false;
59     }
60 
61     /**
62      * Check if the atom-based chirality of the target matches. This check is
63      * done post-matching and should only be checked on atoms which are know to
64      * have already been matched ({@link #matches(IAtom)}.
65      *
66      * Currently the only atom-based chirality allowed is tetrahedral stereo-
67      * chemistry. The
68      *
69      * @param target     the matched target (required to verify 'OR'
70      *                   conditions)
71      * @param tParity    the parity (winding) of the target centre,
72      *                   0=unspecified, 1=clockwise and -1=anticlockwise
73      * @param permParity permutation parity of the query neighbors (will be
74      *                   multiplied by the query parity)
75      */
chiralityMatches(IAtom target, int tParity, int permParity)76     public boolean chiralityMatches(IAtom target, int tParity, int permParity) {
77         return true; // no specification => chirality matches
78     }
79 }
80