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