-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSolverToSearcherAdapter.h
57 lines (46 loc) · 1.63 KB
/
SolverToSearcherAdapter.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
//
// Created by t on 1/12/19.
//
#ifndef FLIGTSIMPROJ2_SOLVERTOSEARCHERADAPTER_H
#define FLIGTSIMPROJ2_SOLVERTOSEARCHERADAPTER_H
#include "Solver.h"
#include "ISearcher.h"
#include "ISearchable.h"
template<class Problem>
class SolverToSearcherAdapter : public Solver<Problem, string> {
ISearcher<Problem> *searcher;
ISearchable<Problem> *searchable;
public:
explicit SolverToSearcherAdapter(ISearcher<Problem> *searcher);
SolverToSearcherAdapter();
//void setSearchable(ISearchable<Problem> *searchable);
virtual string solve(Problem problem);
virtual string ProblemToString(Problem problem);
};
template<class Problem>
SolverToSearcherAdapter<Problem>::SolverToSearcherAdapter(ISearcher<Problem> *searcher) {
this->searcher = searcher;
this->searchable = searchable;
}
template<class Problem>
string SolverToSearcherAdapter<Problem>::solve(Problem problem) {
//todo
return this->searcher->search(*this->searchable);
//virtual State<T>* search(ISearchable<T>* searchable)=0;
}
template<class Problem>
string SolverToSearcherAdapter<Problem>::ProblemToString(Problem problem) {
return this->searchable->getStrRepresentation();
}
/*
template<class Problem, class Solution>
void SolverToSearcherAdapter<Problem, Solution>::setSearchable(ISearchable<Problem> *searchable) {
this->searchable = searchable;
}
template<class Problem, class Solution>
void SolverToSearcherAdapter<Problem, Solution>::setSearcher(ISearcher *searcher) {
this->searcher = searcher;
}*/
template<class Problem>
SolverToSearcherAdapter<Problem>::SolverToSearcherAdapter() {}
#endif //FLIGTSIMPROJ2_SOLVERTOSEARCHERADAPTER_H