-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDriver.java
29 lines (26 loc) · 863 Bytes
/
Driver.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
package cpu_scheduler;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Scanner;
public class Driver {
public static void main(String[] arg) throws IOException {
Scanner kb = new Scanner(System.in);
System.out.print("Please enter filename: ");
String fileName = kb.nextLine();
System.out.print("Please enter Time Quantum: ");
int tq = kb.nextInt();
Scanner inputStream = new Scanner(new File(fileName));
inputStream.useDelimiter("(,|\\v+)");
inputStream.nextLine();
ArrayList<Process> csvFile = new ArrayList<>();
while (inputStream.hasNext()) {
Process process = new Process(inputStream.nextInt(), inputStream.nextInt(), inputStream.nextInt());
csvFile.add(process);
}
Scheduler myScheduler = new Scheduler(csvFile, tq);
myScheduler.rr();
kb.close();
inputStream.close();
}
}