1 package tim.prune.data;
6 * Simple class to represent an entry in the recently-used files list
8 public class RecentFile
10 private boolean _regularLoad = true; // false for load via gpsbabel
11 private File _file = null;
16 * @param inRegular true for regular load, false for gpsbabel load
18 public RecentFile(File inFile, boolean inRegular)
21 _regularLoad = inRegular;
26 * @param inDesc String from config
28 public RecentFile(String inDesc)
30 if (inDesc != null && inDesc.length() > 3)
32 _regularLoad = (inDesc.charAt(0) != 'g');
33 _file = new File(inDesc.substring(1));
40 public File getFile() {
45 * @return true for regular load, false for gpsbabel load
47 public boolean isRegularLoad() {
52 * @return true if file (still) exists
54 public boolean isValid() {
55 return _file != null && _file.exists() && _file.isFile();
59 * @return string to save in config
61 public String getConfigString()
63 if (!isValid()) return "";
64 return (_regularLoad?"r":"g") + _file.getAbsolutePath();
69 * @param inOther other RecentFile object
70 * @return true if they both refer to the same file
72 public boolean isSameFile(RecentFile inOther)
74 return inOther != null && isValid() && inOther.isValid()
75 && _file.equals(inOther._file);