Ejemplo n.º 1
0
        /// <summary>
        /// Add a child node to the current node.
        /// Update this node's voter list to include any new voters from the child.
        /// </summary>
        /// <param name="text">Text of the child node.</param>
        /// <param name="voters">Voters for the child node.</param>
        public void AddChild(string text, HashSet <string> voters)
        {
            VoteNode child = new VoteNode(text, voters, this);

            Children.Add(child);
            AllVoters.UnionWith(child.Voters);
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Add new voters to this node's voter list.
 /// </summary>
 /// <param name="voters">Voters to add.</param>
 public void AddVoters(HashSet <string> voters)
 {
     if (voters != null)
     {
         Voters.UnionWith(voters);
         AllVoters.UnionWith(voters);
     }
 }
Ejemplo n.º 3
0
        /// <summary>
        /// Add a child node to the current node.
        /// Update this node's voter list to include any new voters from the child.
        /// </summary>
        /// <param name="text">Text of the child node.</param>
        /// <param name="voters">Voters for the child node.</param>
        public void AddChild(string text, HashSet <string> voters)
        {
            VoteNode child = Children.FirstOrDefault(c => Agnostic.StringComparer.Equals(c.Text, text));

            if (child == null)
            {
                child = new VoteNode(text, voters, this);
                Children.Add(child);
            }
            else
            {
                child.AddVoters(voters);
            }

            AllVoters.UnionWith(child.Voters);
        }