| myTree | myTree := Tree new. myTree content: 'I am the parent.'. "Put this string in info of root" myTree addNode: Tree new. "Put a subtree beneath the root" myTree first content: #(1 2 3). "Content of subtree root is array" myTree addNode: Tree new. "Another subtree" (myTree at: 2) content: 34.5. "Put float as content at root of second subtree." myTree display. "Display the tree graphically, printString of each content at the node, lines from roots to subtrees"
Message | Meaning |
content: | Set content for tree |
addNode: | Add subtree at end of list |
first | Return first subtree |
last | Return last subtree |
at: | Return subtree at given index |
display | Display tree graphically on a white space starting at 0@0 extending to 300@300 |
CHANGES: TURNIN IS FRIDAY THE 21st AT 1:00 PM IN MY OFFICE AND NO SOURCE CODE IS REQUIRED Mark Guzdial |