Event.java 2.5 KB

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