String representation of a tree (parentheses form)
(self)
| 228 | stack.append(node.getLink(j)) |
| 229 | |
| 230 | def __str__(self): |
| 231 | """ String representation of a tree (parentheses form) """ |
| 232 | out, stack = [], [self.root] |
| 233 | while stack: |
| 234 | node = stack.pop() |
| 235 | if node == ')': |
| 236 | out.append(')') |
| 237 | continue |
| 238 | out.append('%s(' % str(node)) |
| 239 | stack.append(')') |
| 240 | for j in xrange(node.refcnt - 1, -1, -1): |
| 241 | stack.append(node.getLink(j)) |
| 242 | return ''.join(out) |
| 243 | |
| 244 | def __nextSucc(self, node): |
| 245 | self.lastSearchDepth += 1 |