From b9cbc6e623da7ed18bd60233e940a7e791e629c8 Mon Sep 17 00:00:00 2001 From: domi41 Date: Thu, 13 May 2021 10:30:07 +0200 Subject: [PATCH] docs: add an example usage of the default grade --- README.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/README.md b/README.md index 610bf1a..9ecd279 100644 --- a/README.md +++ b/README.md @@ -55,8 +55,23 @@ Got more than 2³² judges? Use a `Long[]` in a `ProposalTally`. Got even more than that ? Use `BigInteger`s ! + +### Using a static default grade + Want to set a static default grade ? Use a `TallyWithDefaultGrade` instead of a `Tally`. +```java +Integer amountOfJudges = 18; +Integer defaultGrade = 0; // "worst" grade (usually "to reject") +TallyInterface tally = new TallyWithDefaultGrade(new ProposalTallyInterface[] { + // Amounts of judgments received of each grade, from "worst" grade to "best" grade + new ProposalTally(new Integer[]{4, 5, 2, 1, 3, 1, 2}), // Proposal A + new ProposalTally(new Integer[]{3, 6, 2, 1, 3, 1, 2}), // Proposal B + // … +}, amountOfJudges, defaultGrade); +``` + + Want to normalize the tallies ? Use a `TallyNormalized` instead of a `Tally`.