]> gitweb.fperrin.net Git - GpsPrune.git/blob - tim/prune/function/search/SearchResult.java
Version 18.1, September 2015
[GpsPrune.git] / tim / prune / function / search / SearchResult.java
1 package tim.prune.function.search;
2
3 /**
4  * Class to hold a search result from wikipedia / gpsies / panoramio etc
5  */
6 public class SearchResult implements Comparable<SearchResult>
7 {
8         /** Track name or title */
9         private String _trackName = null;
10         /** Description */
11         private String _description = null;
12         /** Web page for more details */
13         private String _webUrl = null;
14         /** Track length in metres */
15         private double _trackLength = 0.0;
16         /** Download link */
17         private String _downloadLink = null;
18         /** Coordinates of point */
19         private String _latitude = null, _longitude = null;
20
21
22         /**
23          * @param inName name of track
24          */
25         public void setTrackName(String inName)
26         {
27                 _trackName = inName;
28         }
29
30         /**
31          * @return track name
32          */
33         public String getTrackName()
34         {
35                 return _trackName;
36         }
37
38         /**
39          * @param inDesc description
40          */
41         public void setDescription(String inDesc)
42         {
43                 _description = inDesc;
44         }
45
46         /**
47          * @return track description
48          */
49         public String getDescription()
50         {
51                 return _description;
52         }
53
54         /**
55          * @param inUrl web page url
56          */
57         public void setWebUrl(String inUrl)
58         {
59                 _webUrl = inUrl;
60         }
61
62         /**
63          * @return web url
64          */
65         public String getWebUrl()
66         {
67                 return _webUrl;
68         }
69
70         /**
71          * @param inLength length of track
72          */
73         public void setLength(double inLength)
74         {
75                 _trackLength = inLength;
76         }
77
78         /**
79          * @return track length
80          */
81         public double getLength()
82         {
83                 return _trackLength;
84         }
85
86         /**
87          * @param inLink link to download track
88          */
89         public void setDownloadLink(String inLink)
90         {
91                 _downloadLink = inLink;
92         }
93
94         /**
95          * @return download link
96          */
97         public String getDownloadLink()
98         {
99                 return _downloadLink;
100         }
101
102         /**
103          * @param inLatitude latitude
104          */
105         public void setLatitude(String inLatitude) {
106                 _latitude = inLatitude;
107         }
108
109         /**
110          * @return latitude
111          */
112         public String getLatitude() {
113                 return _latitude;
114         }
115
116         /**
117          * @param inLongitude longitude
118          */
119         public void setLongitude(String inLongitude) {
120                 _longitude = inLongitude;
121         }
122
123         /**
124          * @return longitude
125          */
126         public String getLongitude() {
127                 return _longitude;
128         }
129
130         /**
131          * Compare two search results for sorting (nearest first, then alphabetic)
132          */
133         public int compareTo(SearchResult inOther)
134         {
135                 double distDiff = getLength() - inOther.getLength();
136                 if (distDiff < 0.0)
137                 {
138                         return -1;
139                 }
140                 if (distDiff > 0.0)
141                 {
142                         return 1;
143                 }
144                 return getTrackName().compareTo(inOther.getTrackName());
145         }
146 }