]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.utils.datastructures/src/org/simantics/utils/datastructures/disposable/IDisposable.java
Migrated source code from Simantics SVN
[simantics/platform.git] / bundles / org.simantics.utils.datastructures / src / org / simantics / utils / datastructures / disposable / IDisposable.java
1 /*******************************************************************************\r
2  * Copyright (c) 2007, 2010 Association for Decentralized Information Management\r
3  * in Industry THTH ry.\r
4  * All rights reserved. This program and the accompanying materials\r
5  * are made available under the terms of the Eclipse Public License v1.0\r
6  * which accompanies this distribution, and is available at\r
7  * http://www.eclipse.org/legal/epl-v10.html\r
8  *\r
9  * Contributors:\r
10  *     VTT Technical Research Centre of Finland - initial API and implementation\r
11  *******************************************************************************/\r
12 \r
13 package org.simantics.utils.datastructures.disposable;\r
14 \r
15 import org.simantics.utils.threads.IThreadWorkQueue;\r
16 \r
17 /**\r
18  * Interface for disposable objects.\r
19  * \r
20  * @see AbstractDisposable for implementation\r
21  * @author Toni Kalajainen\r
22  */\r
23 public interface IDisposable {\r
24     \r
25     /**\r
26      * Starts dispose procedures. The objects goes into Disposing state\r
27      * while dispose listeners are handled. \r
28      */\r
29     void dispose();\r
30     \r
31     /**\r
32      * Dispose if not diposed.\r
33      */\r
34     void safeDispose();\r
35     \r
36     /**\r
37      * Is the object disposed. The return value of this method goes into \r
38      * true status, once dispose() is invoked and all listeners have been\r
39      * processed. \r
40      *  \r
41      * @return <code>true</code> if this object has been disposed\r
42      */\r
43     boolean isDisposed();\r
44 \r
45     /**\r
46      * Get objects state in respect to its life cycle.\r
47      * \r
48      * @return current object state\r
49      */\r
50     DisposeState getDisposeState();\r
51     \r
52     void addDisposeListener(IDisposeListener listener);\r
53     void addDisposeListener(IDisposeListener listener, IThreadWorkQueue thread);\r
54     void removeDisposeListener(IDisposeListener listener);\r
55     void removeDisposeListener(IDisposeListener listener, IThreadWorkQueue thread);\r
56     \r
57     \r
58 \r
59 }\r