-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathIndexeMap.h
41 lines (35 loc) · 917 Bytes
/
IndexeMap.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
#ifndef INDEXEMAP_H_INCLUDED
#define INDEXEMAP_H_INCLUDED
#include "Indexe.h"
#include <unordered_map>
#include "Stat.h"
#include <vector>
class IndexeMap:public Indexe{
public:
unordered_map<int,Stat> Data;
void addStats(vector<Stat> data) ;
vector<Stat> getStats(string word) ;
vector<Stat> getAllStats();
};
void IndexeMap::addStats(vector<Stat> data){
for (Stat stat:data){
Data[Data.size()] = stat;
}
}
vector<Stat> IndexeMap::getStats(string word){
vector<Stat> resultat;
for(auto it = Data.begin();it!=Data.end();++it){
if(it->second.mot == word){
resultat.push_back(it->second);
}
}
return resultat;
}
vector<Stat> IndexeMap::getAllStats(){
vector<Stat> resultat;
for (auto it = Data.cbegin();it!=Data.end();++it){
resultat.push_back(it->second);
}
return resultat;
}
#endif // INDEXEMAP_H_INCLUDED