Exemplo n.º 1
0
		private STNode AddLastPrivate(STNode node) {
			var second = FirstChild;
			if (second == null) {
				node.Parent = This;
				node.Next = node;
				node.Prev = node;
				FirstChild = node;
			} else {
				second.AddPrevIgnoringFirstChild(node);
			}
			return node;
		}
Exemplo n.º 2
0
		private static void ToStringPrivate(
				STNode node, int depth, StringBuilder builder) {
			if (node == null) {
				return;
			}
			for (int i = 0; i < depth; i++) {
				builder.Append("  ");
			}
			builder.AppendLine(node.Value.ToString());
			foreach (var child in node.Children) {
				ToStringPrivate(child, depth + 1, builder);
			}
		}
Exemplo n.º 3
0
		public STNode AddLast(STNode node) {
			Contract.Requires(node != null);
			Contract.Requires(node.Parent == null);
			return AddLastPrivate(node);
		}
Exemplo n.º 4
0
		private STNode AddPrevIgnoringFirstChild(STNode node) {
			node.Parent = This.Parent;
			node.Next = This;
			node.Prev = Prev;
			Prev.Next = node;
			Prev = node;
			return node;
		}
Exemplo n.º 5
0
		private STNode AddFirstPrivate(STNode node) {
			AddLastPrivate(node);
			FirstChild = node;
			return node;
		}
Exemplo n.º 6
0
		public STNode AddNext(STNode node) {
			Contract.Requires(node != null);
			Contract.Requires(node.Parent == null);
			Contract.Requires(Parent != null);
			return This.Next.AddPrevIgnoringFirstChild(node);
		}
Exemplo n.º 7
0
		public STNode AddPrev(STNode node) {
			Contract.Requires(node != null);
			Contract.Requires(node.Parent == null);
			Contract.Requires(Parent != null);
			if (Parent.FirstChild == This) {
				Parent.FirstChild = node;
			}
			return AddPrevIgnoringFirstChild(node);
		}