Skip to content

Commit

Permalink
Added roundabout persistence test
Browse files Browse the repository at this point in the history
  • Loading branch information
JanBliznicenko committed Jul 25, 2024
1 parent fce6c47 commit 4fa3aa9
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 13 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
Class {
#name : 'OPPetriNetExamplePersistenceTest',
#superclass : 'OPExamplePersistenceTest',
#category : 'OpenPonk-PetriNets-Tests',
#package : 'OpenPonk-PetriNets',
#tag : 'Tests'
}

{ #category : 'hooks' }
OPPetriNetExamplePersistenceTest >> createExampleModel [

^ OPPetriNetsExamples examplePetriNet
]
47 changes: 34 additions & 13 deletions repository/OpenPonk-PetriNets/OPPetriNetsExamples.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,20 @@ Class {
}

{ #category : 'examples' }
OPPetriNetsExamples class >> exampleEmpty [
OPPetriNetsExamples class >> emptyModel [

| project model |
project := OPProject named: 'New Petri Net'.
model := OPPetriNet new name: 'New Petri Net'.
project addModel: model.
OPWorkbench openProject: project
<script: 'self emptyModel inspect'>
^ OPPetriNet new
name: 'New Petri Net';
yourself
]

{ #category : 'examples' }
OPPetriNetsExamples class >> examplePetriNets [
OPPetriNetsExamples class >> examplePetriNet [

| project model place1 arc1 arc2 arc3 arc4 arc5 place2 place3 place4 trans1 trans2 workbench |
project := OPProject named: 'Example Petri Net'.
<script: 'self examplePetriNet inspect'>
| model place1 arc1 arc2 arc3 arc4 arc5 place2 place3 place4 trans1 trans2 |
model := OPPetriNet named: 'Petri Net'.
project addModel: model.
place1 := (OPPetriNetPTPlace named: 'P1')
tokens: 20;
yourself.
Expand Down Expand Up @@ -51,7 +49,7 @@ OPPetriNetsExamples class >> examplePetriNets [
add: arc3;
add: arc4;
add: arc5.
(OPProject openOnModel: model) showAllElementsInAllDiagrams
^ model
]

{ #category : 'menu' }
Expand All @@ -60,12 +58,35 @@ OPPetriNetsExamples class >> menuCommandOn: aBuilder [
<worldMenu>
(aBuilder item: #'Petri Nets')
icon: OPPetriNetsIcons petriNetIcon;
action: [ self exampleEmpty ];
action: [ self openExampleEmptyModel ];
order: 215;
with: [
(aBuilder item: #'Petri Nets Example')
parent: #'Petri Nets';
label: 'Petri Nets example';
icon: OPPetriNetsIcons petriNetIcon;
action: [ self examplePetriNets ] ]
action: [ self openExamplePetriNet ] ]
]

{ #category : 'examples' }
OPPetriNetsExamples class >> openExample: aModel [

| project |
project := OPProject named: 'FSM Example'.
project addModel: aModel.
^ (OPWorkbench openProject: project) showAllElementsInAllDiagrams
]

{ #category : 'examples' }
OPPetriNetsExamples class >> openExampleEmptyModel [

<example>
self openExample: self emptyModel
]

{ #category : 'examples' }
OPPetriNetsExamples class >> openExamplePetriNet [

<example>
self openExample: self examplePetriNet
]

0 comments on commit 4fa3aa9

Please sign in to comment.