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 24 /** 25 * This matches an atom with chirality property. It is not implemented yet. 26 * It'll match any atom right now. 27 * 28 * @cdk.module smarts 29 * @cdk.githash 30 * @cdk.keyword SMARTS 31 */ 32 @Deprecated 33 public class ChiralityAtom extends SMARTSAtom { 34 35 /** 36 * The degree of the chirality 37 */ 38 private int degree; 39 40 /** 41 * Whether unspecified chirality should be taken into consideration 42 */ 43 private boolean unspecified; 44 45 /** 46 * Whether the chirality is clockwise 47 */ 48 private boolean clockwise; 49 getDegree()50 public int getDegree() { 51 return degree; 52 } 53 setDegree(int degree)54 public void setDegree(int degree) { 55 this.degree = degree; 56 } 57 isUnspecified()58 public boolean isUnspecified() { 59 return unspecified; 60 } 61 setUnspecified(boolean unspecified)62 public void setUnspecified(boolean unspecified) { 63 this.unspecified = unspecified; 64 } 65 isClockwise()66 public boolean isClockwise() { 67 return clockwise; 68 } 69 setClockwise(boolean clockwise)70 public void setClockwise(boolean clockwise) { 71 this.clockwise = clockwise; 72 } 73 74 /** 75 * Creates a new instance 76 * 77 */ ChiralityAtom(IChemObjectBuilder builder)78 public ChiralityAtom(IChemObjectBuilder builder) { 79 super(builder); 80 } 81 82 @Override matches(IAtom atom)83 public boolean matches(IAtom atom) { 84 // match testing is done after the match is complete 85 return true; 86 } 87 88 /**{@inheritDoc} */ 89 @Override chiralityMatches(IAtom target, int tParity, int permParity)90 public boolean chiralityMatches(IAtom target, int tParity, int permParity) { 91 int qParity = permParity * (clockwise ? 1 : -1); 92 return unspecified && tParity == 0 || qParity == tParity; 93 } 94 } 95