<commit_before>/*
 * Copyright (c) 2012 Diamond Light Source Ltd.
 *
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 */
package org.eclipse.scanning.api.event.status;

/**
 * States of jobs on the cluster.
 * 
 * @author <NAME>
 *
 */
public enum Status { // TODO Should this be called QueueStatus or JobStatus to avoid confusion?

	SUBMITTED, QUEUED, RUNNING, REQUEST_PAUSE, PAUSED, REQUEST_RESUME, RESUMED, REQUEST_TERMINATE, TERMINATED, FAILED, COMPLETE, UNFINISHED, NONE;

	/**
	 * 
	 * @return true if the run was taken from the queue and something was actually executed on it.
	 */
	public boolean isStarted() {
		return this!=SUBMITTED;
	}
	
	public boolean isFinal() {
		return this==TERMINATED || this==FAILED || this==COMPLETE || this==UNFINISHED || this==NONE;
	}
	
	public boolean isRunning() {
		return this==RUNNING || this==RESUMED;
	}
	
	public boolean isRequest() {
		return toString().startsWith("REQUEST_");
	}

	public boolean isPaused() {
		return this==REQUEST_PAUSE || this==PAUSED;
	}

	/**
	 * Being actively run, including pause.<commit_msg>Adds isResumed boolean in the same fashion as pause & terminate.<commit_after>/*
 * Copyright (c) 2012 Diamond Light Source Ltd.
 *
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 */
package org.eclipse.scanning.api.event.status;

/**
 * States of jobs on the cluster.
 * 
 * @author <NAME>
 *
 */
public enum Status { // TODO Should this be called QueueStatus or JobStatus to avoid confusion?

	SUBMITTED, QUEUED, RUNNING, REQUEST_PAUSE, PAUSED, REQUEST_RESUME, RESUMED, REQUEST_TERMINATE, TERMINATED, FAILED, COMPLETE, UNFINISHED, NONE;

	/**
	 * 
	 * @return true if the run was taken from the queue and something was actually executed on it.
	 */
	public boolean isStarted() {
		return this!=SUBMITTED;
	}
	
	public boolean isFinal() {
		return this==TERMINATED || this==FAILED || this==COMPLETE || this==UNFINISHED || this==NONE;
	}
	
	public boolean isRunning() {
		return this==RUNNING || this==RESUMED;
	}
	
	public boolean isRequest() {
		return toString().startsWith("REQUEST_");
	}

	public boolean isPaused() {
		return this==REQUEST_PAUSE || this==PAUSED;
	}
	
	public boolean isResumed() {
		return this==REQUEST_RESUME || this==RESUMED;
	}

	/**
	 * Being actively run, including pause.
{'fraction_non_alphanumeric': 0.1121530382595649, 'fraction_numerical': 0.006001500375093774, 'mean_word_length': 4.08, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2500300', 'n_tokens_mistral': 880, 'n_tokens_neox': 811, 'n_words': 270}