--- /dev/null
+package jalview.ws2;
+
+public enum WSJobStatus
+{
+ /** Job has invalid parameters and cannot be started. */
+ INVALID,
+ /** Job is ready to be submitted. */
+ READY,
+ /** Job has been submitted and awaits processing. */
+ SUBMITTED,
+ /** Job has been queued for execution. */
+ QUEUED,
+ /** Job is running. */
+ RUNNING,
+ /** Job has finished with no errors. */
+ FINISHED, BROKEN,
+ /** Job has finished with errors. */
+ FAILED,
+ /** Job cannot be processed or completed due to server error. */
+ SERVER_ERROR,
+ /** Job has been cancelled. */
+ CANCELLED,
+ /** Status cannot be determined. */
+ UNKNOWN;
+
+ public boolean isSubmitted()
+ {
+ switch (this)
+ {
+ case SUBMITTED:
+ case QUEUED:
+ case RUNNING:
+ case FINISHED:
+ case BROKEN:
+ case FAILED:
+ case CANCELLED:
+ return true;
+ case SERVER_ERROR:
+ case INVALID:
+ case READY:
+ default:
+ return false;
+ }
+ }
+
+ public boolean isCancelled()
+ {
+ return this == WSJobStatus.CANCELLED;
+ }
+
+ public boolean isDone()
+ {
+ switch (this)
+ {
+ case FINISHED:
+ case BROKEN:
+ case FAILED:
+ case SERVER_ERROR:
+ case CANCELLED:
+ return true;
+ case INVALID:
+ case READY:
+ case SUBMITTED:
+ case QUEUED:
+ case RUNNING:
+ default:
+ return false;
+ }
+ }
+
+ public boolean isFailed()
+ {
+ switch (this)
+ {
+ case INVALID:
+ case BROKEN:
+ case FAILED:
+ case SERVER_ERROR:
+ return true;
+ case READY:
+ case SUBMITTED:
+ case QUEUED:
+ case RUNNING:
+ case FINISHED:
+ case CANCELLED:
+ default:
+ return false;
+ }
+ }
+
+ public boolean isRunning()
+ {
+ return this == WSJobStatus.RUNNING;
+ }
+
+ public boolean isQueuing()
+ {
+ return this == WSJobStatus.SUBMITTED || this == WSJobStatus.QUEUED;
+ }
+
+ public boolean isCompleted()
+ {
+ return this == WSJobStatus.FINISHED;
+ }
+}
\ No newline at end of file