2 * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.1)
3 * Copyright (C) 2014 The Jalview Authors
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/>.
17 * The Jalview Authors are detailed in the 'AUTHORS' file.
21 import jalview.datamodel.AlignmentAnnotation;
23 import java.util.List;
25 public interface AlignCalcManagerI
29 * tell manager that a worker is initialised and has started to run
33 void notifyStart(AlignCalcWorkerI worker);
36 * check if a calculation of this type is already active
41 boolean alreadyDoing(AlignCalcWorkerI worker);
44 * tell manager that worker is now processing data
48 boolean notifyWorking(AlignCalcWorkerI worker);
51 * notify manager that the worker has completed, and results may be ready to
56 void workerComplete(AlignCalcWorkerI worker);
59 * indicate that a worker like this cannot run on the platform and shouldn't
64 void workerCannotRun(AlignCalcWorkerI worker);
67 * indicate that a worker like this may be run on the platform.
70 * of class to be removed from the execution blacklist
72 void workerMayRun(AlignCalcWorkerI worker);
79 void startWorker(AlignCalcWorkerI worker);
86 boolean isWorking(AlignCalcWorkerI worker);
89 * if any worker thread is operational, return true!
96 * register a restartable worker
100 void registerWorker(AlignCalcWorkerI worker);
103 * restart any registered workers
105 void restartWorkers();
109 * @param alignmentAnnotation
110 * @return true if a currently registered and working worker indicates its
111 * involvement with the given alignmentAnnotation
113 boolean workingInvolvedWith(AlignmentAnnotation alignmentAnnotation);
116 * kick any known instances of the given worker class to update their
121 void updateAnnotationFor(Class workerClass);
124 * return any registered workers of the given class
127 * @return null or one or more workers of the given class
129 List<AlignCalcWorkerI> getRegisteredWorkersOfClass(Class workerClass);
132 * start any workers of the given class
135 * @return false if no workers of given class were registered (note -
136 * blacklisted classes cannot be restarted, so this method will return
137 * true for blacklisted workers)
139 boolean startRegisteredWorkersOfClass(Class workerClass);
142 * work out if there is an instance of a worker that is *waiting* to start
145 * @param workingClass
146 * @return true if workingClass is already waiting to calculate. false if it
147 * is calculating, or not queued.
149 boolean isPending(AlignCalcWorkerI workingClass);
152 * deregister and otherwise remove any registered and working instances of the
155 * @param typeToRemove
157 void removeRegisteredWorkersOfClass(Class typeToRemove);