-
Notifications
You must be signed in to change notification settings - Fork 0
/
ReadModelFiles.java
65 lines (49 loc) · 1.41 KB
/
ReadModelFiles.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
56
57
58
59
60
61
62
63
64
65
import java.io.*;
import java.util.*;
public class ReadModelFiles
{
public static void ReadModels(String inputPpath)
{
try
{
for(InputEntry ip: InputTable.ipTable)
{
String checker;
String Ppath = inputPpath;
Ppath = Ppath.concat(ip.pname);
Ppath = Ppath.concat(".model");
System.out.println();
System.out.println("curr path is " + Ppath);
File readModule = new File(Ppath);
Scanner in = new Scanner(readModule);
while(in.hasNext())
{
checker = in.next();
if(checker.equals("cpu"))
{
int time_req = in.nextInt();
in.next();
int mem_req = in.nextInt();
ip.add_cpuSpec(time_req, mem_req);
System.out.println("new line added in LL as a CpuSpec");
System.out.println("Does the Model file have any more lines? - " + in.hasNext());
}
else if(checker.equals("io"))
{
int io_module_num = in.nextInt();
int time_req = in.nextInt();
ip.add_IOspec(time_req,io_module_num );
System.out.println("new line added in LL as an IOSpec");
System.out.println("Does the Model file have any more lines? - " + in.hasNext());
}
}
in.close();
System.out.println("---------------------------------");
}
}
catch (Exception e)
{
System.out.println("Error while reading model files");
}
}
}