2023-10-19 23:05:11 +02:00
|
|
|
#include "../includes/Projet.hpp"
|
|
|
|
|
2023-10-26 19:08:00 +02:00
|
|
|
Projet::Projet(std::vector<Tache *, bool> taches){ taches=taches;}
|
|
|
|
|
|
|
|
Projet::Projet() {}
|
2023-10-19 23:05:11 +02:00
|
|
|
|
|
|
|
Projet::~Projet() {}
|
|
|
|
|
|
|
|
Projet::Projet(const Projet &) {}
|
|
|
|
|
|
|
|
const Projet &Projet::operator=(const Projet &src) {
|
|
|
|
if (this == &src) {
|
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
|
|
|
|
return *this;
|
|
|
|
}
|
2023-10-24 16:47:59 +02:00
|
|
|
|
|
|
|
std::pair <int, int> Projet::pick_two_random_tasks(){
|
|
|
|
int size = this->taches.size();
|
|
|
|
int rand1 = rand() % size;
|
|
|
|
int rand2 = rand() % size;
|
|
|
|
if(this->taches[rand1]->depends_from(*this->taches[rand2])) pick_two_random_tasks();
|
|
|
|
//Heritage de tache ?
|
|
|
|
int id1 = this->taches[rand1]->unique_id;
|
|
|
|
int id2 = this->taches[rand2]->unique_id;
|
|
|
|
return std::make_pair(id1, id2);
|
|
|
|
}
|
|
|
|
|
2023-10-26 19:08:00 +02:00
|
|
|
//Comment acceder à unique_id ici ?
|
|
|
|
Tache *Projet::contains(int id){
|
2023-10-24 16:47:59 +02:00
|
|
|
for(Tache *t:this->taches)
|
2023-10-26 19:08:00 +02:00
|
|
|
if(id==t->unique_id) return t;
|
2023-10-24 16:47:59 +02:00
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
2023-10-26 19:08:00 +02:00
|
|
|
//Comment acceder à taches ici ?
|
2023-10-24 16:47:59 +02:00
|
|
|
std::ostream& operator<<(std::ostream &out, Projet &x){
|
|
|
|
for(Tache *t: x.taches)
|
|
|
|
out << *t;
|
|
|
|
return out;
|
|
|
|
}
|
|
|
|
|
2023-10-26 19:08:00 +02:00
|
|
|
const std::vector<Tache *, bool> topologicalSort(){
|
|
|
|
//Recupere le calcul fait par PP_postfixe et construit son tri
|
|
|
|
//PP_postfixe(this->taches);
|
2023-10-24 16:47:59 +02:00
|
|
|
}
|
2023-10-26 19:08:00 +02:00
|
|
|
|