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