Exemplo n.º 1
0
        //Adapted from: https://stackoverflow.com/a/8567550
        protected void PrintNode(UnbalancedTreeNode <T> other, bool last, Log log, string indent = "")
        {
            log.Write(LogLevel.Debug, indent + "+- " + string.Format("[{0}]", other.Value));
            indent += last ? "   " : "|  ";

            for (int i = 0; i < other.Children.Count; i++)
            {
                PrintNode(other.Children[i], i == other.Children.Count - 1, log, indent);
            }
        }
Exemplo n.º 2
0
 public bool Equals(UnbalancedTreeNode <T> other)
 {
     return(this.Value.Equals(other.Value));
 }
Exemplo n.º 3
0
 public void AddChild(UnbalancedTreeNode <T> child)
 {
     child.Parent = this;
     this.Children.Add(child);
 }
Exemplo n.º 4
0
 public void RemoveChild(UnbalancedTreeNode <T> child)
 {
     this.Children.Remove(child);
     child.Parent = null;
 }
Exemplo n.º 5
0
 public UnbalancedTreeNode(T value, UnbalancedTreeNode <T> parent)
 {
     this.Value    = value;
     this.Children = new List <UnbalancedTreeNode <T> >();
     this.Parent   = parent;
 }