README 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. TRAFFIC – Transport Related Adapted File Format, Improved and Corrected
  2. // heavly version!!
  3. // INDEXes in memory
  4. Stops:
  5. // may not be present
  6. // full in either partial or full timetable
  7. # DONE
  8. // INDEX: Trie by words in stop_name; non-letters mark segments, double non-letter are made single, non-letters are skipped, index is lower case, all segments-to-end start from root, (eg. Pl. Bernardyński -> root->plbernardyński, root->bernardyński)
  9. # DONE
  10. // INDEX2: by stop_code -> offset
  11. # TODO
  12. // INDEX3: by coordinates:
  13. // {
  14. // code: string // OLC to 175m
  15. // stops_offsets: []uint // offstet to Stops file (bytes)
  16. // neighbours_offset: [8]uint // offstet to self (bytes)
  17. // }
  18. // => binary search position in bucket -> get bucket + 1 iteration of neighbours -> get all stops
  19. // -> on next iteration get all neighbours; return only new stops
  20. {
  21. stop_code: string # DONE
  22. stop_name: string # DONE
  23. plates: string // "603 -> Garbary, 176 -> Garbary" # DONE
  24. zone: string # DONE
  25. position: string // OLC # DONE
  26. []struct { # DONE
  27. trip_offset: uint // offset in Trips file (bytes)
  28. stop_sequence: uint
  29. }
  30. }
  31. Trips:
  32. // may not be present
  33. // full in either partial or full timetable
  34. {
  35. headsign: string # DONE
  36. line_name: string # DONE
  37. modifications: string # DONE (non-standard)
  38. departures_offset: uint // offset in Departures file to first record in trip (bytes) # DONE
  39. scheduleID: string # DONE
  40. shape // TODO type-unknown
  41. }
  42. Calendar: # DONE
  43. // may not be present
  44. // full in either
  45. // exceptions THEN regular services
  46. // find first entry that matches startDate <= today <= endDate, check weekdays (it's 0xff for exceptions)
  47. // loaded to memory
  48. {
  49. scheduleID string # DONE
  50. weekdays uint8 // boolset 0=7=sunday; 1=monday # DONE
  51. startDate string // 19721231 #DONE
  52. endDate string // -"- # DONE
  53. }
  54. Departures: # DONE
  55. // may not be present
  56. // partial in partial timetable
  57. {
  58. trip_id: string # DONE
  59. stop_sequence: uint # DONE
  60. time: uint // minutes after 0000 # DONE
  61. pickup enum {regular, none, phone, driver} # DONE
  62. dropoff enum -"- # DONE
  63. }
  64. Lines:
  65. // may not be present
  66. // full in either partial or full timetable
  67. # TODO
  68. // Binary search by line_name
  69. {
  70. line_name: string # DONE
  71. graph: ? // TODO struct // contains trip_offset, stop_sequence for each stop in graph
  72. colour_text: uint # DONE
  73. colour_bg: uint # DONE
  74. }
  75. Vehicles
  76. // may not be present
  77. // full in either partial or full timetable
  78. Vehicle {
  79. id: string # DONE
  80. capabilites: u8 # FIXME
  81. }
  82. ---
  83. Favourite
  84. stop_code + line_name + headsign
  85. => search stop -> get trips -> filter by line_name + headsign