JAL-3878 Remove unused JobStatus methods
[jalview.git] / src / jalview / ws2 / api / JobStatus.java
1 package jalview.ws2.api;
2
3 public enum JobStatus
4 {
5   /** Job has invalid inputs and cannot be started. */
6   INVALID,
7   /** Job is created and ready for submission. */
8   READY,
9   /** Job has been submitted and awaits processing. */
10   SUBMITTED,
11   /** Job has been queued for execution */
12   QUEUED,
13   /** Job is running */
14   RUNNING,
15   /** Job has completed successfully. */
16   COMPLETED,
17   /** Job has finished with errors. */
18   FAILED,
19   /** Job has been cancelled by the user. */
20   CANCELLED,
21   /** Job cannot be processed due to server error. */
22   SERVER_ERROR,
23   /** Job status cannot be determined. */
24   UNKNOWN;
25
26   /**
27    * Returns true if the status corresponds to the job completed due to normal
28    * termination, error or cancellation.
29    * 
30    * @return {@value true} if status corresponds to a finished job.
31    */
32   public boolean isDone()
33   {
34     switch (this)
35     {
36     case INVALID:
37     case COMPLETED:
38     case FAILED:
39     case CANCELLED:
40     case SERVER_ERROR:
41       return true;
42     case READY:
43     case SUBMITTED:
44     case QUEUED:
45     case RUNNING:
46     case UNKNOWN:
47       return false;
48     default:
49       throw new AssertionError("non-exhaustive switch statement");
50     }
51   }
52 }