Use GNU Smalltalk syntax -- it seems more Emacs-friendly.
"
-Object subclass: Node [
+Object subclass: BasicNode [
+ <comment: 'I am provide common behaviour for my subclasses Node and
+LeafNode. Otherwise, I''m not particularly interesting.'>
+
+ iterator [
+ "Return a new iterator to walk this node."
+
+ <category: 'iteration'>
+ ^NodeIterator for: self
+ ]
+]
+
+BasicNode subclass: Node [
| left right data |
<comment: 'I represent simple binary tree nodes. My instances consist of
^false
]
- iterator [
- "Answer a new iterator to walk this node."
-
- <category: 'iteration'>
- ^NodeIterator for: self
- ]
-
inorderTell: aBlock tell: aNodeIterator [
"This is the hairy part of the iteration protocol.
]
]
-Object subclass: LeafNode [
+BasicNode subclass: LeafNode [
<comment: 'I represent the leaves of a tree of Nodes. I don''t hold any
kind of interesting state. My methods provide the base cases for some of the
recursive protocols used to handle Nodes.'>
^true
]
- iterator [
- "Return a new iterator to walk this node."
-
- <category: 'iteration'>
- ^NodeIterator for: self
- ]
-
inorderTell: aBlock tell: aNodeIterator [
"This is the hairy part of the iteration protocol.