a9b0d0445e237097d0e27abe99c76bc71731fb08
[debian/openrocket] / src / net / sf / openrocket / communication / UpdateInfo.java
1 package net.sf.openrocket.communication;
2
3 import java.util.ArrayList;
4 import java.util.List;
5
6 import net.sf.openrocket.util.ComparablePair;
7 import net.sf.openrocket.util.Prefs;
8
9 public class UpdateInfo {
10
11         private final String latestVersion;
12         
13         private final ArrayList<ComparablePair<Integer, String>> updates;
14         
15         
16         public UpdateInfo() {
17                 this.latestVersion = Prefs.getVersion();
18                 this.updates = new ArrayList<ComparablePair<Integer, String>>();
19         }
20         
21         public UpdateInfo(String version, List<ComparablePair<Integer, String>> updates) {
22                 this.latestVersion = version;
23                 this.updates = new ArrayList<ComparablePair<Integer, String>>(updates);
24         }
25
26
27
28         /**
29          * Get the latest OpenRocket version.  If it is the current version, then the value
30          * of {@link Prefs#getVersion()} is returned.
31          * 
32          * @return      the latest OpenRocket version.
33          */
34         public String getLatestVersion() {
35                 return latestVersion;
36         }
37
38
39         /**
40          * Return a list of the new features/updates that are available.  The list has a
41          * priority for each update and a message text.  The returned list may be modified.
42          * 
43          * @return      a modifiable list of the updates.
44          */
45         @SuppressWarnings("unchecked")
46         public List<ComparablePair<Integer, String>> getUpdates() {
47                 return (List<ComparablePair<Integer, String>>) updates.clone();
48         }
49         
50         @Override
51         public String toString() {
52                 return "UpdateInfo[version=" + latestVersion + "; updates=" + updates.toString() + "]";
53         }
54         
55 }