You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
39 lines
1.2 KiB
39 lines
1.2 KiB
package fr.mieuxvoter.mj;
|
|
|
|
import java.math.BigInteger;
|
|
|
|
/**
|
|
* Fill the missing judgments into the median grade.
|
|
* Useful when the proposals have not received the exact same amount of votes and
|
|
* the median grade is considered a sane default.
|
|
*/
|
|
public class MedianDefaultTally extends DefaultGradeTally implements TallyInterface {
|
|
|
|
public MedianDefaultTally(TallyInterface tally) {
|
|
super(tally.getProposalsTallies(), tally.getAmountOfJudges());
|
|
fillWithDefaultGrade();
|
|
}
|
|
|
|
public MedianDefaultTally(ProposalTallyInterface[] proposalsTallies, BigInteger amountOfJudges) {
|
|
super(proposalsTallies, amountOfJudges);
|
|
fillWithDefaultGrade();
|
|
}
|
|
|
|
public MedianDefaultTally(ProposalTallyInterface[] proposalsTallies, Long amountOfJudges) {
|
|
super(proposalsTallies, amountOfJudges);
|
|
fillWithDefaultGrade();
|
|
}
|
|
|
|
public MedianDefaultTally(ProposalTallyInterface[] proposalsTallies, Integer amountOfJudges) {
|
|
super(proposalsTallies, amountOfJudges);
|
|
fillWithDefaultGrade();
|
|
}
|
|
|
|
@Override
|
|
protected Integer getDefaultGrade(ProposalTallyInterface proposalTally) {
|
|
ProposalTallyAnalysis analysis = new ProposalTallyAnalysis(proposalTally);
|
|
return analysis.getMedianGrade();
|
|
}
|
|
|
|
}
|