Event.java 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. package com.example.yiupang.freefoodfinder;
  2. import java.util.Date;
  3. public class Event
  4. {
  5. private long eventId;
  6. private long userId;
  7. private String name;
  8. private Date time;
  9. private String foodType;
  10. private String description;
  11. private double lat;
  12. private double lng;
  13. public Event(){
  14. //Empty Constructor
  15. }
  16. public Event(String name, String foodType, String description)
  17. {
  18. this.name = name;
  19. this.foodType = foodType;
  20. this.description = description;
  21. }
  22. public String getName() {
  23. return name;
  24. }
  25. public long getEventId() { return eventId;}
  26. public void setEventId(long id) { eventId = id; }
  27. public long getUserId(){ return userId; }
  28. public void setUserId(long id){ userId = id; }
  29. public Date getTime(){ return time; }
  30. public void setTime(Date d){ time = d; }
  31. public boolean setName(String name) {
  32. if (name.length() > 3 && name.length() < 31) {
  33. this.name = name;
  34. return true;
  35. } else {
  36. return false;
  37. }
  38. }
  39. public String getFoodType() {
  40. return foodType;
  41. }
  42. public boolean setFoodType(String foodType){
  43. if(foodType.length() > 3 && foodType.length() <31) {
  44. this.foodType = foodType;
  45. return true;
  46. }
  47. else{
  48. return false;
  49. }
  50. }
  51. public double getLat(){
  52. return lat;
  53. }
  54. public boolean setLatitude(double latitude){
  55. if(latitude >= -90.0 && latitude <= 90.0){
  56. this.lat = latitude;
  57. return true;
  58. }
  59. else{
  60. return false;
  61. }
  62. }
  63. public double getLng(){
  64. return lng;
  65. }
  66. public boolean setLongitude(double longitude){
  67. if(longitude >= -180.0 && longitude <= 180.0){
  68. this.lng = longitude;
  69. return true;
  70. }
  71. else{
  72. return false;
  73. }
  74. }
  75. public String getDescription(){return this.description;}
  76. public void setDescription(String desc){description = desc;}
  77. @Override
  78. public String toString(){
  79. return "name: " + this.name;
  80. }
  81. }