~ubuntu-branches/ubuntu/trusty/cdk/trusty-proposed

« back to all changes in this revision

Viewing changes to src/org/openscience/cdk/interfaces/IChemObject.java

  • Committer: Bazaar Package Importer
  • Author(s): Paul Cager
  • Date: 2008-04-09 21:17:53 UTC
  • Revision ID: james.westby@ubuntu.com-20080409211753-46lmjw5z8mx5pd8d
Tags: upstream-1.0.2
ImportĀ upstreamĀ versionĀ 1.0.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* $RCSfile$
 
2
 * $Author: egonw $
 
3
 * $Date: 2007-01-04 18:46:10 +0100 (Thu, 04 Jan 2007) $
 
4
 * $Revision: 7636 $
 
5
 *
 
6
 * Copyright (C) 2006-2007  Egon Willighagen <egonw@users.sf.net>
 
7
 *
 
8
 * Contact: cdk-devel@lists.sourceforge.net
 
9
 *
 
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.
 
14
 *
 
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.
 
19
 *
 
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.
 
23
 */
 
24
package org.openscience.cdk.interfaces;
 
25
 
 
26
import java.util.Hashtable;
 
27
 
 
28
/**
 
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
 
32
 *
 
33
 *@author        egonw
 
34
 *@cdk.module    interfaces
 
35
 */
 
36
public interface IChemObject extends Cloneable {
 
37
 
 
38
        /**
 
39
         * Use this to add yourself to this IChemObject as a listener. In order to do
 
40
         * so, you must implement the ChemObjectListener Interface.
 
41
         *
 
42
         * @param  col  the ChemObjectListener
 
43
         * @see         #removeListener
 
44
         */
 
45
        public void addListener(IChemObjectListener col);
 
46
 
 
47
        /**
 
48
         * Returns the number of ChemObjectListeners registered with this object.
 
49
         *
 
50
         * @return    the number of registered listeners.
 
51
         */
 
52
        public int getListenerCount();
 
53
 
 
54
        /**
 
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.
 
57
         *
 
58
         * @param  col  The ChemObjectListener to be removed
 
59
         * @see         #addListener
 
60
         */
 
61
        public void removeListener(IChemObjectListener col);
 
62
 
 
63
        /**
 
64
         * Set a flag to use or not use notification. By default it should be set
 
65
         * to true.
 
66
         * 
 
67
         * @param bool if true, then notification messages are sent.
 
68
         * @see        #getNotification()
 
69
         */
 
70
        public void setNotification(boolean bool);
 
71
 
 
72
        /**
 
73
         * Returns the flag that indicates wether notification messages are sent around.
 
74
         * 
 
75
         * @return true if messages are sent.
 
76
         * @see    #setNotification(boolean)
 
77
         */
 
78
        public boolean getNotification();
 
79
        
 
80
        /**
 
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.
 
83
         */
 
84
        public void notifyChanged();
 
85
 
 
86
        /**
 
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.
 
91
         *
 
92
         * @param  evt  A ChemObjectChangeEvent pointing to the source of where
 
93
         *                      the change happend
 
94
         */
 
95
        public void notifyChanged(IChemObjectChangeEvent evt);
 
96
 
 
97
        /**
 
98
         * Sets a property for a IChemObject.
 
99
         *
 
100
         * @param  description  An object description of the property (most likely a
 
101
         *                      unique string)
 
102
         * @param  property     An object with the property itself
 
103
         * @see                 #getProperty
 
104
         * @see                 #removeProperty
 
105
         */
 
106
        public void setProperty(Object description, Object property);
 
107
        
 
108
        /**
 
109
         * Removes a property for a IChemObject.
 
110
         *
 
111
         * @param  description  The object description of the property (most likely a
 
112
         *                      unique string)
 
113
         * @see                 #setProperty
 
114
         * @see                 #getProperty
 
115
         */
 
116
        public void removeProperty(Object description);
 
117
 
 
118
        /**
 
119
         * Returns a property for the IChemObject.
 
120
         *
 
121
         * @param  description  An object description of the property (most likely a
 
122
         *                      unique string)
 
123
         * @return              The object containing the property. Returns null if
 
124
         *                      propert is not set.
 
125
         * @see                 #setProperty
 
126
         * @see                 #removeProperty
 
127
         */
 
128
        public Object getProperty(Object description);
 
129
 
 
130
        /**
 
131
         *  Returns a Map with the IChemObject's properties.
 
132
         *
 
133
         *@return    The object's properties as an Hashtable
 
134
         *@see       #setProperties
 
135
         */
 
136
        public Hashtable getProperties();
 
137
 
 
138
        /**
 
139
         * Returns the identifier (ID) of this object.
 
140
         *
 
141
         * @return    a String representing the ID value
 
142
         * @see       #setID
 
143
         */
 
144
        public String getID();
 
145
 
 
146
        /**
 
147
         * Sets the identifier (ID) of this object.
 
148
         *
 
149
         * @param  identifier  a String representing the ID value
 
150
         * @see                #getID
 
151
         */
 
152
        public void setID(String identifier);
 
153
 
 
154
        /**
 
155
         * Sets the value of some flag.
 
156
         *
 
157
         * @param  flag_type   Flag to set
 
158
         * @param  flag_value  Value to assign to flag
 
159
         * @see                #getFlag
 
160
         */
 
161
        public void setFlag(int flag_type, boolean flag_value);
 
162
 
 
163
 
 
164
        /**
 
165
         * Returns the value of some flag.
 
166
         *
 
167
         * @param  flag_type  Flag to retrieve the value of
 
168
         * @return            true if the flag <code>flag_type</code> is set
 
169
         * @see               #setFlag
 
170
         */
 
171
        public boolean getFlag(int flag_type);
 
172
 
 
173
        /**
 
174
         * Sets the properties of this object.
 
175
         *
 
176
         * @param  properties  a Hashtable specifying the property values
 
177
         * @see                #getProperties
 
178
         */
 
179
        public void setProperties(Hashtable properties);
 
180
    
 
181
        /**
 
182
         * Sets the whole set of flags.
 
183
         *
 
184
         * @param  flagsNew    the new flags.
 
185
         * @see                #getFlags
 
186
         */
 
187
    public void setFlags(boolean[] flagsNew);
 
188
 
 
189
        /**
 
190
         * Returns the whole set of flags.
 
191
         *
 
192
         * @return    the flags.
 
193
         * @see       #setFlags
 
194
         */
 
195
    public boolean[] getFlags();
 
196
 
 
197
    /**
 
198
     * Returns a one line description of this IChemObject.
 
199
     *
 
200
     * @return a String representation of this object
 
201
     */
 
202
    public String toString();
 
203
    
 
204
    /**
 
205
     * Returns a deep clone of this IChemObject.
 
206
     *
 
207
     * @return Object the clone of this IChemObject.
 
208
     * @throws CloneNotSupportedException if the IChemObject cannot be cloned
 
209
     */
 
210
    public Object clone() throws CloneNotSupportedException;
 
211
    
 
212
    /**
 
213
     * Returns a ChemObjectBuilder for the data classes that extend
 
214
     * this class.
 
215
     * 
 
216
     * @return The IChemObjectBuilder matching this IChemObject
 
217
     */
 
218
    public IChemObjectBuilder getBuilder();
 
219
}
 
220
 
 
221