101 lines
2.0 KiB
C#
101 lines
2.0 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Text;
|
|
|
|
namespace KdTree
|
|
{
|
|
// Token: 0x0200000A RID: 10
|
|
[Serializable]
|
|
public class KdTreeNode<TKey, TValue>
|
|
{
|
|
// Token: 0x06000040 RID: 64 RVA: 0x00002BB3 File Offset: 0x00000DB3
|
|
public KdTreeNode()
|
|
{
|
|
}
|
|
|
|
// Token: 0x06000041 RID: 65 RVA: 0x00002BBB File Offset: 0x00000DBB
|
|
public KdTreeNode(TKey[] point, TValue value)
|
|
{
|
|
this.Point = point;
|
|
this.Value = value;
|
|
}
|
|
|
|
// Token: 0x1700000C RID: 12
|
|
internal KdTreeNode<TKey, TValue> this[int compare]
|
|
{
|
|
get
|
|
{
|
|
if (compare <= 0)
|
|
{
|
|
return this.LeftChild;
|
|
}
|
|
return this.RightChild;
|
|
}
|
|
set
|
|
{
|
|
if (compare <= 0)
|
|
{
|
|
this.LeftChild = value;
|
|
return;
|
|
}
|
|
this.RightChild = value;
|
|
}
|
|
}
|
|
|
|
// Token: 0x1700000D RID: 13
|
|
// (get) Token: 0x06000044 RID: 68 RVA: 0x00002BF9 File Offset: 0x00000DF9
|
|
public bool IsLeaf
|
|
{
|
|
get
|
|
{
|
|
return this.LeftChild == null && this.RightChild == null;
|
|
}
|
|
}
|
|
|
|
// Token: 0x06000045 RID: 69 RVA: 0x00002C0E File Offset: 0x00000E0E
|
|
public void AddDuplicate(TValue value)
|
|
{
|
|
if (this.Duplicates == null)
|
|
{
|
|
this.Duplicates = new List<TValue> { value };
|
|
return;
|
|
}
|
|
this.Duplicates.Add(value);
|
|
}
|
|
|
|
// Token: 0x06000046 RID: 70 RVA: 0x00002C38 File Offset: 0x00000E38
|
|
public override string ToString()
|
|
{
|
|
StringBuilder stringBuilder = new StringBuilder();
|
|
for (int i = 0; i < this.Point.Length; i++)
|
|
{
|
|
stringBuilder.Append(this.Point[i].ToString());
|
|
}
|
|
if (this.Value == null)
|
|
{
|
|
stringBuilder.Append("null");
|
|
}
|
|
else
|
|
{
|
|
stringBuilder.Append(this.Value.ToString());
|
|
}
|
|
return stringBuilder.ToString();
|
|
}
|
|
|
|
// Token: 0x0400000F RID: 15
|
|
public TKey[] Point;
|
|
|
|
// Token: 0x04000010 RID: 16
|
|
public TValue Value;
|
|
|
|
// Token: 0x04000011 RID: 17
|
|
public List<TValue> Duplicates;
|
|
|
|
// Token: 0x04000012 RID: 18
|
|
internal KdTreeNode<TKey, TValue> LeftChild;
|
|
|
|
// Token: 0x04000013 RID: 19
|
|
internal KdTreeNode<TKey, TValue> RightChild;
|
|
}
|
|
}
|