Skip to content

Commit

Permalink
do not prepare dictionary of model elements when serializing
Browse files Browse the repository at this point in the history
  • Loading branch information
JanBliznicenko committed Jul 25, 2024
1 parent c7573f4 commit efb789a
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 32 deletions.
4 changes: 2 additions & 2 deletions repository/OpenPonk-Core/OPModelObjectReference.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ OPModelObjectReference >> = otherModelObject [
]

{ #category : 'comparing' }
OPModelObjectReference >> modelObjectFrom: aDictionary [
OPModelObjectReference >> modelObjectFrom: aCollection [

^ aDictionary at: uuid
^ aCollection detect: [ :any | any uuid = uuid ]
]

{ #category : 'printing' }
Expand Down
12 changes: 6 additions & 6 deletions repository/OpenPonk-Core/OPShape.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -426,18 +426,18 @@ OPShape >> resizableInteractionTarget [
]

{ #category : 'serialization' }
OPShape >> resolveAllModelElements: aDictionary [
OPShape >> resolveAllModelElements: aCollection [

self resolveModelElements: aDictionary.
self resolveModelElements: aCollection.
self ownedElements do: [ :each |
each resolveAllModelElements: aDictionary ]
each resolveAllModelElements: aCollection ]
]

{ #category : 'serialization' }
OPShape >> resolveModelElements: aDictionary [
OPShape >> resolveModelElements: aCollection [

self modelElements: (self modelElements collect: [ :each |
each modelObjectFrom: aDictionary ])
self modelElements: (self modelElements collect: [ :each |
each modelObjectFrom: aCollection ])
]

{ #category : 'rendering' }
Expand Down
28 changes: 4 additions & 24 deletions repository/OpenPonk-Core/OPStonDiagramSerializer.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -24,28 +24,6 @@ OPStonDiagramSerializer class >> minImportVersion [
^ 1
]

{ #category : 'serialize/materialize' }
OPStonDiagramSerializer >> elementsByIdsFrom: elements [

SystemNotification signal: 'Elements: ' , elements size asString.
^ (elements withIndexCollect: [ :each :index |
SystemNotification signal:
'Processing E ' , index asString , ': ' , each asString.
each uuid -> each.
SystemNotification signal:
'Processed E ' , index asString , ': ' , each asString ])
asDictionary
]

{ #category : 'serialize/materialize' }
OPStonDiagramSerializer >> elementsByIdsOf: aModel [

| innerElements allElements |
innerElements := OPNavigatorAdapters new allChildrenFor: aModel.
allElements := innerElements asArray copyWith: aModel.
^ self elementsByIdsFrom: allElements
]

{ #category : 'accessing' }
OPStonDiagramSerializer >> formatName [
^ 'ston'
Expand All @@ -54,9 +32,11 @@ OPStonDiagramSerializer >> formatName [
{ #category : 'serialize/materialize' }
OPStonDiagramSerializer >> materializeDiagramOf: aModel from: aStream [

| diagram |
| diagram innerElements |
diagram := STON fromStream: aStream.
diagram resolveAllModelElements: (self elementsByIdsOf: aModel).
innerElements := OPNavigatorAdapters new allChildrenFor: aModel.
diagram resolveAllModelElements:
(innerElements asArray copyWith: aModel).
^ diagram
]

Expand Down

0 comments on commit efb789a

Please sign in to comment.