nouvelle version

master
parent b878e24b20
commit 7466a3fe1d

BIN
SAE2

Binary file not shown.

@ -52,8 +52,8 @@ ListeDevis del(ListeDevis l);
ListeDevis insert(ListeDevis l, Devis d);
ListeDevis newListeDevis(void);
Tache *trouverTache(Tache **tabTache, int nbTaches, char *nom);
Tache* defiler(ListeAttente *file);
Tache* defiler(ListeAttente *file);
ListeAttente* initialiserFileAttente(void);
ListeAttente* traiterTaches(Tache **tabTache);
void traiterTaches(Tache *tabTache[]);

Binary file not shown.

@ -1,35 +1,29 @@
#include "../includes/main.h"
ListeAttente* traiterTaches(Tache **tabTache)
void traiterTaches(Tache *tabTache[])
{
int i;
int dateCourante;
Tache *tacheCourante;
Tache *successeur;
Liste successeurs;
ListeAttente *file = initialiserFileAttente();
ListeAttente file;
Liste succCourant;
file.debut = 0;
file.fin = 0;
for (i = 0; i < TMAXTRAV; i++)
for (int i = 0; i < TMAXTRAV; i++)
if (tabTache[i]->nbPred == 0)
enfiler(file, tabTache[i]);
enfiler(&file, tabTache[i]);
while (!estVide(file))
// Etape courante (utilisation dune boucle)
while (!estVide(&file))
{
tacheCourante = defiler(file);
dateCourante = tacheCourante->dateDebut;
successeurs = tacheCourante->succ;
while (successeurs)
Tache *tacheActuelle = defiler(&file);
succCourant = tacheActuelle->succ;
while (succCourant)
{
successeur = trouverTache(tabTache, TMAXTRAV, successeurs->tache);
successeur->dateDebut = max(successeur->dateDebut, dateCourante + tacheCourante->duree);
Tache *successeur = trouverTache(tabTache, TMAXTRAV, succCourant->tache);
successeur->dateDebut = max(successeur->dateDebut, tacheActuelle->dateDebut + tacheActuelle->duree);
successeur->nbPred--;
if (successeur->nbPred == 0)
enfiler(file, successeur);
successeurs = successeurs->nxt;
enfiler(&file, successeur);
succCourant = succCourant->nxt;
}
}
return (file);
}

@ -151,14 +151,16 @@ ListeDevis del(ListeDevis l)
}
//file
Tache* defiler(ListeAttente *file)
Tache* defiler(ListeAttente *file)
{
Tache *tache;
if (file->debut == file->fin)
return (NULL);
if (file->debut == file->fin)
return NULL;
tache = file->tab[file->debut];
file->debut = (file->debut + 1) % TMAXTRAV;
return (tache);
}
/*---------------calculs----------------*/

Loading…
Cancel
Save