For debugging.
(self, indent=0, tostring=False)
| 587 | return count |
| 588 | |
| 589 | def print_structure(self, indent=0, tostring=False): |
| 590 | """ |
| 591 | For debugging. |
| 592 | """ |
| 593 | nl = '\n' |
| 594 | sp = indent * ' ' |
| 595 | |
| 596 | rlist = [str(self) + nl] |
| 597 | if self.s_center: |
| 598 | for iv in sorted(self.s_center): |
| 599 | rlist.append(sp + ' ' + repr(iv) + nl) |
| 600 | if self.left_node: |
| 601 | rlist.append(sp + '<: ') # no CR |
| 602 | rlist.append(self.left_node.print_structure(indent + 1, True)) |
| 603 | if self.right_node: |
| 604 | rlist.append(sp + '>: ') # no CR |
| 605 | rlist.append(self.right_node.print_structure(indent + 1, True)) |
| 606 | result = ''.join(rlist) |
| 607 | if tostring: |
| 608 | return result |
| 609 | else: |
| 610 | print(result) |
no outgoing calls