This repository has been archived by the owner on Aug 12, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Solution.h
79 lines (65 loc) · 2.51 KB
/
Solution.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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#ifndef SOLUTION_H
#define SOLUTION_H
#include "includes.h"
class Solution{
QList<InscriptionFuture> ListePrevisions;
public :
Solution(){}
void addPrevision(InscriptionFuture pre){
ListePrevisions.append(pre);
}
QList<InscriptionFuture> getListePrevisions() const {return ListePrevisions;}
~Solution(){
ListePrevisions.clear();
}
unsigned int getNbCreditsCat(Categorie cat, QString cursus) const {
cout<<"Dans getNbCreditsCat de Solution\n";
unsigned int nbCredits=0;
for(int i=0; i<ListePrevisions.size(); i++){
cout<<"parcours de la liste des previsions\n";
if(getListePrevisions().at(i).getCursusPrincipal()==cursus){
cout<<"cursus egaux\n";
nbCredits+=getListePrevisions().at(i).getNbCreditsCatMax(cat);
cout<<"Valeur de nbCredits = <<"<<nbCredits<<"\n";
}
}
cout<<"Valeur de retour nbCredits : "<<nbCredits<<"\n";
return nbCredits;
}
unsigned int getNbCreditsCSTM(QString cursus) const {
unsigned int nbCredits=0;
for(int i=0; i<ListePrevisions.size(); i++){
if(getListePrevisions().at(i).getCursusPrincipal()==cursus)
nbCredits+=getListePrevisions().at(i).getNbCreditsCatMax(CS)+getListePrevisions().at(i).getNbCreditsCatMax(TM);
}
return nbCredits;
}
unsigned int getNbCreditsTot(QString cursus) const {
unsigned int nbCredits=0;
for(int i=0; i<ListePrevisions.size(); i++){
if(getListePrevisions().at(i).getCursusPrincipal()==cursus)
nbCredits+=getListePrevisions().at(i).getNbCreditsTotMax();
}
return nbCredits;
}
bool operator ==(Solution sol){
if(ListePrevisions.size()!=sol.getListePrevisions().size())
return false;
for(int i=0; i<ListePrevisions.size(); i++){
if(ListePrevisions.at(i)!=sol.getListePrevisions().at(i))
return false;
}
return true;
}
void afficher() const{
for(int i=0; i<getListePrevisions().size(); i++){
getListePrevisions().at(i).getSemestre()->afficher();
cout<<", "<<getListePrevisions().at(i).getCursusPrincipal().toStdString()<<" : ";
for(int j=0; j<getListePrevisions().at(i).getListUV().size(); j++){
cout<<getListePrevisions().at(i).getListUV().at(j).toStdString()<<" - ";
}
cout<<"\n";
}
}
};
#endif // SOLUTION_H