X-Git-Url: http://gitweb.fperrin.net/?p=GpsPrune.git;a=blobdiff_plain;f=src%2Ftim%2Fprune%2Ffunction%2Fsearch%2FSearchResult.java;fp=src%2Ftim%2Fprune%2Ffunction%2Fsearch%2FSearchResult.java;h=d757b017a2d6456e9e43475418116c84e6144ec3;hp=0000000000000000000000000000000000000000;hb=ce6f2161b8596f7018d6a76bff79bc9e571f35fd;hpb=2d8cb72e84d5cc1089ce77baf1e34ea3ea2f8465 diff --git a/src/tim/prune/function/search/SearchResult.java b/src/tim/prune/function/search/SearchResult.java new file mode 100644 index 0000000..d757b01 --- /dev/null +++ b/src/tim/prune/function/search/SearchResult.java @@ -0,0 +1,164 @@ +package tim.prune.function.search; + +/** + * Class to hold a search result from wikipedia / gpsies etc + */ +public class SearchResult implements Comparable +{ + /** 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) + { + double distDiff = getLength() - inOther.getLength(); + if (distDiff < 0.0) + { + return -1; + } + if (distDiff > 0.0) + { + return 1; + } + return getTrackName().compareTo(inOther.getTrackName()); + } +}