2 * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
3 * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
5 * This file is part of Jalview.
7 * Jalview is free software: you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
11 * Jalview is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty
13 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
14 * PURPOSE. See the GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
20 import jalview.datamodel.AlignmentAnnotation;
22 import java.util.List;
24 public interface AlignCalcManagerI
28 * tell manager that a worker is initialised and has started to run
32 void notifyStart(AlignCalcWorkerI worker);
35 * check if a calculation of this type is already active
40 boolean alreadyDoing(AlignCalcWorkerI worker);
43 * tell manager that worker is now processing data
47 boolean notifyWorking(AlignCalcWorkerI worker);
50 * notify manager that the worker has completed, and results may be ready to
55 void workerComplete(AlignCalcWorkerI worker);
58 * indicate that a worker like this cannot run on the platform and shouldn't
63 void workerCannotRun(AlignCalcWorkerI worker);
66 * indicate that a worker like this may be run on the platform.
69 * of class to be removed from the execution blacklist
71 void workerMayRun(AlignCalcWorkerI worker);
78 void startWorker(AlignCalcWorkerI worker);
85 boolean isWorking(AlignCalcWorkerI worker);
88 * if any worker thread is operational, return true!
95 * register a restartable worker
99 void registerWorker(AlignCalcWorkerI worker);
102 * restart any registered workers
104 void restartWorkers();
108 * @param alignmentAnnotation
109 * @return true if a currently registered and working worker indicates its
110 * involvement with the given alignmentAnnotation
112 boolean workingInvolvedWith(AlignmentAnnotation alignmentAnnotation);
115 * kick any known instances of the given worker class to update their
120 void updateAnnotationFor(Class workerClass);
123 * return any registered workers of the given class
126 * @return null or one or more workers of the given class
128 List<AlignCalcWorkerI> getRegisteredWorkersOfClass(Class workerClass);
131 * start any workers of the given class
134 * @return false if no workers of given class were registered (note -
135 * blacklisted classes cannot be restarted, so this method will return
136 * true for blacklisted workers)
138 boolean startRegisteredWorkersOfClass(Class workerClass);
141 * work out if there is an instance of a worker that is *waiting* to start
144 * @param workingClass
145 * @return true if workingClass is already waiting to calculate. false if it
146 * is calculating, or not queued.
148 boolean isPending(AlignCalcWorkerI workingClass);
151 * deregister and otherwise remove any registered and working instances of the
154 * @param typeToRemove
156 void removeRegisteredWorkersOfClass(Class typeToRemove);