1 package info.mikethomas.fahview.v6project.model;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24 import info.mikethomas.fahview.v6project.utilities.QueueReader;
25 import java.util.Date;
26
27
28
29
30
31
32
33 public class Core {
34
35 private int indexNumber, position;
36 private int coreNo;
37 private String project;
38 private QueueReader reader;
39
40 private String fileName, type, version;
41 private Date date;
42
43
44
45
46
47
48
49
50 public Core(int indexNumber, QueueReader reader) throws InstantiationException {
51 this.indexNumber = indexNumber;
52 switch (indexNumber) {
53 case 0:
54 position = QueueImpl.QUEUE_INDEX_0_POS + QueueIndexImpl.CORE_POS;
55 break;
56 case 1:
57 position = QueueImpl.QUEUE_INDEX_1_POS + QueueIndexImpl.CORE_POS;
58 break;
59 case 2:
60 position = QueueImpl.QUEUE_INDEX_2_POS + QueueIndexImpl.CORE_POS;
61 break;
62 case 3:
63 position = QueueImpl.QUEUE_INDEX_3_POS + QueueIndexImpl.CORE_POS;
64 break;
65 case 4:
66 position = QueueImpl.QUEUE_INDEX_4_POS + QueueIndexImpl.CORE_POS;
67 break;
68 case 5:
69 position = QueueImpl.QUEUE_INDEX_5_POS + QueueIndexImpl.CORE_POS;
70 break;
71 case 6:
72 position = QueueImpl.QUEUE_INDEX_6_POS + QueueIndexImpl.CORE_POS;
73 break;
74 case 7:
75 position = QueueImpl.QUEUE_INDEX_7_POS + QueueIndexImpl.CORE_POS;
76 break;
77 case 8:
78 position = QueueImpl.QUEUE_INDEX_8_POS + QueueIndexImpl.CORE_POS;
79 break;
80 case 9:
81 position = QueueImpl.QUEUE_INDEX_9_POS + QueueIndexImpl.CORE_POS;
82 break;
83 default:
84 throw new InstantiationException("Queue index should be 0-9.");
85 }
86 this.reader = reader;
87 update();
88 }
89
90
91
92
93
94
95 public String getCoreNo() {
96 return Integer.toHexString(coreNo).toUpperCase();
97 }
98
99
100
101
102
103
104 public String getProject() {
105 return project;
106 }
107
108
109
110
111 protected void setCoreNo() {
112 coreNo = (int) reader.readLEUInt(position, QueueIndexImpl.CORE_LENGTH);
113 }
114
115
116
117
118 protected void setProject() {
119 switch(coreNo) {
120 case 0x10:
121 project = "GROGPU";
122 break;
123 case 0x11:
124 project = "GROGPU2";
125 break;
126 case 0x12:
127 project = "ATI-DEV";
128 break;
129 case 0x13:
130 project = "NVIDIA-DEV";
131 break;
132 case 0x14:
133 project = "GROGPU2-MT";
134 break;
135 case 0x15:
136 project = "OPENMMGPU";
137 break;
138 case 0x16:
139 project = "OPENMM_OPENCL";
140 break;
141 case 0x20:
142 project = "SHARPEN";
143 break;
144 case 0x65:
145 project = "TINKER";
146 break;
147 case 0x78:
148 project = "GROMACS";
149 break;
150 case 0x79:
151 project = "DGROMACS";
152 break;
153 case 0x7a:
154 project = "GBGROMACS";
155 break;
156 case 0x7b:
157 project = "DGROMACSB";
158 break;
159 case 0x7c:
160 project = "DGROMACSC";
161 break;
162 case 0x80:
163 project = "GROST";
164 break;
165 case 0x81:
166 project = "GROSIMT";
167 break;
168 case 0x82:
169 project = "AMBER";
170 break;
171 case 0x96:
172 project = "QMD";
173 break;
174 case 0xa0:
175 project = "GROMACS33";
176 break;
177 case 0xa1:
178 project = "GRO-SMP";
179 break;
180 case 0xa2:
181 project = "GROCVS";
182 break;
183 case 0xa3:
184 project = "GRO-A3";
185 break;
186 case 0xa4:
187 project = "GRO-A4";
188 break;
189 case 0xa5:
190 project = "GRO-A5";
191 break;
192 case 0xa6:
193 project = "GRO-A6";
194 break;
195 case 0xb4:
196 project = "ProtoMol";
197 break;
198 default:
199 project = "Unknown";
200 break;
201 }
202 }
203
204
205
206
207
208
209 protected void setFileName(String line) {
210 fileName = trimAttribute(line);
211 }
212
213
214
215
216
217
218 public String getFileName() {
219 return fileName;
220 }
221
222
223
224
225
226
227
228 private String trimAttribute(String line) {
229 return line = line.substring(line.lastIndexOf(":") + 2);
230 }
231
232
233
234
235 public final void update() {
236 setCoreNo();
237 setProject();
238 }
239
240
241 @Override
242 public String toString() {
243 String result = "";
244 result += "queue.index[" + indexNumber + "].core.coreNo\t" + getCoreNo();
245 result += "\nqueue.index[" + indexNumber + "].core.project\t" + getProject();
246 return result;
247 }
248 }