-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathOrdonnanceurOccurence.h
34 lines (31 loc) · 981 Bytes
/
OrdonnanceurOccurence.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
#ifndef ORDONNANCEUROCCURENCE_H_INCLUDED
#define ORDONNANCEUROCCURENCE_H_INCLUDED
#include "Ordonnanceur.h"
#include <map>
#include "Indexe.h"
class OrdonnanceurOccurence:public Ordonnanceur{
public:
void ordonnancer(Indexe* ind,vector<string> req);
};
void OrdonnanceurOccurence::ordonnancer(Indexe* ind, vector<string> req){
for(string motReq: req){
cout<< motReq<<" :"<<endl;
map<string,double> resultat;
for (Stat stat:ind->getStats(motReq)){
resultat[stat.fichier] = stat.stat;
}
while(resultat.size()!=0){
int maximumInt = 0;
string maximumFichier = "";
for(auto it = resultat.begin();it!=resultat.end();++it){
if (it->second>maximumInt){
maximumInt = it->second;
maximumFichier = it->first;
}
}
cout << maximumFichier <<endl;
resultat.erase(maximumFichier);
}
}
}
#endif // ORDONNANCEUROCCURENCE_H_INCLUDED