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.

StopsDbo.java 1.9KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. package com.rthoni.stssaguenay.dbo;
  2. import android.util.Pair;
  3. import com.luticate.utils.dbo.LuDbo;
  4. import com.luticate.utils.dbo.LuPaginatedDbo;
  5. import org.json.JSONArray;
  6. import org.json.JSONException;
  7. import org.json.JSONObject;
  8. import java.util.HashMap;
  9. import java.util.List;
  10. import java.util.Vector;
  11. /**
  12. * Created by robin on 9/29/16.
  13. */
  14. public class StopsDbo extends LuDbo {
  15. public static class PaginatedStopsDbo extends LuPaginatedDbo<StopsDbo>
  16. {
  17. }
  18. @Override
  19. public void fromJson(JSONObject json) throws JSONException {
  20. _name = json.getString("name");
  21. _routes = new Vector<>();
  22. JSONArray routes = json.getJSONArray("routes");
  23. for (int i = 0; i < routes.length(); ++i) {
  24. _routes.add(routes.getString(i));
  25. }
  26. _id = json.getString("id");
  27. _posX = json.getDouble("posX");
  28. _posY = json.getDouble("posY");
  29. }
  30. @Override
  31. public HashMap<String, Object> toArray() {
  32. return null;
  33. }
  34. protected String _name;
  35. protected List<String> _routes;
  36. protected String _id;
  37. protected double _posX;
  38. protected double _posY;
  39. public String getFullName()
  40. {
  41. return String.format("%s - %s", _id, _name);
  42. }
  43. public String getName() {
  44. return _name;
  45. }
  46. public void setName(String name) {
  47. _name = name;
  48. }
  49. public List<String> getRoutes() {
  50. return _routes;
  51. }
  52. public void setRoutes(List<String> routes) {
  53. _routes = routes;
  54. }
  55. public String getId() {
  56. return _id;
  57. }
  58. public void setId(String id) {
  59. _id = id;
  60. }
  61. public double getPosX() {
  62. return _posX;
  63. }
  64. public void setPosX(double posX) {
  65. _posX = posX;
  66. }
  67. public double getPosY() {
  68. return _posY;
  69. }
  70. public void setPosY(double posY) {
  71. _posY = posY;
  72. }
  73. }