Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
W
wendelin.core
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
Kirill Smelkov
wendelin.core
Commits
e3e6a8e4
Commit
e3e6a8e4
authored
May 12, 2020
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
477429b3
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
11 deletions
+17
-11
wcfs/internal/xbtree.py
wcfs/internal/xbtree.py
+17
-11
No files found.
wcfs/internal/xbtree.py
View file @
e3e6a8e4
...
...
@@ -132,6 +132,7 @@ class Tree(object):
__repr__
=
__str__
# copy returns a deep copy of the tree.
def
copy
(
t
):
return
Tree
(
t
.
keyv
,
*
[
_
.
copy
()
for
_
in
t
.
children
])
...
...
@@ -225,23 +226,28 @@ def Restructure(ztree, newStructure):
# D(A,B) = ────────────── + ──────────────
# N(A) N(B)
#
# we will modify nodes from new set:
# - node.Z will point to associated znode
# - bucket.next_bucket will point to bucket that is coming next in the tree
tnew
=
newStructure
.
copy
()
zlevelv
=
list
(
_zwalkBFS
(
ztree
))
levelv
=
list
(
_walkBFS
(
tnew
))
# assotiate every node in tnew to a znode
# XXX check for end
zlevel
=
zlevelv
.
pop
(
0
)
level
=
levelv
.
pop
(
0
)
if
len
(
zlevel
)
==
len
(
level
):
# map 1-1
for
(
znode
,
node
)
in
zip
(
zlevel
,
level
):
node
.
Z
=
znode
else
:
panic
(
"TODO"
)
while
len
(
levelv
)
>
0
:
# XXX check for end
level
=
levelv
.
pop
(
0
)
if
len
(
zlevelv
)
==
0
:
panic
(
"TODO"
)
zlevel
=
zlevelv
.
pop
(
0
)
if
len
(
zlevel
)
==
len
(
level
):
# map 1-1
for
(
znode
,
node
)
in
zip
(
zlevel
,
level
):
node
.
Z
=
znode
else
:
panic
(
"TODO"
)
# set znode states according to established tnew->znode association
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment