1 /* Copyright (C) 2005-2007  Egon Willighagen <egonw@users.sf.net>
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.debug;
20 
21 import java.util.Map;
22 
23 import org.openscience.cdk.AtomType;
24 import org.openscience.cdk.interfaces.IAtomType;
25 import org.openscience.cdk.interfaces.IBond;
26 import org.openscience.cdk.interfaces.IChemObjectChangeEvent;
27 import org.openscience.cdk.interfaces.IChemObjectListener;
28 import org.openscience.cdk.interfaces.IElement;
29 import org.openscience.cdk.interfaces.IChemObjectBuilder;
30 import org.openscience.cdk.tools.ILoggingTool;
31 import org.openscience.cdk.tools.LoggingToolFactory;
32 
33 /**
34  * Debugging data class.
35  *
36  * @author     egonw
37  * @cdk.module datadebug
38  * @cdk.githash
39  */
40 public class DebugAtomType extends AtomType implements IAtomType {
41 
42     private static final long serialVersionUID = 1427549696666679540L;
43 
44     ILoggingTool              logger           = LoggingToolFactory.createLoggingTool(DebugAtomType.class);
45 
DebugAtomType(String elementSymbol)46     public DebugAtomType(String elementSymbol) {
47         super(elementSymbol);
48         logger.debug("Instantiated a DebugAtomType: symbol= ", elementSymbol);
49     }
50 
DebugAtomType(String identifier, String elementSymbol)51     public DebugAtomType(String identifier, String elementSymbol) {
52         super(elementSymbol); // cannot use super(identifier, elementSymbol); that gives a NPE
53         logger.debug("Instantiated a DebugAtomType: identifier= " + identifier + " symbol= ", elementSymbol);
54         this.setSymbol(elementSymbol);
55         this.setAtomTypeName(identifier);
56     }
57 
DebugAtomType(IElement element)58     public DebugAtomType(IElement element) {
59         super(element);
60         logger.debug("Instantiated a DebugAtomType: element= ", element);
61     }
62 
63     /** {@inheritDoc} */
64     @Override
getAtomicNumber()65     public Integer getAtomicNumber() {
66         logger.debug("Getting atomic number: ", super.getAtomicNumber());
67         return super.getAtomicNumber();
68     }
69 
70     /** {@inheritDoc} */
71     @Override
setAtomicNumber(Integer atomicNumber)72     public void setAtomicNumber(Integer atomicNumber) {
73         logger.debug("Setting atomic number: ", atomicNumber);
74         super.setAtomicNumber(atomicNumber);
75     }
76 
77     /** {@inheritDoc} */
78     @Override
getSymbol()79     public String getSymbol() {
80         logger.debug("Getting symbol: ", super.getSymbol());
81         return super.getSymbol();
82     }
83 
84     /** {@inheritDoc} */
85     @Override
setSymbol(String symbol)86     public void setSymbol(String symbol) {
87         logger.debug("Setting symbol: ", symbol);
88         super.setSymbol(symbol);
89     }
90 
91     /** {@inheritDoc} */
92     @Override
addListener(IChemObjectListener col)93     public void addListener(IChemObjectListener col) {
94         logger.debug("Adding listener: ", col);
95         super.addListener(col);
96     }
97 
98     /** {@inheritDoc} */
99     @Override
getListenerCount()100     public int getListenerCount() {
101         logger.debug("Getting listener count: ", super.getListenerCount());
102         return super.getListenerCount();
103     }
104 
105     /** {@inheritDoc} */
106     @Override
removeListener(IChemObjectListener col)107     public void removeListener(IChemObjectListener col) {
108         logger.debug("Removing listener: ", col);
109         super.removeListener(col);
110     }
111 
112     /** {@inheritDoc} */
113     @Override
notifyChanged()114     public void notifyChanged() {
115         logger.debug("Notifying changed");
116         super.notifyChanged();
117     }
118 
119     /** {@inheritDoc} */
120     @Override
notifyChanged(IChemObjectChangeEvent evt)121     public void notifyChanged(IChemObjectChangeEvent evt) {
122         logger.debug("Notifying changed event: ", evt);
123         super.notifyChanged(evt);
124     }
125 
126     /** {@inheritDoc} */
127     @Override
setProperty(Object description, Object property)128     public void setProperty(Object description, Object property) {
129         logger.debug("Setting property: ", description + "=" + property);
130         super.setProperty(description, property);
131     }
132 
133     /** {@inheritDoc} */
134     @Override
removeProperty(Object description)135     public void removeProperty(Object description) {
136         logger.debug("Removing property: ", description);
137         super.removeProperty(description);
138     }
139 
140     /** {@inheritDoc} */
141     @Override
getProperty(Object description)142     public <T> T getProperty(Object description) {
143         logger.debug("Getting property: ", description + "=" + super.getProperty(description));
144         return super.getProperty(description);
145     }
146 
147     /** {@inheritDoc} */
148     @Override
getProperties()149     public Map<Object, Object> getProperties() {
150         logger.debug("Getting properties");
151         return super.getProperties();
152     }
153 
154     /** {@inheritDoc} */
155     @Override
getID()156     public String getID() {
157         logger.debug("Getting ID: ", super.getID());
158         return super.getID();
159     }
160 
161     /** {@inheritDoc} */
162     @Override
setID(String identifier)163     public void setID(String identifier) {
164         logger.debug("Setting ID: ", identifier);
165         super.setID(identifier);
166     }
167 
168     /** {@inheritDoc} */
169     @Override
setFlag(int flagType, boolean flagValue)170     public void setFlag(int flagType, boolean flagValue) {
171         logger.debug("Setting flag: ", flagType + "=" + flagValue);
172         super.setFlag(flagType, flagValue);
173     }
174 
175     /** {@inheritDoc} */
176     @Override
getFlag(int flagType)177     public boolean getFlag(int flagType) {
178         logger.debug("Setting flag: ", flagType + "=" + super.getFlag(flagType));
179         return super.getFlag(flagType);
180     }
181 
182     /** {@inheritDoc} */
183     @Override
addProperties(Map<Object, Object> properties)184     public void addProperties(Map<Object, Object> properties) {
185         logger.debug("Setting properties: ", properties);
186         super.addProperties(properties);
187     }
188 
189     /** {@inheritDoc} */
190     @Override
setFlags(boolean[] flagsNew)191     public void setFlags(boolean[] flagsNew) {
192         logger.debug("Setting flags:", flagsNew.length);
193         super.setFlags(flagsNew);
194     }
195 
196     /** {@inheritDoc} */
197     @Override
getFlags()198     public boolean[] getFlags() {
199         logger.debug("Getting flags:", super.getFlags().length);
200         return super.getFlags();
201     }
202 
203     /** {@inheritDoc} */
204     @Override
clone()205     public Object clone() throws CloneNotSupportedException {
206         Object clone = null;
207         try {
208             clone = super.clone();
209         } catch (Exception exception) {
210             logger.error("Could not clone DebugAtom: " + exception.getMessage(), exception);
211             logger.debug(exception);
212         }
213         return clone;
214     }
215 
216     /** {@inheritDoc} */
217     @Override
getBuilder()218     public IChemObjectBuilder getBuilder() {
219         return DebugChemObjectBuilder.getInstance();
220     }
221 
222     /** {@inheritDoc} */
223     @Override
setNaturalAbundance(Double naturalAbundance)224     public void setNaturalAbundance(Double naturalAbundance) {
225         logger.debug("Setting natural abundance: ", naturalAbundance);
226         super.setNaturalAbundance(naturalAbundance);
227     }
228 
229     /** {@inheritDoc} */
230     @Override
setExactMass(Double exactMass)231     public void setExactMass(Double exactMass) {
232         logger.debug("Setting exact mass: ", exactMass);
233         super.setExactMass(exactMass);
234 
235     }
236 
237     /** {@inheritDoc} */
238     @Override
getNaturalAbundance()239     public Double getNaturalAbundance() {
240         logger.debug("Getting natural abundance: ", super.getNaturalAbundance());
241         return super.getNaturalAbundance();
242     }
243 
244     /** {@inheritDoc} */
245     @Override
getExactMass()246     public Double getExactMass() {
247         logger.debug("Getting exact mass: ", super.getExactMass());
248         return super.getExactMass();
249     }
250 
251     /** {@inheritDoc} */
252     @Override
getMassNumber()253     public Integer getMassNumber() {
254         logger.debug("Getting mass number: ", super.getMassNumber());
255         return super.getMassNumber();
256     }
257 
258     /** {@inheritDoc} */
259     @Override
setMassNumber(Integer massNumber)260     public void setMassNumber(Integer massNumber) {
261         logger.debug("Setting mass number: ", massNumber);
262         super.setMassNumber(massNumber);
263     }
264 
265     /** {@inheritDoc} */
266     @Override
setAtomTypeName(String identifier)267     public void setAtomTypeName(String identifier) {
268         logger.debug("Setting atom type name: ", identifier);
269         super.setAtomTypeName(identifier);
270     }
271 
272     /** {@inheritDoc} */
273     @Override
setMaxBondOrder(IBond.Order maxBondOrder)274     public void setMaxBondOrder(IBond.Order maxBondOrder) {
275         logger.debug("Setting max bond order: ", maxBondOrder);
276         super.setMaxBondOrder(maxBondOrder);
277     }
278 
279     /** {@inheritDoc} */
280     @Override
setBondOrderSum(Double bondOrderSum)281     public void setBondOrderSum(Double bondOrderSum) {
282         logger.debug("Setting bond order sum: ", bondOrderSum);
283         super.setBondOrderSum(bondOrderSum);
284     }
285 
286     /** {@inheritDoc} */
287     @Override
getAtomTypeName()288     public String getAtomTypeName() {
289         logger.debug("Getting atom type name: ", super.getAtomTypeName());
290         return super.getAtomTypeName();
291     }
292 
293     /** {@inheritDoc} */
294     @Override
getMaxBondOrder()295     public IBond.Order getMaxBondOrder() {
296         logger.debug("Getting max bond order: ", super.getMaxBondOrder());
297         return super.getMaxBondOrder();
298     }
299 
300     /** {@inheritDoc} */
301     @Override
getBondOrderSum()302     public Double getBondOrderSum() {
303         logger.debug("Getting bond order sum: ", super.getBondOrderSum());
304         return super.getBondOrderSum();
305     }
306 
307     /** {@inheritDoc} */
308     @Override
setFormalCharge(Integer charge)309     public void setFormalCharge(Integer charge) {
310         logger.debug("Setting formal charge: ", charge);
311         super.setFormalCharge(charge);
312     }
313 
314     /** {@inheritDoc} */
315     @Override
getFormalCharge()316     public Integer getFormalCharge() {
317         logger.debug("Getting formal charge: ", super.getFormalCharge());
318         return super.getFormalCharge();
319     }
320 
321     /** {@inheritDoc} */
322     @Override
setFormalNeighbourCount(Integer count)323     public void setFormalNeighbourCount(Integer count) {
324         logger.debug("Setting forml neighbour count: ", count);
325         super.setFormalNeighbourCount(count);
326     }
327 
328     /** {@inheritDoc} */
329     @Override
getFormalNeighbourCount()330     public Integer getFormalNeighbourCount() {
331         logger.debug("Getting formal neighbour count: ", super.getFormalNeighbourCount());
332         return super.getFormalNeighbourCount();
333     }
334 
335     /** {@inheritDoc} */
336     @Override
setHybridization(IAtomType.Hybridization hybridization)337     public void setHybridization(IAtomType.Hybridization hybridization) {
338         logger.debug("Setting hybridization: ", hybridization);
339         super.setHybridization(hybridization);
340     }
341 
342     /** {@inheritDoc} */
343     @Override
getHybridization()344     public IAtomType.Hybridization getHybridization() {
345         logger.debug("Getting hybridization: ", super.getHybridization());
346         return super.getHybridization();
347     }
348 
349     /** {@inheritDoc} */
350     @Override
setCovalentRadius(Double radius)351     public void setCovalentRadius(Double radius) {
352         logger.debug("Setting covalent radius: ", radius);
353         super.setCovalentRadius(radius);
354     }
355 
356     /** {@inheritDoc} */
357     @Override
getCovalentRadius()358     public Double getCovalentRadius() {
359         logger.debug("Getting covalent radius: ", super.getCovalentRadius());
360         return super.getCovalentRadius();
361     }
362 
363     /** {@inheritDoc} */
364     @Override
setValency(Integer valency)365     public void setValency(Integer valency) {
366         logger.debug("Setting valency: ", valency);
367         super.setValency(valency);
368     }
369 
370     /** {@inheritDoc} */
371     @Override
getValency()372     public Integer getValency() {
373         logger.debug("Getting valency: ", super.getValency());
374         return super.getValency();
375     }
376 
377 }
378