Created
December 27, 2017 22:43
-
-
Save kris7t/d9c28ca22109d89851e37211ce3ff839 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mission DinnerParty(Table) with DiningPhilosophers { | |
initial phase start | |
phase arrived | |
phase waitForFinish | |
phase left | |
final phase finish | |
var Phil | |
start -> arrived [adjacentPhilosophers(Table, Left, Right)] after 10 weight (Left.eatingRate + Right.eatingRate) / | |
let Phil = philosophers.PhilosophersFactory.eINSTNACE.createPhilosopher => [ | |
name = "Soren Kierkegaard" | |
hungryRate = 0.12 | |
eatingRate = 2.5 | |
left = Left | |
right = Right | |
], | |
do { | |
Table.philosophers += Phil | |
} | |
arrived -> waitForFinish after 25 | |
waitForFinish -> left [lookup philosopher(Table, Phil) as PhilM] on first (#PhilM.leftFork == 0 && #PhilM.rightFork == 0) / | |
do { | |
Phil.left.right = Phil.right | |
Table.philosophers -= Phil | |
} | |
left -> finish after 5 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment