T_Cyjb_Collections_TripleArrayCompress_2 - CYJB/Cyjb GitHub Wiki
提供三数组压缩能力。
System.Object
Cyjb.Collections.TripleArrayCompress(TCur, TNext)
Cyjb.Collections.TripleArrayCompress(T)
Namespace: Cyjb.Collections
Assembly: Cyjb (in Cyjb.dll) Version: 1.0.23+7750dd8e971297c5fa962a3bee37fb78f72793f6
C#
public class TripleArrayCompress<TCur, TNext>
- TCur
- 当前节点的类型。
- TNext
- 下一节点的类型。
名称 | 说明 | |
---|---|---|
![]() |
TripleArrayCompress(TCur, TNext) | 使用表示无效的节点值初始化 TripleArrayCompress(T) 类的新实例。 |
名称 | 说明 | |
---|---|---|
![]() |
Check | 获取状态检查列表。 |
![]() |
Next | 获取子节点列表。 |
名称 | 说明 | |
---|---|---|
![]() |
AddNode | 添加指定的节点。 |
![]() |
Equals | Determines whether the specified object is equal to the current object. (继承自 Object。) |
![]() |
Finalize | Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (继承自 Object。) |
![]() |
GetHashCode | Serves as the default hash function. (继承自 Object。) |
![]() |
GetType | Gets the Type of the current instance. (继承自 Object。) |
![]() |
MemberwiseClone | Creates a shallow copy of the current Object. (继承自 Object。) |
![]() |
ToString | Returns a string that represents the current object. (继承自 Object。) |
三数组压缩一般用于压缩存储树/图的子节点,通过将到子节点的转移压缩到 base + next + check 三个数组内,在保持性能基本不变的前提下充分利用转移间的空格来减少内存使用。 假设使用 node[id]
来表示 id
对应的子节点,使用三数组表示时,若 base[node]
在 check
范围内,且 check[base[node] + id] == node
,那么 node[id] = next[base[node] + id]
;否则不存在 node[id]
。
要求下一节点的 key 不能重复,且子节点的索引必须大于等于零。