| 1 | package org.jtoolkit.essence.concurrency; |
| 2 | |
| 3 | import org.jetbrains.annotations.NotNull; |
| 4 | |
| 5 | /* |
| 6 | Copyright 2006 Peter Lawrey |
| 7 | |
| 8 | Licensed under the Apache License, Version 2.0 (the "License"); |
| 9 | you may not use this file except in compliance with the License. |
| 10 | You may obtain a copy of the License at |
| 11 | |
| 12 | http://www.apache.org/licenses/LICENSE-2.0 |
| 13 | |
| 14 | Unless required by applicable law or agreed to in writing, software |
| 15 | distributed under the License is distributed on an "AS IS" BASIS, |
| 16 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 17 | See the License for the specific language governing permissions and |
| 18 | limitations under the License. |
| 19 | */ |
| 20 | |
| 21 | /** |
| 22 | * Represents a Callback which is a set of callbacks. |
| 23 | * |
| 24 | * @see Callback |
| 25 | * @see CallbackEx |
| 26 | * @author Peter Lawrey |
| 27 | */ |
| 28 | public interface CallbackSet<T> extends CallbackEx<T> { |
| 29 | public void addCallback(@NotNull Callback<T> callback); |
| 30 | |
| 31 | public void removeCallback(@NotNull Callback<T> callback); |
| 32 | |
| 33 | public boolean isEmpty(); |
| 34 | |
| 35 | /** |
| 36 | * The mode for Callbacks in the setCopy. |
| 37 | */ |
| 38 | enum CallbackMode { |
| 39 | /** |
| 40 | * Call back is on the same thread. |
| 41 | */ |
| 42 | THREADED, |
| 43 | /** |
| 44 | * Call back is called by the thread which triggered the call back. |
| 45 | */ |
| 46 | SIMPLE |
| 47 | } |
| 48 | } |