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