View Javadoc
1   /*
2    * #%L
3    * This file is part of jFold.
4    * %%
5    * Copyright (C) 2012 - 2024 Mike Thomas <mikepthomas@outlook.com>
6    * %%
7    * jFold is free software: you can redistribute it and/or modify
8    * it under the terms of the GNU General Public License as published by
9    * the Free Software Foundation, either version 3 of the License, or
10   * (at your option) any later version.
11   * %
12   * jFold is distributed in the hope that it will be useful,
13   * but WITHOUT ANY WARRANTY; without even the implied warranty of
14   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15   * GNU General Public License for more details.
16   * %
17   * You should have received a copy of the GNU General Public License
18   * along with jFold.  If not, see <http://www.gnu.org/licenses/>.
19   * #L%
20   */
21  package info.mikethomas.jfold.unit;
22  
23  import info.mikethomas.jfold.util.DateAdapter;
24  
25  import java.io.Serializable;
26  import java.net.InetAddress;
27  import java.util.Date;
28  
29  import jakarta.xml.bind.annotation.XmlElement;
30  import jakarta.xml.bind.annotation.XmlRootElement;
31  import jakarta.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
32  
33  import lombok.Getter;
34  import lombok.ToString;
35  
36  /**
37   * <p>Represents a Folding@Home Work Unit.</p>
38   *
39   * @author Michael Thomas (mikepthomas@outlook.com)
40   * @version 7.6.21
41   */
42  @Getter
43  @ToString
44  @XmlRootElement(name = "unit")
45  public class Unit implements Serializable {
46  
47      /**
48       * Identifier.
49       *
50       * @return the <code>id</code> from <code>queue-info</code>
51       */
52      @XmlElement
53      private String id;
54  
55      /**
56       * Unit state.
57       *
58       * @return the <code>state</code> from <code>queue-info</code>
59       */
60      @XmlElement
61      private String state;
62  
63      /**
64       * Unit error.
65       *
66       * @return the <code>error</code> from <code>queue-info</code>
67       */
68      @XmlElement
69      private String error;
70  
71      /**
72       * Project this Unit belongs to.
73       *
74       * @return the <code>project</code> from <code>queue-info</code>
75       */
76      @XmlElement
77      private int project;
78  
79      /**
80       * Run of the Project.
81       *
82       * @return the <code>run</code> from <code>queue-info</code>
83       */
84      @XmlElement
85      private int run;
86  
87      /**
88       * Clone of the Project.
89       *
90       * @return the <code>clone</code> from <code>queue-info</code>
91       */
92      @XmlElement
93      private int clone;
94  
95      /**
96       * Generation of the Project.
97       *
98       * @return the <code>gen</code> from <code>queue-info</code>
99       */
100     @XmlElement
101     private int gen;
102 
103     /**
104      * Core Identifier.
105      *
106      * @return the <code>core</code> from <code>queue-info</code>
107      */
108     @XmlElement
109     private String core;
110 
111     /**
112      * Unique ID of the unit.
113      *
114      * @return the <code>unit</code> from <code>queue-info</code>
115      */
116     @XmlElement
117     private String unit;
118 
119     /**
120      * Percentage of work completed.
121      *
122      * @return the <code>percentdone</code> from <code>queue-info</code>
123      */
124     @XmlElement(name = "percentdone")
125     private String percentDone;
126 
127     /**
128      * Estimated time of arrival.
129      *
130      * @return the <code>eta</code> from <code>queue-info</code>
131      */
132     @XmlElement
133     private String eta;
134 
135     /**
136      * Points per day.
137      *
138      * @return the <code>ppd</code> from <code>queue-info</code>
139      */
140     @XmlElement
141     private double ppd;
142 
143     /**
144      * Estimated number of points awarded for completion of this Unit.
145      *
146      * @return the <code>creditestimate</code> from <code>queue-info</code>
147      */
148     @XmlElement(name = "creditestimate")
149     private double creditEstimate;
150 
151     /**
152      * Reason the Unit is waiting.
153      *
154      * @return the <code>waitingon</code> from <code>queue-info</code>
155      */
156     @XmlElement(name = "waitingon")
157     private String waitingOn;
158 
159     /**
160      * Time until the next attempt to send completed Unit to collection server.
161      *
162      * @return the <code>nextattempt</code> from <code>queue-info</code>
163      */
164     @XmlElement(name = "nextattempt")
165     private String nextAttempt;
166 
167     /**
168      * Time remaining.
169      *
170      * @return the <code>timeremaining</code> from <code>queue-info</code>
171      */
172     @XmlElement(name = "timeremaining")
173     private String timeRemaining;
174 
175     /**
176      * Total number of frames in this Unit.
177      *
178      * @return the <code>totalframes</code> from <code>queue-info</code>
179      */
180     @XmlElement(name = "totalframes")
181     private int totalFrames;
182 
183     /**
184      * Number of frames completed.
185      *
186      * @return the <code>framesdone</code> from <code>queue-info</code>
187      */
188     @XmlElement(name = "framesdone")
189     private int framesDone;
190 
191     /**
192      * Time and date this work unit was assigned.
193      *
194      * @return the <code>assigned</code> from <code>queue-info</code>
195      */
196     @XmlElement
197     @XmlJavaTypeAdapter(DateAdapter.class)
198     private Date assigned;
199 
200     /**
201      * Time and date this work unit expires.
202      *
203      * @return the <code>timeout</code> from <code>queue-info</code>
204      */
205     @XmlElement
206     @XmlJavaTypeAdapter(DateAdapter.class)
207     private Date timeout;
208 
209     /**
210      * Time and date this work unit needs to be completed by.
211      *
212      * @return the <code>deadline</code> from <code>queue-info</code>
213      */
214     @XmlElement
215     @XmlJavaTypeAdapter(DateAdapter.class)
216     private Date deadline;
217 
218     /**
219      * Work server.
220      *
221      * @return the <code>ws</code> from <code>queue-info</code>
222      */
223     @XmlElement
224     private InetAddress ws;
225 
226     /**
227      * Collection server.
228      *
229      * @return the <code>cs</code> from <code>queue-info</code>
230      */
231     @XmlElement
232     private InetAddress cs;
233 
234     /**
235      * Number of attempts to send completed Unit to collection server.
236      *
237      * @return the <code>attempts</code> from <code>queue-info</code>
238      */
239     @XmlElement
240     private int attempts;
241 
242     /**
243      * Slot number this Unit belongs to.
244      *
245      * @return the <code>slot</code> from <code>queue-info</code>
246      */
247     @XmlElement
248     private String slot;
249 
250     /**
251      * Time per frame.
252      *
253      * @return the <code>tpf</code> from <code>queue-info</code>
254      */
255     @XmlElement
256     private String tpf;
257 
258     /**
259      * Baseline number of points awarded for completion of this Unit.
260      *
261      * @return the <code>basecredit</code> from <code>queue-info</code>
262      */
263     @XmlElement(name = "basecredit")
264     private double baseCredit;
265 
266     /**
267      * Project Description.
268      *
269      * @deprecated no longer returned by queue-info
270      * @return the <code>description</code> from <code>queue-info</code>
271      */
272     @Deprecated
273     @XmlElement
274     private String description;
275 }