Class | Line # | Actions | |||
---|---|---|---|---|---|
AlignCalcManagerI | 27 | 0 | 0 |
1 | /* | |
2 | * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$) | |
3 | * Copyright (C) $$Year-Rel$$ The Jalview Authors | |
4 | * | |
5 | * This file is part of Jalview. | |
6 | * | |
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 | |
10 | * of the License, or (at your option) any later version. | |
11 | * | |
12 | * Jalview is distributed in the hope that it will be useful, but | |
13 | * WITHOUT ANY WARRANTY; without even the implied warranty | |
14 | * of MERCHANTABILITY or FITNESS FOR A PARTICULAR | |
15 | * PURPOSE. See the GNU General Public License for more details. | |
16 | * | |
17 | * You should have received a copy of the GNU General Public License | |
18 | * along with Jalview. If not, see <http://www.gnu.org/licenses/>. | |
19 | * The Jalview Authors are detailed in the 'AUTHORS' file. | |
20 | */ | |
21 | package jalview.api; | |
22 | ||
23 | import jalview.datamodel.AlignmentAnnotation; | |
24 | ||
25 | import java.util.List; | |
26 | ||
27 | public interface AlignCalcManagerI | |
28 | { | |
29 | ||
30 | /** | |
31 | * tell manager that a worker is initialised and has started to run | |
32 | * | |
33 | * @param worker | |
34 | */ | |
35 | void notifyStart(AlignCalcWorkerI worker); | |
36 | ||
37 | /** | |
38 | * tell manager that a thread running worker's run() loop is ready to start | |
39 | * processing data | |
40 | * | |
41 | * @param worker | |
42 | * @return true if worker should start processing, false if another thread is | |
43 | * in progress | |
44 | */ | |
45 | boolean notifyWorking(AlignCalcWorkerI worker); | |
46 | ||
47 | /** | |
48 | * notify manager that the worker has completed, and results may be ready to | |
49 | * collect | |
50 | * | |
51 | * @param worker | |
52 | */ | |
53 | void workerComplete(AlignCalcWorkerI worker); | |
54 | ||
55 | /** | |
56 | * indicate that a worker like this cannot run on the platform and shouldn't | |
57 | * be started again | |
58 | * | |
59 | * @param worker | |
60 | */ | |
61 | void disableWorker(AlignCalcWorkerI worker); | |
62 | ||
63 | /** | |
64 | * indicate that a worker like this may be run on the platform. | |
65 | * | |
66 | * @param worker | |
67 | * of class to be removed from the execution blacklist | |
68 | */ | |
69 | void enableWorker(AlignCalcWorkerI worker); | |
70 | ||
71 | /** | |
72 | * Answers true if the worker is disabled from running | |
73 | * | |
74 | * @param worker | |
75 | * @return | |
76 | */ | |
77 | boolean isDisabled(AlignCalcWorkerI worker); | |
78 | ||
79 | /** | |
80 | * launch a new worker | |
81 | * | |
82 | * @param worker | |
83 | */ | |
84 | void startWorker(AlignCalcWorkerI worker); | |
85 | ||
86 | /** | |
87 | * | |
88 | * @param worker | |
89 | * @return true if the worker is currently running | |
90 | */ | |
91 | boolean isWorking(AlignCalcWorkerI worker); | |
92 | ||
93 | /** | |
94 | * if any worker thread is operational, return true! | |
95 | * | |
96 | * @return | |
97 | */ | |
98 | boolean isWorking(); | |
99 | ||
100 | /** | |
101 | * register a restartable worker | |
102 | * | |
103 | * @param worker | |
104 | */ | |
105 | void registerWorker(AlignCalcWorkerI worker); | |
106 | ||
107 | /** | |
108 | * restart any registered workers | |
109 | */ | |
110 | void restartWorkers(); | |
111 | ||
112 | /** | |
113 | * | |
114 | * @param alignmentAnnotation | |
115 | * @return true if a currently registered and working worker indicates its | |
116 | * involvement with the given alignmentAnnotation | |
117 | */ | |
118 | boolean workingInvolvedWith(AlignmentAnnotation alignmentAnnotation); | |
119 | ||
120 | /** | |
121 | * kick any known instances of the given worker class to update their | |
122 | * annotation | |
123 | * | |
124 | * @param workerClass | |
125 | */ | |
126 | void updateAnnotationFor(Class<? extends AlignCalcWorkerI> workerClass); | |
127 | ||
128 | /** | |
129 | * return any registered workers of the given class | |
130 | * | |
131 | * @param workerClass | |
132 | * @return null or one or more workers of the given class | |
133 | */ | |
134 | List<AlignCalcWorkerI> getRegisteredWorkersOfClass( | |
135 | Class<? extends AlignCalcWorkerI> workerClass); | |
136 | ||
137 | /** | |
138 | * work out if there is an instance of a worker that is *waiting* to start | |
139 | * calculating | |
140 | * | |
141 | * @param workingClass | |
142 | * @return true if workingClass is already waiting to calculate. false if it | |
143 | * is calculating, or not queued. | |
144 | */ | |
145 | boolean isPending(AlignCalcWorkerI workingClass); | |
146 | ||
147 | /** | |
148 | * deregister and otherwise remove any registered and working instances of the | |
149 | * given worker type | |
150 | * | |
151 | * @param typeToRemove | |
152 | */ | |
153 | void removeRegisteredWorkersOfClass( | |
154 | Class<? extends AlignCalcWorkerI> typeToRemove); | |
155 | ||
156 | /** | |
157 | * Removes the worker that produces the given annotation, provided it is | |
158 | * marked as 'deletable'. Some workers may need to continue to run as the | |
159 | * results of their calculations are needed, e.g. for colour schemes. | |
160 | * | |
161 | * @param ann | |
162 | */ | |
163 | void removeWorkerForAnnotation(AlignmentAnnotation ann); | |
164 | } |