00001
00002
00003
00004 #ifndef ROUTEPLANNING_TRANSITPATH_H_
00005 #define ROUTEPLANNING_TRANSITPATH_H_
00006 #include <vector>
00007 #include <utility>
00008 #include "./Time.h"
00009
00010 using std::vector;
00011 using std::pair;
00012
00013 class TransitPath
00014 {
00015 public:
00016 enum PathNodeType
00017 {
00018 TRANSITNODE, ROADNODE
00019 };
00020 TransitPath(const Time& startTime);
00021
00022 void clear();
00023
00024 void reverse();
00025
00026 size_t size() const;
00027 const Time& getStartTime() const;
00028
00029 int getTransfers() const;
00030
00031 double getDurationInMinutes() const;
00032
00033 void addStation(PathNodeType type, int stationId,
00034 double latitude, double longitude,
00035 Time arrivalTime, Time departureTime,
00036 int arrivedWithTripId);
00037 PathNodeType getType(int pathNodeIndex);
00038 int getStationId(int pathNodeIndex);
00039 double getLatitude(int pathNodeIndex);
00040 double getLongitude(int pathNodeIndex);
00041 const Time& getArrivalTime(int pathNodeIndex);
00042 const Time& getDepartureTime(int pathNodeIndex);
00043 int getArrivedWithTripId(int pathNodeIndex);
00044
00045 bool isEqualTo (const TransitPath& otherPath) const;
00046
00047 bool hasSameResult (const TransitPath& otherPath) const;
00048
00049 string createDiffTo(const TransitPath& otherPath) const;
00050 string toString() const;
00051
00052 string createJSON() const;
00053
00054
00055
00056
00057
00058
00059 static pair<vector<int>, vector<int> > findDifferentPaths(
00060 const vector<TransitPath>& firstPaths,
00061 const vector<TransitPath>& secondPaths);
00062
00063
00064 static pair<vector<int>, vector<int> > findDifferentResults(
00065 const vector<TransitPath>& firstPaths,
00066 const vector<TransitPath>& secondPaths);
00067
00068 private:
00069
00070 string createDiffOrString(const TransitPath& otherPath,
00071 bool createDiff) const;
00072
00073 Time _startTime;
00074
00075
00076 struct PathNode
00077 {
00078 PathNodeType type;
00079 int stationId;
00080 double latitude;
00081 double longitude;
00082 Time arrivalTime;
00083 Time departureTime;
00084 int arrivedWithTripId;
00085 PathNode(PathNodeType type, int stationId,
00086 double latitude, double longitude,
00087 Time arrivalTime, Time departureTime,
00088 int arrivedWithTripId);
00089
00090 bool isEqualTo (const PathNode& otherPathNode) const;
00091 string createJSON() const;
00092 };
00093
00094 vector<PathNode> _pathNodes;
00095 };
00096
00097 #endif // ROUTEPLANNING_TRANSITPATH_H_