28template<
typename TCoordinate,
typename TEdge>
48 explicit SquareGrid(TCoordinate height, TCoordinate width);
61 void operator>>(
ext::ostream &ostream) const override;
69 virtual
void resize(TCoordinate height, TCoordinate width);
75 virtual
void addObstacle(TCoordinate &&x, TCoordinate &&y);
133template<typename TCoordinate, typename TEdge>
140template<
typename TCoordinate,
typename TEdge>
146template<
typename TCoordinate,
typename TEdge>
154template<
typename TCoordinate,
typename TEdge>
159template<
typename TCoordinate,
typename TEdge>
166template<
typename TCoordinate,
typename TEdge>
181 new_obstacles.insert(std::move(
i));
190template<
typename TCoordinate,
typename TEdge>
196template<
typename TCoordinate,
typename TEdge>
203template<
typename TCoordinate,
typename TEdge>
210template<
typename TCoordinate,
typename TEdge>
214 node_type v = GridFunction::squareGridDirectionVector<TCoordinate>(direction);
215 node_type tmp(n.first + v.first, n.second + v.second);
221template<
typename TCoordinate,
typename TEdge>
225 node_type v = GridFunction::squareGridDirectionVector<TCoordinate>(direction);
226 node_type tmp(n.first + v.first, n.second + v.second);
234template<
typename TCoordinate,
typename TEdge>
241template<
typename TCoordinate,
typename TEdge>
248template<
typename TCoordinate,
typename TEdge>
262 for (TCoordinate j = 0; j <
m_width; ++j) {
269 if (map.find(tmp) != map.end()) {
292template<
typename TCoordinate,
typename TEdge>
294 return coordinate.first >= 0 &&
296 coordinate.second >= 0 &&
300template<
typename TCoordinate,
typename TEdge>
303 throw std::out_of_range(
"Coordinates are out of range");
309template<
typename TCoordinate,
typename TEdge>
314template<
typename TCoordinate,
typename TEdge>
316 unsigned long cnt = 0;
328 for (TCoordinate j = 0; j <
m_width; ++j) {
331 for (
const auto &direction : directions) {
332 node_type v = GridFunction::squareGridDirectionVector<TCoordinate>(direction);
347template<
typename TCoordinate,
typename TEdge>
353 for (TCoordinate j = 0; j <
m_width; ++j) {
357 set.insert(std::move(tmp));
365template<
typename TCoordinate,
typename TEdge>
379 for (TCoordinate j = 0; j <
m_width; ++j) {
382 for (
const auto &direction : directions) {
383 node_type v = GridFunction::squareGridDirectionVector<TCoordinate>(direction);
399template<
typename TCoordinate,
typename TEdge>
414 node_type v = GridFunction::squareGridDirectionVector<TCoordinate>(direction);
418 set.insert(std::move(tmp));
425template<
typename TCoordinate,
typename TEdge>
438 node_type v = GridFunction::squareGridDirectionVector<TCoordinate>(direction);
449template<
typename TCoordinate,
typename TEdge>
455template<
typename TCoordinate,
typename TEdge>
463template<
typename TCoordinate,
typename TEdge>
465 ostream <<
"(" << this->
name() << std::endl;
475 for (TCoordinate j = 0; j <
m_width; ++j) {
Class extending the map class from the standard library. Original reason is to allow printing of the ...
Definition: map.hpp:48
Class extending the pair class from the standard library. Original reason is to allow printing of the...
Definition: pair.hpp:43
Class extending the vector class from the standard library. Original reason is to allow printing of t...
Definition: vector.hpp:45
Definition: GridInterface.hpp:20
TCoordinate coordinate_type
Definition: GridInterface.hpp:23
TEdge edge_type
Definition: GridInterface.hpp:24
virtual std::string name() const =0
Definition: SquareGrid.hpp:29
TCoordinate getHeight() const
Definition: SquareGrid.hpp:155
ext::vector< TEdge > getEdges() const override
Definition: SquareGrid.hpp:366
SquareGrid(TCoordinate height, TCoordinate width)
Definition: SquareGrid.hpp:134
size_t nodeCount() const override
Definition: SquareGrid.hpp:310
TCoordinate getWidth() const
Definition: SquareGrid.hpp:160
ext::set< node_type > predecessors(const node_type &n) const override
Definition: SquareGrid.hpp:451
size_t edgeCount() const override
Definition: SquareGrid.hpp:315
ext::set< node_type > getNodes() const override
Definition: SquareGrid.hpp:349
TCoordinate m_height
Definition: SquareGrid.hpp:41
virtual ext::pair< bool, node_type > step(const node_type &n, direction_type direction) const
Definition: SquareGrid.hpp:212
virtual bool checkCoordinates(const node_type &coordinate) const
Definition: SquareGrid.hpp:293
virtual bool isNode(const node_type &n) const
Definition: SquareGrid.hpp:242
void operator>>(ext::ostream &ostream) const override
Definition: SquareGrid.hpp:464
TCoordinate m_width
Definition: SquareGrid.hpp:42
virtual bool isValidDirection(direction_type direction) const =0
virtual void addObstacle(const node_type &n)
Definition: SquareGrid.hpp:191
ext::vector< TEdge > predecessorEdges(const node_type &n) const override
Definition: SquareGrid.hpp:457
ext::set< node_type > m_obstacles
Definition: SquareGrid.hpp:43
virtual void throwCoordinates(const node_type &coordinate) const
Definition: SquareGrid.hpp:301
ext::set< node_type > successors(const node_type &n) const override
Definition: SquareGrid.hpp:402
virtual TEdge createEdge(const node_type &a, const node_type &b) const =0
const ext::set< node_type > & getObstacleList() const &
Definition: SquareGrid.hpp:142
virtual ext::pair< bool, TEdge > stepEdge(const node_type &n, direction_type direction) const
Definition: SquareGrid.hpp:223
virtual std::string toStringAs(const ext::map< node_type, char > &map) const
Definition: SquareGrid.hpp:249
virtual bool isObstacle(const node_type &n) const
Definition: SquareGrid.hpp:235
ext::vector< TEdge > successorEdges(const node_type &n) const override
Definition: SquareGrid.hpp:427
virtual void resize(TCoordinate height, TCoordinate width)
Definition: SquareGrid.hpp:167
int i
Definition: AllEpsilonClosure.h:118
Definition: sigHandler.cpp:20
constexpr auto make_pair(T1 &&x, T2 &&y)
Definition: pair.hpp:79
Definition: GridDirection.hpp:12
const ext::set< SquareGridDirections > SQUARE_GRID_DIRECTIONS
Definition: GridDirection.hpp:28
SquareGridDirections
Definition: GridDirection.hpp:16
Definition: FordFulkerson.hpp:16