projet-mini-genie-logiciel-.../eclipse-workspace/fr.n7.simplepdl/simplePDL.ocl
Laurent Fainsin ce79718fa6 test: renommage des simplepdl en simplePDL
et renommage des petrinet en petriNet
2021-10-10 14:44:16 +02:00

40 lines
1.2 KiB
Plaintext

import 'simplePDL.ecore'
package simplepdl
context Process
inv validName('Invalid name: ' + self.name):
self.name.matches('[A-Za-z_][A-Za-z0-9_]*')
inv uniqNames: self.processElements
->select(pe | pe.oclIsKindOf(WorkDefinition))
->collect(pe | pe.oclAsType(WorkDefinition))
->forAll(w1, w2 | w1 = w2 or w1.name <> w2.name)
context ProcessElement
def: process(): Process =
Process.allInstances()
->select(p | p.processElements->includes(self))
->asSequence()->first()
context WorkSequence
inv successorAndPredecessorInSameProcess('Activities not in the same process : '
+ self.predecessor.name + ' in ' + self.predecessor.process().name+ ' and '
+ self.successor.name + ' in ' + self.successor.process().name):
self.process() = self.successor.process()
and self.process() = self.predecessor.process()
inv notReflexive: self.predecessor <> self.successor
context WorkDefinition
inv nameMin2Char: self.name.matches('..+')
inv weirdName: not self.name.matches('([0-9]*|[a-zA-Z]*|_*)')
context Resource
inv negativeQuantity: self.quantity > 0
inv nameMin2Char: self.name.matches('..+')
inv weirdName: not self.name.matches('([0-9]*|_*)')
context Request
inv negativeQuantity: self.quantity > 0
inv greedy: self.quantity <= self.target.quantity
endpackage