-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathInstancesManager.java
More file actions
80 lines (69 loc) · 3.99 KB
/
Copy pathInstancesManager.java
File metadata and controls
80 lines (69 loc) · 3.99 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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
package cwp.instance;
import java.util.List;
public final class InstancesManager {
private final List<InstanceFile> allInstances = List.of(
new InstanceFile("CW_hb/arc130.mtx.rnd", "arc130", "CW_hb"),
new InstanceFile("CW_hb/ash85.mtx.rnd", "ash85", "CW_hb"),
new InstanceFile("CW_hb/bcspwr01.mtx.rnd", "bcspwr01", "CW_hb"),
new InstanceFile("CW_hb/bcspwr02.mtx.rnd", "bcspwr02", "CW_hb"),
new InstanceFile("CW_hb/bcspwr03.mtx.rnd", "bcspwr03", "CW_hb"),
new InstanceFile("CW_hb/bcsstk01.mtx.rnd", "bcsstk01", "CW_hb"),
new InstanceFile("CW_hb/bcsstk02.mtx.rnd", "bcsstk02", "CW_hb"),
new InstanceFile("CW_hb/bcsstk04.mtx.rnd", "bcsstk04", "CW_hb"),
new InstanceFile("CW_hb/bcsstk05.mtx.rnd", "bcsstk05", "CW_hb"),
new InstanceFile("CW_hb/bcsstk22.mtx.rnd", "bcsstk22", "CW_hb"),
new InstanceFile("CW_hb/can__144.mtx.rnd", "can__144", "CW_hb"),
new InstanceFile("CW_hb/can__161.mtx.rnd", "can__161", "CW_hb"),
new InstanceFile("CW_hb/curtis54.mtx.rnd", "curtis54", "CW_hb"),
new InstanceFile("CW_hb/dwt__234.mtx.rnd", "dwt__234", "CW_hb"),
new InstanceFile("CW_hb/fs_183_1.mtx.rnd", "fs_183_1", "CW_hb"),
new InstanceFile("CW_hb/fs_183_3.mtx.rnd", "fs_183_3", "CW_hb"),
new InstanceFile("CW_hb/fs_183_4.mtx.rnd", "fs_183_4", "CW_hb"),
new InstanceFile("CW_hb/fs_183_6.mtx.rnd", "fs_183_6", "CW_hb"),
new InstanceFile("CW_hb/gent113.mtx.rnd", "gent113", "CW_hb"),
new InstanceFile("CW_hb/gre__115.mtx.rnd", "gre__115", "CW_hb"),
new InstanceFile("CW_hb/gre__185.mtx.rnd", "gre__185", "CW_hb"),
new InstanceFile("CW_hb/ibm32.mtx.rnd", "ibm32", "CW_hb"),
new InstanceFile("CW_hb/impcol_b.mtx.rnd", "impcol_b", "CW_hb"),
new InstanceFile("CW_hb/impcol_c.mtx.rnd", "impcol_c", "CW_hb"),
new InstanceFile("CW_hb/lns__131.mtx.rnd", "lns__131", "CW_hb"),
new InstanceFile("CW_hb/lund_a.mtx.rnd", "lund_a", "CW_hb"),
new InstanceFile("CW_hb/lund_b.mtx.rnd", "lund_b", "CW_hb"),
new InstanceFile("CW_hb/mcca.mtx.rnd", "mcca", "CW_hb"),
new InstanceFile("CW_hb/nos1.mtx.rnd", "nos1", "CW_hb"),
new InstanceFile("CW_hb/nos4.mtx.rnd", "nos4", "CW_hb"),
new InstanceFile("CW_hb/pores_1.mtx.rnd", "pores_1", "CW_hb"),
new InstanceFile("CW_hb/steam3.mtx.rnd", "steam3", "CW_hb"),
new InstanceFile("CW_hb/west0132.mtx.rnd", "west0132", "CW_hb"),
new InstanceFile("CW_hb/west0156.mtx.rnd", "west0156", "CW_hb"),
new InstanceFile("CW_hb/west0167.mtx.rnd", "west0167", "CW_hb"),
new InstanceFile("CW_hb/will57.mtx.rnd", "will57", "CW_hb"),
new InstanceFile("CW_hb/will199.mtx.rnd", "will199", "CW_hb"));
public List<InstanceFile> getInstances() {
return allInstances;
}
public List<InstanceFile> getInstancesByType(String type) {
return allInstances.stream()
.filter(instance -> instance.type().equals(type))
.toList();
}
public InstanceFile getInstance(int index) {
return allInstances.get(index);
}
public List<InstanceFile> getInstances(int fromIndex, int toIndex) {
return allInstances.subList(fromIndex, toIndex);
}
public InstanceFile getInstanceByType(String type, int index) {
return getInstancesByType(type).get(index);
}
public List<InstanceFile> getInstances(String type, int fromIndex, int toIndex) {
return getInstancesByType(type).subList(fromIndex, toIndex);
}
public InstanceFile getInstanceByFileName(String fileName) {
return allInstances.stream()
.filter(instance -> instance.fileName().equals(fileName))
.findFirst()
.orElseThrow(() -> new IllegalArgumentException(
"No instance with file name: " + fileName));
}
}