浏览代码

fix splay tree

/main
siyao 3 年前
当前提交
6ea29062
共有 3 个文件被更改,包括 13 次插入13 次删除
  1. 8
      com.unity.uiwidgets/Runtime/codegen/TileContainerRenderObjectMixin.mixin.gen.cs
  2. 14
      com.unity.uiwidgets/Runtime/codegen/TileContainerRenderObjectMixin.mixin.njk
  3. 4
      com.unity.uiwidgets/Runtime/external/SplayTree.cs

8
com.unity.uiwidgets/Runtime/codegen/TileContainerRenderObjectMixin.mixin.gen.cs


{
D.assert(() =>
{
if (child is ChildType)
if (!(child is ChildType))
{
throw new UIWidgetsError(
"A $runtimeType expected a child of type $ChildType but received a " +

throw new ArgumentException($"index {index}");
}
_removeChild(_childRenderObjects[index]);
_removeChild(_childRenderObjects.getOrDefault(index, null));
adoptChild(value);
_childRenderObjects[index] = value;
}

public override void attach(object owner)
{
// base.attach(owner);
base.attach(owner);
// base.detach();
base.detach();
_childRenderObjects.Values.ToList().ForEach((child) => child.detach());
}

14
com.unity.uiwidgets/Runtime/codegen/TileContainerRenderObjectMixin.mixin.njk


SplayTree<int, ChildType> _childRenderObjects = new SplayTree<int, ChildType>();
/// The number of children.
private int childCount
protected int childCount
ICollection<ChildType> children
protected ICollection<ChildType> children
ICollection<int> indices
protected ICollection<int> indices
{
get => _childRenderObjects.Keys;
}

{
D.assert(() =>
{
if (child is ChildType)
if (!(child is ChildType))
{
throw new UIWidgetsError(
"A $runtimeType expected a child of type $ChildType but received a " +

throw new ArgumentException($"index {index}");
}
_removeChild(_childRenderObjects[index]);
_removeChild(_childRenderObjects.getOrDefault(index, null));
adoptChild(value);
_childRenderObjects[index] = value;
}

public override void attach(object owner)
{
// base.attach(owner);
base.attach(owner);
// base.detach();
base.detach();
_childRenderObjects.Values.ToList().ForEach((child) => child.detach());
}

4
com.unity.uiwidgets/Runtime/external/SplayTree.cs


if (key == null) throw new Exception("should input null");
if (root == null) throw new Exception("root is null");
int comp = Splay(key);
if (comp < 0) return root.Key;
if (comp > 0) return root.Key;
SplayTreeNode node = root.LeftChild;
if (node == null) throw new Exception("does not exist");
while (node.RightChild != null) {

if (key == null) throw new Exception("should input null");
if (root == null) throw new Exception("root is null");
int comp = Splay(key);
if (comp > 0) return root.Key;
if (comp < 0) return root.Key;
SplayTreeNode node = root.LeftChild;
if (node == null) throw new Exception("does not exist");
while (node.LeftChild != null) {

正在加载...
取消
保存