Skip to content

Conversation

@Artyom1363
Copy link
Owner

This is branch with code of Search module

developer - Artyom Volkov

@leshiy1295
Copy link
Collaborator

Коммит 15fad5c был отправлен после дедлайна, поэтому проверяться не будет
Но сразу же настораживает "непрохождение CI"

Comment on lines +8 to +9
virtual std::vector <BasePoint> getBasePoints() = 0;
virtual std::vector <Infrastructure> getInfrastructurePoints() = 0;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

всё ещё считаю довольно странным наличие двух разных функций для этих двух сущностей в одном месте
стоило тут реализовать абстрактную фабрику

и использование std::vector в интерфейсе - не самая лучшая идея

Comment on lines +2 to +7
#include <iostream>
#include <vector>
#include <unordered_map>
#include <unordered_set>
#include <set>
#include <optional>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

алфавитный порядок

Comment on lines +9 to +14
using std::vector;
using std::unordered_map;
using std::unordered_set;
using std::optional;
using std::set;
using std::pair;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

делать using в header-файле === делать "подлянку" будущим пользователям

public:
Dijkstra() {}

void AddDirectedEdge(const T &from, const T& to, unsigned int weight);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

это явно не задача класса Дейкстра
задача класса Дейкстра - это найти маршрут, получив граф и стартовую вершину

using std::set;
using std::pair;

template <class T>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Vertex

}
}

Search::Search(DataBase* base) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

base может быть nullptr

if (!idPointMap.count(id)) {
return optRoute;
}
dijkstraSearcher.FindRoute(id);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

непонятно, почему dijkstra жёстко зашит внутрь класса
либо нужно было "движок" передавать аргументом в метод, либо аргументом в конструктор (или через шаблонный параметр), либо решить этот вопрос через наследование, по-разному реализуя логику обхода (шаблонный метод)

std::vector<Edge> GetEdges() { return edges; }
unsigned int Size() { return edges.size(); }
void Reverse() { std::reverse(edges.begin(), edges.end()); }
iterator begin() { return links.begin(); }
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

что такое links - осталось непонятным...

Comment on lines +43 to +51
std::vector <BasePoint> graf;
std::vector <Infrastructure> infr;
std::map <std::string, std::vector <Point*> > namePointsMap;
std::map <unsigned int, Point*> idPointMap;
Dijkstra <unsigned int> dijkstraSearcher;

void createMapPoints(std::vector <Point*> points);
void initMaps();
void initDijkstra();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

почитайте про PIMPL - мы об этом рассказывали на лекциях...

}

vector <Infrastructure> fillInfrPoints() {
Infrastructure i9(9), i10(10), i11(11), i12(12), i13(13), i102(102), i103(103);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

плохие названия переменных, ещё и на одной строчке...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants