1 Image define: #AllObjectsReadStream &parents: {ReadStream}
2 &slots: {#currentObject -> Nil}.
3 "Iterates over all objects in the image, in memory order."
5 s@(Image AllObjectsReadStream traits) newOn: x
7 error: 'This must be called on the Image object.'
10 s@(Image AllObjectsReadStream traits) newOn: _@Image
15 s@(Image AllObjectsReadStream traits) reset
17 s currentObject := lobby firstObject.
21 [i AllObjectsReadStream newOn: i].
23 s@(Image AllObjectsReadStream traits) isAtEnd
25 lobby isLastObject: s currentObject
28 s@(Image AllObjectsReadStream traits) peek
30 lobby nextObjectAfter: s currentObject
33 s@(Image AllObjectsReadStream traits) next
35 s currentObject := s peek
38 Image define: #DelegatesToReadStream &parents: {Image AllObjectsReadStream}
39 &slots: {#target -> Nil}.
40 "Yields all objects in the Image delegating to the particular target object."
42 s@(Image DelegatesToReadStream traits) reset
44 s currentObject := lobby firstObjectDelegatingTo: s target.
47 s@(Image DelegatesToReadStream traits) newOn: _@Image &target: x
49 s clone `>> [target := x. reset. ]
52 s@(Image DelegatesToReadStream traits) peek
54 lobby nextObjectAfter: s currentObject delegatingTo: s target
57 s@(Image DelegatesToReadStream traits) isAtEnd
59 lobby isLastObject: s currentObject delegatingTo: s target
62 x@(Root traits) childStream
64 Image DelegatesToReadStream newOn: Image &target: x
67 Image define: #ReferrersToReadStream &parents: {Image AllObjectsReadStream}
68 &slots: {#target -> Nil}.
69 "Yields all objects in the Image referring to the particular target object."
71 s@(Image ReferrersToReadStream traits) reset
73 s currentObject := lobby firstObjectReferringTo: s target.
76 s@(Image ReferrersToReadStream traits) newOn: _@Image &target: x
78 s clone `>> [target := x. reset. ]
81 s@(Image ReferrersToReadStream traits) peek
82 "Avoids the stream itself appearing in the stream. Hopefully activations won't
83 show up in it as well..."
85 lobby nextObjectAfter: s currentObject referringTo: s target
88 s@(Image ReferrersToReadStream traits) isAtEnd
90 lobby isLastObject: s currentObject referringTo: s target
93 x@(Root traits) referrerStream
95 Image ReferrersToReadStream newOn: Image &target: x