예제 #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);
        }
예제 #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);
        }