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
|
public class CandidatInscritParScoreHarmonisationComparator implements Comparator
{
/**
*
*/
public int compare(Object arg0, Object arg1)
{
CandidatInscritEtape c0 = (CandidatInscritEtape) arg0;
CandidatInscritEtape c1 = (CandidatInscritEtape) arg1;
double d = c1.getScoreApresEtapeHarmonisation() - c2.getScoreApresEtapeHarmonisation();
if (d < 0) return +1;
if (d > 0) return -1;
if (d == 0)
{
double[] scorePondere1 = c1.calculerScoreParPonderationHarmonisation();
double[] scorePondere2 = c2.calculerScoreParPonderationHarmonisation();
// on compare les notes pondérées, par prédominance.
for ( int i = 1; i < 5; i++ )
{
if (scorePondere1[i] - scorePondere2[2] < 0) return +1;
if (scorePondere1[i] - scorePondere2[2] > 0) return -1;
}
}
return 0;
}
}
} |