Beispiel #1
0
 /// <summary>
 ///     Fixes parent links after deserializing a json file into a tree.
 /// </summary>
 /// <param name="root"></param>
 private static void FixParentLinks(QTreeNode <T> root)
 {
     foreach (var child in root._children)
     {
         child.Parent = root;
         FixParentLinks(child);
     }
 }
Beispiel #2
0
 /// <summary>
 ///     Inserts a QTreeNode into this node. The inserted node becomes a child of this node.
 /// </summary>
 /// <param name="child">The child node to insert</param>
 public void Insert(QTreeNode <T> child)
 {
     if (_children.Count < 4)
     {
         _children.Add(child);
         child.Parent = this;
     }
     else
     {
         throw new IndexOutOfRangeException("There are already four children in this node.");
     }
 }
Beispiel #3
0
 /// <inheritdoc />
 /// <param name="parent">The parent node</param>
 /// <param name="content">The content at this node</param>
 public QTreeNode(QTreeNode <T> parent, T content) : this(parent)
 {
     Content = content;
 }
Beispiel #4
0
 /// <summary>
 ///     Creates a new QuadTree node
 /// </summary>
 /// <param name="parent">The parent node</param>
 public QTreeNode(QTreeNode <T> parent)
 {
     Parent = parent;
 }