3
* $Date: 2007-01-04 18:46:10 +0100 (Thu, 04 Jan 2007) $
6
* Copyright (C) 2006-2007 Egon Willighagen <egonw@users.sf.net>
8
* Contact: cdk-devel@lists.sourceforge.net
10
* This program is free software; you can redistribute it and/or
11
* modify it under the terms of the GNU Lesser General Public License
12
* as published by the Free Software Foundation; either version 2.1
13
* of the License, or (at your option) any later version.
15
* This program is distributed in the hope that it will be useful,
16
* but WITHOUT ANY WARRANTY; without even the implied warranty of
17
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18
* GNU Lesser General Public License for more details.
20
* You should have received a copy of the GNU Lesser General Public License
21
* along with this program; if not, write to the Free Software
22
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
24
package org.openscience.cdk.interfaces;
26
import java.util.Hashtable;
29
* The base class for all chemical objects in this cdk. It provides methods for
30
* adding listeners and for their notification of events, as well a a hash
31
* table for administration of physical or chemical properties
34
*@cdk.module interfaces
36
public interface IChemObject extends Cloneable {
39
* Use this to add yourself to this IChemObject as a listener. In order to do
40
* so, you must implement the ChemObjectListener Interface.
42
* @param col the ChemObjectListener
43
* @see #removeListener
45
public void addListener(IChemObjectListener col);
48
* Returns the number of ChemObjectListeners registered with this object.
50
* @return the number of registered listeners.
52
public int getListenerCount();
55
* Use this to remove a ChemObjectListener from the ListenerList of this
56
* IChemObject. It will then not be notified of change in this object anymore.
58
* @param col The ChemObjectListener to be removed
61
public void removeListener(IChemObjectListener col);
64
* Set a flag to use or not use notification. By default it should be set
67
* @param bool if true, then notification messages are sent.
68
* @see #getNotification()
70
public void setNotification(boolean bool);
73
* Returns the flag that indicates wether notification messages are sent around.
75
* @return true if messages are sent.
76
* @see #setNotification(boolean)
78
public boolean getNotification();
81
* This should be triggered by an method that changes the content of an object
82
* to that the registered listeners can react to it.
84
public void notifyChanged();
87
* This should be triggered by an method that changes the content of an object
88
* to that the registered listeners can react to it. This is a version of
89
* notifyChanged() which allows to propagate a change event while preserving
90
* the original origin.
92
* @param evt A ChemObjectChangeEvent pointing to the source of where
95
public void notifyChanged(IChemObjectChangeEvent evt);
98
* Sets a property for a IChemObject.
100
* @param description An object description of the property (most likely a
102
* @param property An object with the property itself
104
* @see #removeProperty
106
public void setProperty(Object description, Object property);
109
* Removes a property for a IChemObject.
111
* @param description The object description of the property (most likely a
116
public void removeProperty(Object description);
119
* Returns a property for the IChemObject.
121
* @param description An object description of the property (most likely a
123
* @return The object containing the property. Returns null if
124
* propert is not set.
126
* @see #removeProperty
128
public Object getProperty(Object description);
131
* Returns a Map with the IChemObject's properties.
133
*@return The object's properties as an Hashtable
136
public Hashtable getProperties();
139
* Returns the identifier (ID) of this object.
141
* @return a String representing the ID value
144
public String getID();
147
* Sets the identifier (ID) of this object.
149
* @param identifier a String representing the ID value
152
public void setID(String identifier);
155
* Sets the value of some flag.
157
* @param flag_type Flag to set
158
* @param flag_value Value to assign to flag
161
public void setFlag(int flag_type, boolean flag_value);
165
* Returns the value of some flag.
167
* @param flag_type Flag to retrieve the value of
168
* @return true if the flag <code>flag_type</code> is set
171
public boolean getFlag(int flag_type);
174
* Sets the properties of this object.
176
* @param properties a Hashtable specifying the property values
177
* @see #getProperties
179
public void setProperties(Hashtable properties);
182
* Sets the whole set of flags.
184
* @param flagsNew the new flags.
187
public void setFlags(boolean[] flagsNew);
190
* Returns the whole set of flags.
195
public boolean[] getFlags();
198
* Returns a one line description of this IChemObject.
200
* @return a String representation of this object
202
public String toString();
205
* Returns a deep clone of this IChemObject.
207
* @return Object the clone of this IChemObject.
208
* @throws CloneNotSupportedException if the IChemObject cannot be cloned
210
public Object clone() throws CloneNotSupportedException;
213
* Returns a ChemObjectBuilder for the data classes that extend
216
* @return The IChemObjectBuilder matching this IChemObject
218
public IChemObjectBuilder getBuilder();