Skip to content

Commit

Permalink
Merge pull request #140 from hpi-swa/feature/chronological-trace
Browse files Browse the repository at this point in the history
Add Traces to Exploriants
  • Loading branch information
tom95 authored Feb 15, 2024
2 parents 8db23ac + 81ada3e commit aa0bf21
Show file tree
Hide file tree
Showing 19 changed files with 464 additions and 104 deletions.
8 changes: 8 additions & 0 deletions packages/Sandblocks-Babylonian/Object.extension.st
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
Extension { #name : #Object }

{ #category : #'*Sandblocks-Babylonian' }
Object >> asSBWatchValue [

^ SBWatchValue
value: self sbSnapshot
identityHash: self identityHash
]

{ #category : #'*Sandblocks-Babylonian' }
Object class >> exampleBlock [

Expand Down
27 changes: 22 additions & 5 deletions packages/Sandblocks-Babylonian/SBCluster.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,17 @@ SBCluster >> newTopRowFrom: aCollectionOfMorphs [
(self wrapInCell: aMorph owner flexVertically: true flexHorizontally: false) borderWidth: 0])
]

{ #category : #visualisation }
SBCluster >> sortedWatchValuesFor: anExample givenWatches: aCollectionOfWatches [

| allValues |
allValues := SortedCollection sortBlock: [:a :b | a chronologicalPosition <= b chronologicalPosition].
aCollectionOfWatches exampleToDisplay at: anExample
ifPresent: [:aSBWatchView | allValues addAll: aSBWatchView watchValues ]
ifAbsent: [{}].
^ allValues
]

{ #category : #visualisation }
SBCluster >> visualize [

Expand All @@ -117,9 +128,7 @@ SBCluster >> visualize [

matrix := self buildDisplayMatrix.
(matrix rowCount < 2 or: [matrix columnCount < 2])
ifTrue:[
self addMorph: (SBOwnTextMorph new contents: 'No watches to display').
^ self].
ifTrue:[self visualizeNothingToDisplay. ^ self].

self addAllMorphsBack: {
self newTopRowFrom: (matrix atRow: 1) allButFirst. "ignore placeholder morph"
Expand All @@ -133,6 +142,13 @@ SBCluster >> visualize [
collect: [:aMorph | self wrapInCell: aMorph])}}
]

{ #category : #visualisation }
SBCluster >> visualizeNothingToDisplay [

self addMorph: (SBOwnTextMorph new contents: 'No watches to display')

]

{ #category : #helper }
SBCluster >> wrapInCell: aMorph [

Expand All @@ -151,12 +167,13 @@ SBCluster >> wrapInCell: aMorph flexVertically: aVBoolean flexHorizontally: aHBo

(((aMorph fullBounds extent <= cell extent)
or: [aVBoolean and: (aMorph fullBounds width <= cell width)])
or: [aHBoolean and: (aMorph fullBounds height <= cell height)])
or: [aHBoolean and: (aMorph fullBounds height <= cell height)]
or: [aVBoolean and: aHBoolean])
ifTrue: [cell addMorph: aMorph. ^ cell].

targetExtent := cell extent - (cell borderWidth@cell borderWidth).
aVBoolean ifTrue: [targetExtent setX: targetExtent x setY: aMorph fullBounds height].
aHBoolean ifTrue: [targetExtent setX: aMorph fullBounds width setY: targetExtent height].
aHBoolean ifTrue: [targetExtent setX: aMorph fullBounds width setY: targetExtent y].

self flag: #todo. "Another way besides turning into an image to keep interactions.-jb"
cell addMorph: (ImageMorph new
Expand Down
Loading

0 comments on commit aa0bf21

Please sign in to comment.