https://github.com/google/google-java-format/releases/pull/14/head^2 0.3.0
parent
85e0c3e419
commit
2f6ed8b6cc
@ -1,23 +1,18 @@
|
||||
package fr.mieuxvoter.mj;
|
||||
|
||||
|
||||
/**
|
||||
* A Deliberator takes in a poll's Tally,
|
||||
* which holds the amount of judgments of each grade received by each Proposal,
|
||||
* and outputs that poll's Result, that is the final rank of each Proposal.
|
||||
* A Deliberator takes in a poll's Tally, which holds the amount of judgments of each grade received
|
||||
* by each Proposal, and outputs that poll's Result, that is the final rank of each Proposal.
|
||||
*
|
||||
* Ranks start at 1 ("best"), and increment towards "worst".
|
||||
* Two proposal may share the same rank, in extreme equality cases.
|
||||
* <p>Ranks start at 1 ("best"), and increment towards "worst". Two proposal may share the same
|
||||
* rank, in extreme equality cases.
|
||||
*
|
||||
* This is the main API of this library.
|
||||
* <p>This is the main API of this library.
|
||||
*
|
||||
* See MajorityJudgmentDeliberator for an implementation.
|
||||
* One could implement other deliberators, such as:
|
||||
* - CentralJudgmentDeliberator
|
||||
* - UsualJudgmentDeliberator
|
||||
* <p>See MajorityJudgmentDeliberator for an implementation. One could implement other deliberators,
|
||||
* such as: - CentralJudgmentDeliberator - UsualJudgmentDeliberator
|
||||
*/
|
||||
public interface DeliberatorInterface {
|
||||
|
||||
public ResultInterface deliberate(TallyInterface tally) throws InvalidTallyException;
|
||||
|
||||
public ResultInterface deliberate(TallyInterface tally) throws InvalidTallyException;
|
||||
}
|
||||
|
@ -1,19 +1,13 @@
|
||||
package fr.mieuxvoter.mj;
|
||||
|
||||
/**
|
||||
* Raised when the provided tally holds negative values, or infinity.
|
||||
*/
|
||||
/** Raised when the provided tally holds negative values, or infinity. */
|
||||
class IncoherentTallyException extends InvalidTallyException {
|
||||
|
||||
private static final long serialVersionUID = 5858986651601202903L;
|
||||
|
||||
@Override
|
||||
public String getMessage() {
|
||||
return (
|
||||
"The provided tally holds negative values, or infinity. "
|
||||
+
|
||||
(null == super.getMessage() ? "" : super.getMessage())
|
||||
);
|
||||
}
|
||||
private static final long serialVersionUID = 5858986651601202903L;
|
||||
|
||||
@Override
|
||||
public String getMessage() {
|
||||
return ("The provided tally holds negative values, or infinity. "
|
||||
+ (null == super.getMessage() ? "" : super.getMessage()));
|
||||
}
|
||||
}
|
@ -1,36 +1,34 @@
|
||||
package fr.mieuxvoter.mj;
|
||||
|
||||
|
||||
public class ProposalResult implements ProposalResultInterface {
|
||||
|
||||
protected Integer rank;
|
||||
|
||||
protected String score;
|
||||
protected Integer rank;
|
||||
|
||||
protected ProposalTallyAnalysis analysis;
|
||||
protected String score;
|
||||
|
||||
public Integer getRank() {
|
||||
return rank;
|
||||
}
|
||||
protected ProposalTallyAnalysis analysis;
|
||||
|
||||
public void setRank(Integer rank) {
|
||||
this.rank = rank;
|
||||
}
|
||||
public Integer getRank() {
|
||||
return rank;
|
||||
}
|
||||
|
||||
public String getScore() {
|
||||
return score;
|
||||
}
|
||||
public void setRank(Integer rank) {
|
||||
this.rank = rank;
|
||||
}
|
||||
|
||||
public void setScore(String score) {
|
||||
this.score = score;
|
||||
}
|
||||
public String getScore() {
|
||||
return score;
|
||||
}
|
||||
|
||||
public ProposalTallyAnalysis getAnalysis() {
|
||||
return analysis;
|
||||
}
|
||||
public void setScore(String score) {
|
||||
this.score = score;
|
||||
}
|
||||
|
||||
public void setAnalysis(ProposalTallyAnalysis analysis) {
|
||||
this.analysis = analysis;
|
||||
}
|
||||
public ProposalTallyAnalysis getAnalysis() {
|
||||
return analysis;
|
||||
}
|
||||
|
||||
public void setAnalysis(ProposalTallyAnalysis analysis) {
|
||||
this.analysis = analysis;
|
||||
}
|
||||
}
|
||||
|
@ -1,27 +1,21 @@
|
||||
package fr.mieuxvoter.mj;
|
||||
|
||||
|
||||
public interface ProposalResultInterface {
|
||||
|
||||
/**
|
||||
* Rank starts at 1 ("best" proposal), and goes upwards.
|
||||
* Multiple Proposals may receive the same rank,
|
||||
* in the extreme case where they received the exact same judgments,
|
||||
* or the same judgment repartition in normalized tallies.
|
||||
*/
|
||||
public Integer getRank();
|
||||
|
||||
/**
|
||||
* This score was used to compute the rank.
|
||||
* It is made of integer characters, with zeroes for padding.
|
||||
* Inverse lexicographical order: "higher" is "better".
|
||||
* You're probably never going to need this, but it's here anyway.
|
||||
*/
|
||||
public String getScore();
|
||||
/**
|
||||
* Rank starts at 1 ("best" proposal), and goes upwards. Multiple Proposals may receive the same
|
||||
* rank, in the extreme case where they received the exact same judgments, or the same judgment
|
||||
* repartition in normalized tallies.
|
||||
*/
|
||||
public Integer getRank();
|
||||
|
||||
/**
|
||||
* Get more data about the proposal tally, such as the median grade.
|
||||
*/
|
||||
public ProposalTallyAnalysis getAnalysis();
|
||||
/**
|
||||
* This score was used to compute the rank. It is made of integer characters, with zeroes for
|
||||
* padding. Inverse lexicographical order: "higher" is "better". You're probably never going to
|
||||
* need this, but it's here anyway.
|
||||
*/
|
||||
public String getScore();
|
||||
|
||||
/** Get more data about the proposal tally, such as the median grade. */
|
||||
public ProposalTallyAnalysis getAnalysis();
|
||||
}
|
||||
|
@ -1,21 +1,20 @@
|
||||
package fr.mieuxvoter.mj;
|
||||
|
||||
/**
|
||||
* Raised when the provided tally does not hold the same amount of judgments
|
||||
* for each proposal, and normalization is required.
|
||||
* Raised when the provided tally does not hold the same amount of judgments for each proposal, and
|
||||
* normalization is required.
|
||||
*/
|
||||
class UnbalancedTallyException extends InvalidTallyException {
|
||||
|
||||
private static final long serialVersionUID = 5041093000505081735L;
|
||||
private static final long serialVersionUID = 5041093000505081735L;
|
||||
|
||||
@Override
|
||||
public String getMessage() {
|
||||
return (
|
||||
"The provided tally is unbalanced, " +
|
||||
"as some proposals received more judgments than others. \n" +
|
||||
"You need to set a strategy for balancing tallies. To that effect, \n" +
|
||||
"you may use StaticDefaultTally, MedianDefaultTally, or NormalizedTally instead of Tally. \n" +
|
||||
(null == super.getMessage() ? "" : super.getMessage())
|
||||
);
|
||||
}
|
||||
@Override
|
||||
public String getMessage() {
|
||||
return ("The provided tally is unbalanced, as some proposals received more judgments than"
|
||||
+ " others. \n"
|
||||
+ "You need to set a strategy for balancing tallies. To that effect, \n"
|
||||
+ "you may use StaticDefaultTally, MedianDefaultTally, or NormalizedTally"
|
||||
+ " instead of Tally. \n"
|
||||
+ (null == super.getMessage() ? "" : super.getMessage()));
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in new issue