Rev 1128 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed
package org.tela_botanica.del.client.utils;
import java.util.Comparator;
import org.tela_botanica.del.client.modeles.MoyenneVote;
import org.tela_botanica.del.client.modeles.PropositionDetermination;
import org.tela_botanica.del.client.services.CalculVoteDeterminationService;
public class ComparateurPropositionDetermination implements Comparator<PropositionDetermination> {
@Override
public int compare(PropositionDetermination proposition1, PropositionDetermination proposition2) {
MoyenneVote moyenneP1 = CalculVoteDeterminationService.calculerVoteDetermination(proposition1);
int scoreP1 = moyenneP1.getScore();
MoyenneVote moyenneP2 = CalculVoteDeterminationService.calculerVoteDetermination(proposition2);
int scoreP2 = moyenneP2.getScore();
int entierRetour = 0;
if (scoreP1 < scoreP2) {
entierRetour = 1;
}
return entierRetour;
}
}