1
/* $Revision: $ $Author: $ $Date: $
3
* Copyright (C) 2004-2007 The Chemistry Development Kit (CDK) project
5
* This library is free software; you can redistribute it and/or
6
* modify it under the terms of the GNU Lesser General Public
7
* License as published by the Free Software Foundation; either
8
* version 2.1 of the License, or (at your option) any later version.
10
* This library 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 GNU
13
* Lesser General Public License for more details.
15
* You should have received a copy of the GNU Lesser General Public
16
* License along with this library; if not, write to the Free Software
17
* Foundation, 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18
* (or see http://www.gnu.org/copyleft/lesser.html)
20
package org.openscience.cdk.isomorphism.matchers.smarts;
22
import org.openscience.cdk.CDKConstants;
23
import org.openscience.cdk.interfaces.IAtom;
24
import org.openscience.cdk.interfaces.IRingSet;
27
* This query atom matches any atom with a certain number of SSSR.
30
* @cdk.created 2007-04-24
32
* @cdk.keyword SMARTS AST
34
public class RingMembershipAtom extends SMARTSAtom {
35
private static final long serialVersionUID = -7963168231557641862L;
41
public RingMembershipAtom(int num) {
45
public boolean matches(IAtom atom) {
46
if (atom.getFlag(CDKConstants.ISINRING)) {
47
IRingSet ringSet = (IRingSet)atom.getProperty(CDKConstants.SMALLEST_RINGS);
48
return ringSet.getAtomContainerCount() == numSSSR;