Skip to content

Commit

Permalink
Resolving live elements in exploriants resets multiverse
Browse files Browse the repository at this point in the history
  • Loading branch information
JoeAtHPI committed Jan 18, 2024
1 parent 1eec393 commit 8d83232
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 3 deletions.
2 changes: 1 addition & 1 deletion packages/Sandblocks-Babylonian/SBExploriantsView.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ SBExploriantsView >> multiverse [
SBExploriantsView >> multiverse: aSBMultiverse [

multiverse := aSBMultiverse.
multiverse when: #initialized send: #visualize to: self.
multiverse when: #updated send: #visualize to: self.
]

{ #category : #building }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@ SBInactiveExampleWatch class >> newFromWatch: anActiveWatch [
yourself
]

{ #category : #'event handling' }
SBInactiveExampleWatch class >> registerWatch: aWatch [

"we do not want the inactive watches in the registry"
]

{ #category : #callbacks }
SBInactiveExampleWatch >> artefactSaved: aBlock [

Expand Down
19 changes: 17 additions & 2 deletions packages/Sandblocks-Babylonian/SBMultiverse.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -148,11 +148,24 @@ SBMultiverse >> initialize [
activeExamples do: #runSynchronouslyIgnoreReturn.
universes add: (self createUniverseFomPermutation: aPermutation)].
self resetWatchesToOriginalPermutationRunning: activeExamples.
self triggerEvent: #initialized] forkAt: Processor userSchedulingPriority.
self triggerEvent: #updated] forkAt: Processor userSchedulingPriority.


]

{ #category : #actions }
SBMultiverse >> reset [

allMethodBlocksContainingVariants := OrderedCollection new.
allMethodBlocksContainingWatches := OrderedCollection new.
variants := OrderedCollection new.
activeExamples := OrderedCollection new.
universes := OrderedCollection withAll: ((SBPermutation allPermutationsOf: {})
collect: [:aPermutation | self createUniverseFomPermutation: aPermutation]) .

self triggerEvent: #updated.
]

{ #category : #state }
SBMultiverse >> resetWatchesToOriginalPermutationRunning: activeExamples [

Expand All @@ -170,9 +183,11 @@ SBMultiverse >> resolve [
self saveMethod: aVariantMethod].

(self findExistingOrConvertToBlocks: self allCompiledMethodsContainingExampleWatches) do: [:aWatchMethod |
aWatchMethod containedExampleWatches do: #replaceWithWatchedExpression.
aWatchMethod containedExampleWatches do: #replaceWithWatchedExpression.
self saveMethod: aWatchMethod].

self reset.

]

{ #category : #accessing }
Expand Down

0 comments on commit 8d83232

Please sign in to comment.