Subversion Repositories eFlore/Applications.del

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
1127 gduche 1
package org.tela_botanica.del.client.utils;
2
 
3
import java.util.Comparator;
4
 
5
import org.tela_botanica.del.client.modeles.MoyenneVote;
6
import org.tela_botanica.del.client.modeles.PropositionDetermination;
7
import org.tela_botanica.del.client.services.CalculVoteDeterminationService;
8
 
9
public class ComparateurPropositionDetermination implements Comparator<PropositionDetermination> {
10
 
11
	@Override
12
	public int compare(PropositionDetermination proposition1, PropositionDetermination proposition2) {
13
		MoyenneVote moyenneP1 = CalculVoteDeterminationService.calculerVoteDetermination(proposition1);
14
		int scoreP1 = moyenneP1.getScore();
15
 
16
		MoyenneVote moyenneP2 = CalculVoteDeterminationService.calculerVoteDetermination(proposition2);
17
		int scoreP2 = moyenneP2.getScore();
18
 
19
		int entierRetour = 0;
20
		if (scoreP1 < scoreP2) {
21
			entierRetour = 1;
22
		}
23
		return entierRetour;
24
	}
25
 
26
}