Clover icon

Coverage Report

  1. Project Clover database Tue Mar 10 2026 14:58:44 GMT
  2. Package jalview.ws2.helpers

File TaskEventSupport.java

 

Coverage histogram

../../../img/srcFileCovDistChart0.png
0% of files have more coverage

Code metrics

0
19
11
1
79
64
11
0.58
1.73
11
1

Classes

Class Line # Actions
TaskEventSupport 11 19 11
0.00%
 

Contributing tests

No tests hitting this source file were found.

Source view

1    package jalview.ws2.helpers;
2   
3    import java.util.List;
4    import java.util.concurrent.CopyOnWriteArrayList;
5   
6    import jalview.ws2.actions.api.JobI;
7    import jalview.ws2.actions.api.TaskEventListener;
8    import jalview.ws2.actions.api.TaskI;
9    import jalview.ws2.api.JobStatus;
10   
 
11    public class TaskEventSupport<T>
12    {
13    private TaskI<T> source;
14   
15    private List<TaskEventListener<T>> listeners = new CopyOnWriteArrayList<>();
16   
 
17  0 toggle public TaskEventSupport(TaskI<T> source)
18    {
19  0 this.source = source;
20    }
21   
 
22  0 toggle public TaskEventSupport(TaskI<T> source, TaskEventListener<T> handler)
23    {
24  0 this(source);
25  0 addListener(handler);
26    }
27   
 
28  0 toggle public void addListener(TaskEventListener<T> listener)
29    {
30  0 listeners.add(listener);
31    }
32   
 
33  0 toggle public void removeListener(TaskEventListener<T> listener)
34    {
35  0 listeners.remove(listener);
36    }
37   
 
38  0 toggle public void fireTaskStarted(List<? extends JobI> subJobs)
39    {
40  0 for (var listener : listeners)
41  0 listener.taskStarted(source, subJobs);
42    }
43   
 
44  0 toggle public void fireTaskStatusChanged(JobStatus status)
45    {
46  0 for (var listener : listeners)
47  0 listener.taskStatusChanged(source, status);
48    }
49   
 
50  0 toggle public void fireTaskCompleted(T result)
51    {
52  0 for (var listener : listeners)
53  0 listener.taskCompleted(source, result);
54    }
55   
 
56  0 toggle public void fireTaskException(Exception e)
57    {
58  0 for (var listener : listeners)
59  0 listener.taskException(source, e);
60    }
61   
 
62  0 toggle public void fireSubJobStatusChanged(JobI job, JobStatus status)
63    {
64  0 for (var listener : listeners)
65  0 listener.subJobStatusChanged(source, job, status);
66    }
67   
 
68  0 toggle public void fireSubJobLogChanged(JobI job, String log)
69    {
70  0 for (var listener : listeners)
71  0 listener.subJobLogChanged(source, job, log);
72    }
73   
 
74  0 toggle public void fireSubJobErrorLogChanged(JobI job, String log)
75    {
76  0 for (var listener : listeners)
77  0 listener.subJobErrorLogChanged(source, job, log);
78    }
79    }