示例#1
0
        public void DelegateVote(IVoter fromWhom, IVoter toWhom)
        {
            FindVoterResult voterResult = findVoter(fromWhom);

            if (voterResult.IsFound)
            {
                voterResult.VoterItem.DelegateToVoter = toWhom;
            }
            else
            {
                fromWhom.DelegateToVoter = toWhom;
                AddVoter(fromWhom);
            }
        }
示例#2
0
        bool AreVotesInvalidForVoter(IVoter voter)
        {
            HashSet <IVoter> uniqueVoters = new HashSet <IVoter>();
            FindVoterResult  voterResult  = findVoter(voter);

            while (voterResult.IsFound)
            {
                if (uniqueVoters.Contains(voterResult.VoterItem))
                {
                    return(true);
                }
                uniqueVoters.Add(voterResult.VoterItem);
                voterResult = findVoter(voterResult.VoterItem.DelegateToVoter);
            }
            return(false);
        }