| 120 | * route. |
| 121 | */ |
| 122 | class Node |
| 123 | { |
| 124 | friend class Route; |
| 125 | |
| 126 | size_t loc_; // Location represented by this node |
| 127 | size_t idx_; // Position in the route |
| 128 | size_t trip_; // Trip index. |
| 129 | Route *route_; // Indicates membership of a route, if any |
| 130 | |
| 131 | public: |
| 132 | Node(size_t loc); |
| 133 | |
| 134 | /** |
| 135 | * Returns the location represented by this node. |
| 136 | */ |
| 137 | [[nodiscard]] inline size_t client() const; // TODO rename to loc |
| 138 | |
| 139 | /** |
| 140 | * Returns this node's position in a route. This value is ``0`` when |
| 141 | * the node is *not* in a route. |
| 142 | */ |
| 143 | [[nodiscard]] inline size_t idx() const; |
| 144 | |
| 145 | /** |
| 146 | * Returns this node's assigned trip number. This value is ``0`` when |
| 147 | * the node is *not* in a route. |
| 148 | */ |
| 149 | [[nodiscard]] inline size_t trip() const; |
| 150 | |
| 151 | /** |
| 152 | * Returns the route this node is currently in. If the node is not in |
| 153 | * a route, this returns ``None`` (C++: ``nullptr``). |
| 154 | */ |
| 155 | [[nodiscard]] inline Route *route() const; |
| 156 | |
| 157 | /** |
| 158 | * Returns whether this node is a depot. |
| 159 | */ |
| 160 | [[nodiscard]] inline bool isDepot() const; |
| 161 | |
| 162 | /** |
| 163 | * Returns whether this node is a start depot. |
| 164 | */ |
| 165 | [[nodiscard]] inline bool isStartDepot() const; |
| 166 | |
| 167 | /** |
| 168 | * Returns whether this node is an end depot. |
| 169 | */ |
| 170 | [[nodiscard]] inline bool isEndDepot() const; |
| 171 | |
| 172 | /** |
| 173 | * Returns whether this node is a reload depot. |
| 174 | */ |
| 175 | [[nodiscard]] inline bool isReloadDepot() const; |
| 176 | |
| 177 | /** |
| 178 | * Assigns the node to the given route, at the given index, in the |
| 179 | * given trip. |
no outgoing calls