| 2211 |
arthur |
1 |
package org.tela_botanica.del.client.modeles;
|
|
|
2 |
|
|
|
3 |
public class MoyenneVote implements Comparable<MoyenneVote> {
|
|
|
4 |
|
|
|
5 |
/**
|
|
|
6 |
* Pourcentage de personne ayant voté pour la propostion, un score de -1
|
|
|
7 |
* indique qu'aucun vote n'a été effectué;
|
|
|
8 |
*/
|
|
|
9 |
private int score = -1;
|
|
|
10 |
private String intituleAssocie;
|
|
|
11 |
private PropositionDetermination propositionAssociee;
|
|
|
12 |
|
|
|
13 |
public MoyenneVote(int score, PropositionDetermination propositionAssociee) {
|
|
|
14 |
this.score = score;
|
|
|
15 |
this.intituleAssocie = propositionAssociee.getEspece();
|
|
|
16 |
this.propositionAssociee = propositionAssociee;
|
|
|
17 |
}
|
|
|
18 |
|
|
|
19 |
public int getScore() {
|
|
|
20 |
return score;
|
|
|
21 |
}
|
|
|
22 |
|
|
|
23 |
public void setScore(int score) {
|
|
|
24 |
this.score = score;
|
|
|
25 |
}
|
|
|
26 |
|
|
|
27 |
public String getIntituleAssocie() {
|
|
|
28 |
return intituleAssocie;
|
|
|
29 |
}
|
|
|
30 |
|
|
|
31 |
public void setIntituleAssocie(String intituleAssocie) {
|
|
|
32 |
this.intituleAssocie = intituleAssocie;
|
|
|
33 |
}
|
|
|
34 |
|
|
|
35 |
public void setPropositionAssociee(PropositionDetermination propositionDetermination) {
|
|
|
36 |
this.propositionAssociee = propositionDetermination;
|
|
|
37 |
}
|
|
|
38 |
|
|
|
39 |
public PropositionDetermination getPropositionAssociee() {
|
|
|
40 |
return this.propositionAssociee;
|
|
|
41 |
}
|
|
|
42 |
|
|
|
43 |
@Override
|
|
|
44 |
public int compareTo(MoyenneVote mv) {
|
|
|
45 |
if (mv.getScore() > this.score)
|
|
|
46 |
return 1;
|
|
|
47 |
else if (mv.getScore() == this.score)
|
|
|
48 |
return 0;
|
|
|
49 |
else
|
|
|
50 |
return -1;
|
|
|
51 |
}
|
|
|
52 |
}
|