Skip to content

Commit

Permalink
Minor speedup of diagram loading
Browse files Browse the repository at this point in the history
  • Loading branch information
JanBliznicenko committed Jul 25, 2024
1 parent 3c5a1c5 commit 5a9b06b
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions repository/OpenPonk-Core/OPStonDiagramSerializer.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,21 @@ OPStonDiagramSerializer >> formatName [
{ #category : 'serialize/materialize' }
OPStonDiagramSerializer >> materializeDiagramOf: aModel from: aStream [

| diagram adapters allModelElements |
| diagram adapters innerElements elementsById |
diagram := STON fromStream: aStream.
adapters := OPNavigatorAdapters new.
allModelElements := ((Set with: aModel)
, (adapters allChildrenFor: aModel) collect: [
:each | each uuid -> each ]) asDictionary.
diagram resolveAllModelElements: allModelElements.
innerElements := adapters allChildrenFor: aModel.
elementsById := Dictionary new: innerElements size + 1.
elementsById at: aModel uuid put: aModel.
innerElements do: [ :each |
elementsById
at: each uuid
ifPresent: [ :existing |
self error:
'There are two elements with same ID ' , each uuid asString
, ': ' , existing asString , ' and: ' , each asString ]
ifAbsentPut: each ].
diagram resolveAllModelElements: elementsById.
^ diagram
]

Expand Down

0 comments on commit 5a9b06b

Please sign in to comment.