Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
c6454b52
R
roslyn
项目概览
lwm1986
/
roslyn
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
roslyn
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
c6454b52
编写于
6月 23, 2015
作者:
C
Cyrus Najmabadi
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
PR feedback.
上级
ac100a62
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
0 addition
and
65 deletion
+0
-65
src/EditorFeatures/Test/Collections/IntervalTreeTests.cs
src/EditorFeatures/Test/Collections/IntervalTreeTests.cs
+0
-38
src/Workspaces/Core/Portable/Shared/Collections/IntervalTree`1.cs
...spaces/Core/Portable/Shared/Collections/IntervalTree`1.cs
+0
-27
未找到文件。
src/EditorFeatures/Test/Collections/IntervalTreeTests.cs
浏览文件 @
c6454b52
...
...
@@ -153,44 +153,6 @@ public void TestOverlappingStart()
}
}
[
Fact
]
public
void
TestRightRotation
()
{
var
nodes
=
new
[]
{
Tuple
.
Create
(
8
,
1
,
"a"
),
Tuple
.
Create
(
10
,
1
,
"b"
),
Tuple
.
Create
(
4
,
1
,
"c"
),
Tuple
.
Create
(
6
,
1
,
"d"
),
Tuple
.
Create
(
0
,
1
,
"e"
),
Tuple
.
Create
(
2
,
1
,
"f"
)
};
foreach
(
var
tree
in
CreateTrees
(
nodes
))
{
Assert
.
True
(
tree
.
GetPreOrder
().
Select
(
t
=>
t
.
Item3
).
SequenceEqual
(
List
(
"c"
,
"e"
,
"f"
,
"a"
,
"d"
,
"b"
)));
}
}
[
Fact
]
public
void
InnerLeftOuterRightRotation
()
{
var
nodes
=
new
[]
{
Tuple
.
Create
(
8
,
1
,
"a"
),
Tuple
.
Create
(
10
,
1
,
"b"
),
Tuple
.
Create
(
2
,
1
,
"c"
),
Tuple
.
Create
(
0
,
1
,
"e"
),
Tuple
.
Create
(
4
,
1
,
"d"
),
Tuple
.
Create
(
6
,
1
,
"f"
)
};
foreach
(
var
tree
in
CreateTrees
(
nodes
))
{
Assert
.
True
(
tree
.
GetPreOrder
().
Select
(
t
=>
t
.
Item3
).
SequenceEqual
(
List
(
"d"
,
"c"
,
"e"
,
"a"
,
"f"
,
"b"
)));
}
}
[
Fact
]
public
void
TestOverlappingEnd
()
{
...
...
src/Workspaces/Core/Portable/Shared/Collections/IntervalTree`1.cs
浏览文件 @
c6454b52
...
...
@@ -17,7 +17,6 @@ internal partial class IntervalTree<T> : IEnumerable<T>
public
static
readonly
IntervalTree
<
T
>
Empty
=
new
IntervalTree
<
T
>();
protected
Node
root
;
private
readonly
int
count
;
private
delegate
bool
TestInterval
(
T
value
,
int
start
,
int
length
,
IIntervalIntrospector
<
T
>
introspector
);
private
static
readonly
TestInterval
s_intersectsWithTest
=
IntersectsWith
;
...
...
@@ -37,13 +36,10 @@ public IntervalTree()
public
IntervalTree
(
IIntervalIntrospector
<
T
>
introspector
,
IEnumerable
<
T
>
values
)
:
this
(
root
:
null
)
{
var
count
=
0
;
foreach
(
var
value
in
values
)
{
root
=
Insert
(
root
,
new
Node
(
introspector
,
value
),
introspector
,
inPlace
:
true
);
count
++;
}
this
.
count
=
count
;
}
protected
static
bool
Contains
(
T
value
,
int
start
,
int
length
,
IIntervalIntrospector
<
T
>
introspector
)
...
...
@@ -339,29 +335,6 @@ public IEnumerator<T> GetEnumerator()
}
}
// For testing purposes only. Allows a test to verify the actual AVL structure of the tree.
internal
IEnumerable
<
T
>
GetPreOrder
()
{
if
(
root
==
null
)
{
yield
break
;
}
// The bool indicates if this is the first time we are seeing the node.
var
candidates
=
new
Stack
<
Node
>();
candidates
.
Push
(
root
);
while
(
candidates
.
Count
!=
0
)
{
var
currentNode
=
candidates
.
Pop
();
if
(
currentNode
!=
null
)
{
candidates
.
Push
(
currentNode
.
Right
);
candidates
.
Push
(
currentNode
.
Left
);
yield
return
currentNode
.
Value
;
}
}
}
IEnumerator
IEnumerable
.
GetEnumerator
()
{
return
this
.
GetEnumerator
();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录