-
Notifications
You must be signed in to change notification settings - Fork 0
/
ReadJobs.java
55 lines (44 loc) · 1.12 KB
/
ReadJobs.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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
import java.io.File;
import java.util.Scanner;
public class ReadJobs
{
public static void readJobFile(File jobfile)
{
try
{
Scanner in = new Scanner(jobfile);
int total_jobs_submitted = 0;
String checker;
while(in.hasNext())
{
checker = in.next();
if(checker.equals("SUBMIT_JOB"))
System.out.println("The command encountered is " + checker);
else
System.out.println("The command encountered is " + checker);
if(checker.equals("SUBMIT_JOB"))
{
//System.out.println("Reading this file");
InputEntry newEntry = new InputEntry();
newEntry.pname = in.next();
newEntry.start_time = in.nextInt();
InputTable.add(newEntry);
System.out.println("Added one item");
total_jobs_submitted+=1;
}
else if(checker.equals("PROCESS_TABLE"))
{
int output_time = in.nextInt();
System.out.println(output_time);
OutputTable.addNewOutputEntry(output_time);
}
}
in.close();
SystemConfig.total_jobs_submitted=total_jobs_submitted;
}
catch (Exception e)
{
System.out.println("Failed in adding items"+ e);
}
}
}