// Path: thread/utilClasses/Process.java
// public class Process {
// 	public String jobName;
// 	public int arrivalTime;
// 	public int cpuTime;
// 	public int priority;
// 	public char symbol;
// 	
// 	public Process(){
// 		this.jobName = "";
// 		this.arrivalTime = 0;
// 		this.cpuTime = 0;
// 		this.priority = 1;
// 		this.symbol = '0';
// 	}
// 	
// 	public Process(String jobName, int arrivalTime, int cpuTime, char symbol){
// 		this.jobName = jobName;
// 		this.arrivalTime = arrivalTime;
// 		this.cpuTime = cpuTime;
// 		this.priority = 1;
// 		this.symbol = symbol;
// 	}
// 	
// 	public Process(String jobName, int arrivalTime, int cpuTime, int priority, char symbol){
// 		this.jobName = jobName;
// 		this.arrivalTime = arrivalTime;
// 		this.cpuTime = cpuTime;
// 		this.priority = priority;
// 		this.symbol = symbol;
// 	}
// 	
// }
// 
// Path: thread/utilClasses/Result.java
// public class Result {
// 	public String jobName;
// 	public char symbol;
// 	public float waitingTime;
// 	
// 	public Result() {
// 		this.jobName = "EMPTY";
// 		this.symbol = ' ';
// 		waitingTime = -1;
// 	}
// 	
// 	public Result(String jobName, char symbol){
// 		this.jobName = jobName;
// 		this.symbol = symbol;
// 		waitingTime = -1;
// 	}
// 	
// 	public Result(String jobName, char symbol, float waitingTime){
// 		this.jobName = jobName;
// 		this.symbol = symbol;
// 		this.waitingTime = waitingTime;
// 	}
// }


import java.util.Queue;
import thread.utilClasses.Process;
import thread.utilClasses.Result;
import java.util.LinkedList;

				}else{
					result.add(new Result(waitingQueue.element().jobName, waitingQueue.element().symbol));
				}
				
			}else{							//idle time, no process is waiting
				result.add(new Result());
			}
			
			time += CPU_CYCLE_TIME;
		}
		
		
		return result;
	}
	
	private void order(Queue<Process> waitingQueue){
		int waitingQueueLength = waitingQueue.size();
		Process[] processes = new Process[waitingQueueLength];
		
		for(int i=0; i<waitingQueueLength; i++){
			processes[i] = waitingQueue.poll();
		}
		
		//bubble sort
		Process tempProcess;
		for(int i=1, j; i<waitingQueueLength-1; i++){
			for(j=i+1; j<waitingQueueLength; j++){
				if(processes[i].priority < processes[j].priority){
					tempProcess = processes[i];
					processes[i] = processes[j];

// Path: thread/utilClasses/Process.java
// public class Process {
// 	public String jobName;
// 	public int arrivalTime;
// 	public int cpuTime;
// 	public int priority;
// 	public char symbol;
// 	
// 	public Process(){
// 		this.jobName = "";
// 		this.arrivalTime = 0;
// 		this.cpuTime = 0;
// 		this.priority = 1;
// 		this.symbol = '0';
// 	}
// 	
// 	public Process(String jobName, int arrivalTime, int cpuTime, char symbol){
// 		this.jobName = jobName;
// 		this.arrivalTime = arrivalTime;
// 		this.cpuTime = cpuTime;
// 		this.priority = 1;
// 		this.symbol = symbol;
// 	}
// 	
// 	public Process(String jobName, int arrivalTime, int cpuTime, int priority, char symbol){
// 		this.jobName = jobName;
// 		this.arrivalTime = arrivalTime;
// 		this.cpuTime = cpuTime;
// 		this.priority = priority;
// 		this.symbol = symbol;
// 	}
// 	
// }
// 
// Path: thread/utilClasses/Result.java
// public class Result {
// 	public String jobName;
// 	public char symbol;
// 	public float waitingTime;
// 	
// 	public Result() {
// 		this.jobName = "EMPTY";
// 		this.symbol = ' ';
// 		waitingTime = -1;
// 	}
// 	
// 	public Result(String jobName, char symbol){
// 		this.jobName = jobName;
// 		this.symbol = symbol;
// 		waitingTime = -1;
// 	}
// 	
// 	public Result(String jobName, char symbol, float waitingTime){
// 		this.jobName = jobName;
// 		this.symbol = symbol;
// 		this.waitingTime = waitingTime;
// 	}
// }


// Path: thread/priorityBased/nonpremitive/CPU.java
import java.util.Queue;
import thread.utilClasses.Process;
import thread.utilClasses.Result;
import java.util.LinkedList;

				}else{
					result.add(new Result(waitingQueue.element().jobName, waitingQueue.element().symbol));
				}
				
			}else{							//idle time, no process is waiting
				result.add(new Result());
			}
			
			time += CPU_CYCLE_TIME;
		}
		
		
		return result;
	}
	
	private void order(Queue<Process> waitingQueue){
		int waitingQueueLength = waitingQueue.size();
		Process[] processes = new Process[waitingQueueLength];
		
		for(int i=0; i<waitingQueueLength; i++){
			processes[i] = waitingQueue.poll();
		}
		
		//bubble sort
		Process tempProcess;
		for(int i=1, j; i<waitingQueueLength-1; i++){
			for(j=i+1; j<waitingQueueLength; j++){
				if(processes[i].priority < processes[j].priority){
					tempProcess = processes[i];
					processes[i] = processes[j];

					processes[j] = tempProcess;
