|
|
@ -77,6 +77,11 @@ def me_and_right_brothers(node): |
|
|
|
yield current |
|
|
|
current = current.succ |
|
|
|
|
|
|
|
def right_brothers(node): |
|
|
|
generator = me_and_right_brothers(node.succ) |
|
|
|
for item in generator: |
|
|
|
yield item |
|
|
|
|
|
|
|
# Generátor všech sourozenců (vč. sám sebe) |
|
|
|
def all_brothers(node): |
|
|
|
# Najdeme prvního bratra |
|
|
@ -103,9 +108,12 @@ def all_children(node): |
|
|
|
## Filtrační hledání |
|
|
|
# Najdi dalšího bratra nějakého typu, nebo None. |
|
|
|
# hledá i podtřídy, i.e. get_next_brother_of_type(neco, TreeNode) je prostě succ. |
|
|
|
def get_next_brother_of_type(current, type): |
|
|
|
pass |
|
|
|
def get_prev_brother_of_type(current, type): |
|
|
|
def get_next_brother_of_type(node, type): |
|
|
|
for current in right_brothers(node) |
|
|
|
if isinstance(current, type): |
|
|
|
return current |
|
|
|
|
|
|
|
def get_prev_brother_of_type(node, type): |
|
|
|
pass |
|
|
|
|
|
|
|
# Totéž pro "the-right-order" pořadí |
|
|
|