-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathConfigInput.java
More file actions
53 lines (41 loc) · 1.56 KB
/
ConfigInput.java
File metadata and controls
53 lines (41 loc) · 1.56 KB
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
import java.util.*;
import java.io.*;
public class ConfigInput
{
static void readSysConfig(File ipfile)
{
try
{
Scanner in = new Scanner(ipfile);
String extractor,extracted;
while(in.hasNext())
{
/***********************************************************************
* Sir has given config Input with the variable name and an equal to sign.
* Extracting only the numerical part from it and assigning to the variables here.
* But while printing, printing syso("lalal = " + variable) so dont worry about
* me extracting more than needed from sir's input file.
***********************************************************************/
extractor = in.nextLine();
//System.out.println(extractor);
extracted = extractor.substring((extractor.indexOf('=')+1),extractor.length());
//System.out.println(extracted);
SystemConfig.max_proc = Integer.parseInt(extracted);
extractor = in.nextLine();
extracted = extractor.substring((extractor.indexOf('=')+1),extractor.length());
SystemConfig.PSG = Integer.parseInt(extracted);
extractor = in.nextLine();
extracted = extractor.substring((extractor.indexOf('=')+1),extractor.length());
SystemConfig.numIO = Integer.parseInt(extracted);
extractor = in.nextLine();
extracted = extractor.substring((extractor.indexOf('=')+1),extractor.length());
SystemConfig.memory = Integer.parseInt(extracted);
}
in.close();
}
catch (Exception e)
{
System.out.println("Exception while reading input to sysconfig");
}
}
}