Context-detection API for Android developed as a university project
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Place.java 2.6KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. /*
  2. * Copyright (c) 2009-2010 Chris Smith
  3. *
  4. * Permission is hereby granted, free of charge, to any person obtaining a copy
  5. * of this software and associated documentation files (the "Software"), to deal
  6. * in the Software without restriction, including without limitation the rights
  7. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  8. * copies of the Software, and to permit persons to whom the Software is
  9. * furnished to do so, subject to the following conditions:
  10. *
  11. * The above copyright notice and this permission notice shall be included in
  12. * all copies or substantial portions of the Software.
  13. *
  14. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  15. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  16. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  17. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  18. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  19. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  20. * SOFTWARE.
  21. */
  22. package uk.co.md87.android.common.model;
  23. import android.net.Uri;
  24. /**
  25. * A place is a named location which has some significance for the user. Most
  26. * places come about when the user remains stationary for a period of time.
  27. *
  28. * @author chris
  29. */
  30. public class Place {
  31. public static final String _ID = "_id";
  32. public static final String NAME = "name";
  33. public static final String LATITUDE = "lat";
  34. public static final String LONGITUDE = "lon";
  35. public static final String DURATION = "duration";
  36. public static final String VISIT_COUNT = "times";
  37. public static final String LAST_VISIT = "lastvisit";
  38. public static final Uri CONTENT_URI = Uri.parse("content://uk.co.md87"
  39. + ".android.contextanalyser.placescontentprovider/places");
  40. public static final String CONTENT_TYPE = "vnd.contextanalyser.location";
  41. private final long id;
  42. private final String name;
  43. private final double lat;
  44. private final double lon;
  45. public Place(final long id, final String name, final double lat, final double lon) {
  46. this.id = id;
  47. this.name = name;
  48. this.lat = lat;
  49. this.lon = lon;
  50. }
  51. public long getId() {
  52. return id;
  53. }
  54. public double getLat() {
  55. return lat;
  56. }
  57. public double getLon() {
  58. return lon;
  59. }
  60. public String getName() {
  61. return name;
  62. }
  63. @Override
  64. public String toString() {
  65. return "Place{id=" + id + " name=" + name + " lat=" + lat + " lon=" + lon + '}';
  66. }
  67. }