View Javadoc
1   package info.mikethomas.fahview.v6project.model;
2   
3   /*
4    * #%L
5    * This file is part of FAHView-v6project.
6    * %%
7    * Copyright (C) 2011 - 2017 Mike Thomas <mikepthomas@outlook.com>
8    * %%
9    * FAHView is free software: you can redistribute it and/or modify
10   * it under the terms of the GNU General Public License as published by
11   * the Free Software Foundation, either version 3 of the License, or
12   * (at your option) any later version.
13   * %
14   * FAHView is distributed in the hope that it will be useful,
15   * but WITHOUT ANY WARRANTY; without even the implied warranty of
16   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17   * GNU General Public License for more details.
18   * %
19   * You should have received a copy of the GNU General Public License
20   * along with FAHView.  If not, see <http://www.gnu.org/licenses/>.
21   * #L%
22   */
23  
24  /**
25   * Interface to represent data stored about a Folding@home queue.
26   *
27   * @author <a href="mailto:mikepthomas@outlook.com">Michael Thomas</a>
28   * @version 6.00
29   */
30  public interface Queue {
31      // <editor-fold defaultstate="collapsed" desc="position-constants">
32      /**
33       * Position in bytes of the Queue (client) version from the start of
34       * {@code queue.dat}.
35       *
36       * @since 2.17
37       * @see #getVersion()
38       * @see #VERSION_LENGTH
39       */
40      int VERSION_POS = 0;
41      /**
42       * Position in bytes of the Current index number from the start of
43       * {@code queue.dat}.
44       *
45       * @see #getCurrent()
46       * @see #CURRENT_LENGTH
47       */
48      int CURRENT_POS = 4;
49      /**
50       * Position in bytes of Queue Index 0 from the start of
51       * {@code queue.dat}.
52       *
53       * @see #getQueueIndex(int)
54       * @see #QUEUE_INDEX_LENGTH
55       */
56      int QUEUE_INDEX_0_POS = 8;
57      /**
58       * Position in bytes of Queue Index 1 from the start of
59       * {@code queue.dat}.
60       *
61       * @see #getQueueIndex(int)
62       * @see #QUEUE_INDEX_LENGTH
63       */
64      int QUEUE_INDEX_1_POS = 720;
65      /**
66       * Position in bytes of Queue Index 2 from the start of
67       * {@code queue.dat}.
68       *
69       * @see #getQueueIndex(int)
70       * @see #QUEUE_INDEX_LENGTH
71       */
72      int QUEUE_INDEX_2_POS = 1432;
73      /**
74       * Position in bytes of Queue Index 3 from the start of
75       * {@code queue.dat}.
76       *
77       * @see #getQueueIndex(int)
78       * @see #QUEUE_INDEX_LENGTH
79       */
80      int QUEUE_INDEX_3_POS = 2144;
81      /**
82       * Position in bytes of Queue Index 4 from the start of
83       * {@code queue.dat}.
84       *
85       * @see #getQueueIndex(int)
86       * @see #QUEUE_INDEX_LENGTH
87       */
88      int QUEUE_INDEX_4_POS = 2856;
89      /**
90       * Position in bytes of Queue Index 5 from the start of
91       * {@code queue.dat}.
92       *
93       * @see #getQueueIndex(int)
94       * @see #QUEUE_INDEX_LENGTH
95       */
96      int QUEUE_INDEX_5_POS = 3568;
97      /**
98       * Position in bytes of Queue Index 6 from the start of
99       * {@code queue.dat}.
100      *
101      * @see #getQueueIndex(int)
102      * @see #QUEUE_INDEX_LENGTH
103      */
104     int QUEUE_INDEX_6_POS = 4280;
105     /**
106      * Position in bytes of Queue Index 7 from the start of
107      * {@code queue.dat}.
108      *
109      * @see #getQueueIndex(int)
110      * @see #QUEUE_INDEX_LENGTH
111      */
112     int QUEUE_INDEX_7_POS = 4992;
113     /**
114      * Position in bytes of Queue Index 8 from the start of
115      * {@code queue.dat}.
116      *
117      * @see #getQueueIndex(int)
118      * @see #QUEUE_INDEX_LENGTH
119      */
120     int QUEUE_INDEX_8_POS = 5704;
121     /**
122      * Position in bytes of Queue Index 9 from the start of
123      * {@code queue.dat}.
124      *
125      * @see #getQueueIndex(int)
126      * @see #QUEUE_INDEX_LENGTH
127      */
128     int QUEUE_INDEX_9_POS = 6416;
129     /**
130      * Position in bytes of the Performance Fraction from the start of
131      * {@code queue.dat}.
132      *
133      * @since 3.24
134      * @see #getPfract()
135      * @see #PFRACT_LENGTH
136      */
137     int PFRACT_POS = 7128;
138     /**
139      * Position in bytes of the Performance fraction unit weight from the start
140      * of {@code queue.dat}.
141      *
142      * @since 3.24
143      * @see #getPunits()
144      * @see #PUNITS_LENGTH
145      */
146     int PUNITS_POS = 7132;
147     /**
148      * Position in bytes of the Download rate sliding average from the start of
149      * {@code queue.dat}.
150      *
151      * @since 4.00
152      * @see #getDrate()
153      * @see #DRATE_LENGTH
154      */
155     int DRATE_POS = 7136;
156     /**
157      * Position in bytes of the Download rate unit weight from the start of
158      * {@code queue.dat}.
159      *
160      * @since 4.00
161      * @see #getDunits()
162      * @see #DUNITS_LENGTH
163      */
164     int DUNITS_POS = 7140;
165     /**
166      * Position in bytes of the Upload rate sliding average from the start of
167      * {@code queue.dat}.
168      *
169      * @since 4.00
170      * @see #getUrate()
171      * @see #URATE_LENGTH
172      */
173     int URATE_POS = 7144;
174     /**
175      * Position in bytes of the Upload rate unit weight from the start of
176      * {@code queue.dat}.
177      *
178      * @since 4.00
179      * @see #getUunits()
180      * @see #UUNITS_LENGTH
181      */
182     int UUNITS_POS = 7148;
183     /**
184      * Position in bytes of the Results successfully sent after upload failures
185      * from the start of {@code queue.dat}.
186      *
187      * @since 5.00
188      * @see #getSent()
189      * @see #SENT_LENGTH
190      */
191     int SENT_POS = 7152;
192     /**
193      * Position in bytes of padding from the start of {@code queue.dat}
194      * (All Zeros).
195      *
196      * @since 5.00
197      * @see #Z7156_LENGTH
198      */
199     int Z7156_POS = 7156;
200     // </editor-fold>
201     // <editor-fold defaultstate="collapsed" desc="length-constants">
202     /**
203      * Length in bytes of the Queue (client) version in {@code queue.dat}.
204      *
205      * @since 2.17
206      * @see #getVersion()
207      * @see #VERSION_POS
208      */
209     int VERSION_LENGTH = 4;
210     /**
211      * Length in bytes of the Current index number in {@code queue.dat}.
212      *
213      * @see #getCurrent()
214      * @see #CURRENT_POS
215      */
216     int CURRENT_LENGTH = 4;
217     /**
218      * Length in bytes of a Queue Index in {@code queue.dat}.
219      *
220      * @see #getQueueIndex(int)
221      * @see #QUEUE_INDEX_0_POS
222      * @see #QUEUE_INDEX_1_POS
223      * @see #QUEUE_INDEX_2_POS
224      * @see #QUEUE_INDEX_3_POS
225      * @see #QUEUE_INDEX_4_POS
226      * @see #QUEUE_INDEX_5_POS
227      * @see #QUEUE_INDEX_6_POS
228      * @see #QUEUE_INDEX_7_POS
229      * @see #QUEUE_INDEX_8_POS
230      * @see #QUEUE_INDEX_9_POS
231      *
232      */
233     int QUEUE_INDEX_LENGTH = 712;
234     /**
235      * Length in bytes of the Performance fraction in {@code queue.dat}.
236      *
237      * @since 3.24
238      * @see #getPfract()
239      * @see #PFRACT_POS
240      */
241     int PFRACT_LENGTH = 4;
242     /**
243      * Length in bytes of the Performance fraction unit weight in
244      * {@code queue.dat}.
245      *
246      * @since 3.24
247      * @see #getPunits()
248      * @see #PUNITS_POS
249      */
250     int PUNITS_LENGTH = 4;
251     /**
252      * Length in bytes of the Download rate sliding average in
253      * {@code queue.dat}.
254      *
255      * @since 4.00
256      * @see #getDrate()
257      * @see #DRATE_POS
258      */
259     int DRATE_LENGTH = 4;
260     /**
261      * Length in bytes of the Download rate unit weight in {@code queue.dat}.
262      *
263      * @since 4.00
264      * @see #getDunits()
265      * @see #DUNITS_POS
266      */
267     int DUNITS_LENGTH = 4;
268     /**
269      * Length in bytes of the Upload rate sliding average in {@code queue.dat}.
270      *
271      * @since 4.00
272      * @see #getUrate()
273      * @see #URATE_POS
274      */
275     int URATE_LENGTH = 4;
276     /**
277      * Length in bytes of the Upload rate unit weight in {@code queue.dat}.
278      *
279      * @since 4.00
280      * @see #getUunits()
281      * @see #UUNITS_POS
282      */
283     int UUNITS_LENGTH = 4;
284     /**
285      * Length in bytes of the Results successfully sent after upload failures in
286      * {@code queue.dat}.
287      *
288      * @since 5.00
289      * @see #getSent()
290      * @see #SENT_POS
291      */
292     int SENT_LENGTH = 4;
293     /**
294      * Length in bytes of padding in {@code queue.dat} (All Zeros).
295      *
296      * @since 5.00
297      * @see #Z7156_POS
298      */
299     int Z7156_LENGTH = 12;
300     // </editor-fold>
301     // <editor-fold desc="accessors">
302     /**
303      * Get the value of Queue (client) version.
304      *
305      * @return the value of version
306      */
307     int getVersion();
308     /**
309      * Get the value of Current index number.
310      *
311      * @return the value of current
312      */
313     int getCurrent();
314     /**
315      * Get the value of queueIndex at specified index.
316      *
317      * @param index the index required
318      * @return the value of queueIndex at specified index
319      */
320     QueueIndexImpl getQueueIndex(int index);
321     /**
322      * Get the value of Performance fraction.
323      *
324      * @return the value of pfract
325      */
326     int getPfract();
327     /**
328      * Get the value of Performance fraction unit weight.
329      *
330      * @return the value of punits
331      */
332     int getPunits();
333     /**
334      * Get the value of Download rate sliding average.
335      *
336      * @return the value of drate
337      */
338     int getDrate();
339     /**
340      * Get the value of Download rate unit weight.
341      *
342      * @return the value of dunits
343      */
344     int getDunits();
345     /**
346      * Get the value of Upload rate sliding average.
347      *
348      * @return the value of urate
349      */
350     int getUrate();
351     /**
352      * Get the value of Upload rate unit weight.
353      *
354      * @return the value of uunits
355      */
356     int getUunits();
357     /**
358      * Get the value of Results Sent.
359      *
360      * @return the value of sent
361      */
362     int getSent();
363     // </editor-fold>
364 
365     /**
366      * Update all values.
367      */
368     void update();
369 }