提交 8038a883 编写于 作者: C Cyrus Najmabadi

Simplify Node constructor for trivial case.

上级 576c3da4
......@@ -31,7 +31,7 @@ public ContextIntervalTree(IIntervalIntrospector<T> introspector)
public void AddIntervalInPlace(T value)
{
var newNode = new Node(Introspector, value);
var newNode = new Node(value);
this.root = Insert(root, newNode, Introspector);
}
......
......@@ -18,9 +18,11 @@ protected class Node
internal int Height { get; private set; }
internal Node MaxEndNode { get; private set; }
internal Node(IIntervalIntrospector<T> introspector, T interval)
: this(introspector, interval, left: null, right: null)
internal Node(T value)
{
this.Value = value;
this.Height = 1;
this.MaxEndNode = this;
}
internal Node(IIntervalIntrospector<T> introspector, T value, Node left, Node right)
......
......@@ -31,7 +31,7 @@ public IntervalTree(IIntervalIntrospector<T> introspector, IEnumerable<T> values
{
foreach (var value in values)
{
root = Insert(root, new Node(introspector, value), introspector);
root = Insert(root, new Node(value), introspector);
}
}
......
......@@ -19,7 +19,7 @@ public SimpleIntervalTree(IIntervalIntrospector<T> introspector, IEnumerable<T>
{
foreach (var value in values)
{
root = Insert(root, new Node(introspector, value), introspector);
root = Insert(root, new Node(value), introspector);
}
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册