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 29 /** 30 * This matcher checks the number of ring connections of the checked Atom with 31 * other Atom's. This cannot be matched without prepossessing Atom - {@link 32 * SMARTSAtomInvariants}. The ring connectivity is encoded in smarts using 33 * {@code x<NUMBER>}. 34 * 35 * @cdk.module smarts 36 * @cdk.githash 37 * @cdk.keyword SMARTS 38 */ 39 @Deprecated 40 public final class TotalRingConnectionAtom extends SMARTSAtom { 41 42 /** Number of rings. */ 43 private final int ringConnectivity; 44 45 /** 46 * Create a matcher for the number of rings an atom belongs to. 47 * 48 * @param ringConnectivity number of ring bonds this atom is adjacent to 49 */ TotalRingConnectionAtom(int ringConnectivity, IChemObjectBuilder builder)50 public TotalRingConnectionAtom(int ringConnectivity, IChemObjectBuilder builder) { 51 super(builder); 52 this.ringConnectivity = ringConnectivity; 53 } 54 55 /**{@inheritDoc} */ 56 @Override matches(IAtom atom)57 public boolean matches(IAtom atom) { 58 return invariants(atom).ringConnectivity() == ringConnectivity; 59 } 60 } 61