-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathConfigFile.java
47 lines (44 loc) · 1.72 KB
/
ConfigFile.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
import java.util.Map;
import java.util.HashMap;
///////////////////
// ConfigFile: Holds all data for the system's configuration file
///////////////////
public class ConfigFile extends OS {
String fileName;
double version;
int systemMemory;
int blockSize;
int projectorQuantity;
int hardDriveQuantity;
int quantumNumber;
String schedulingCode;
String inputFileName;
String logOption;
String logFileName;
Map<String, Integer> times = new HashMap<>();
//ConfigFile (constructor) - requires that the config file is named to proceed
ConfigFile(String configFileName) {
if (configFileName != "" && configFileName != null) {
fileName = configFileName;
} else {
console.error("Config file is not named");
}
}
//outputSettings - output the configuration settings
public void outputSettings() {
console.log("Monitor = " + times.get("monitor") + " ms/cycle");
console.log("Processor = " + times.get("run") + " ms/cycle");
console.log("Scanner = " + times.get("scanner") + " ms/cycle");
console.log("Hard Drive = " + times.get("hard drive") + " ms/cycle");
console.log("Keyboard = " + times.get("keyboard") + " ms/cycle");
console.log("Memory = " + times.get("allocate") + " ms/cycle");
console.log("Projector = " + times.get("projector") + " ms/cycle");
if (logOption.equals("Log to Both")) {
console.log("Logged to monitor and " + logFileName);
} else if (logOption.equals("Log to Monitor")) {
console.log("Logged to monitor");
} else if (logOption.equals("Log to File")) {
console.log("Logged to " + logFileName);
}
}
}