Example #1
0
        public void AddBallot(int multiplicity, params int[] orderedCandidatesIds)
        {
            if (!TryGetBallotWith(orderedCandidatesIds, out StvBallot ballot))
            {
                ballot = new StvBallot(orderedCandidatesIds);
                ballots.Add(ballot);
            }

            ballot.Add(multiplicity);
        }
Example #2
0
        private bool TryGetBallotWith(int[] orderedCandidatesIds, out StvBallot ballot)
        {
            for (int i = 0; i < ballots.Count; i++)
            {
                if (ballots[i].HasSame(orderedCandidatesIds))
                {
                    ballot = ballots[i];
                    return(true);
                }
            }

            ballot = null;
            return(false);
        }