eclipse-ocl / org.eclipse.ocl

Eclipse Public License 2.0
0 stars 0 forks source link

Support UML Instance execution for StateMachines #2132

Open eclipse-ocl-bot opened 1 day ago

eclipse-ocl-bot commented 1 day ago

| --- | --- | | Bugzilla Link | 566911 | | Status | NEW | | Importance | P3 normal | | Reported | Sep 13, 2020 02:59 EDT | | Modified | Sep 14, 2020 03:35 EDT | | See also | 566910, 566912 | | Reporter | Ed Willink |

Description

Bug 566910 considers what EClipse fails to do in comparison to USE which might fade away. Specifocally StateMachine animation is hard since Eclipse UML does not facilitate creating UML instances. Consequently the OCL support for evaluation using UML instances is pretty limited.

Create a test that instantiates a UML State Machine and animate it to ensure that all the OCL enricjments work.

eclipse-ocl-bot commented 1 day ago

By Ed Willink on Sep 13, 2020 16:52

Who implements state machines?

? EMF ? There could be an EStateMachine, EState etc, but this would impose a particular implementation strategy and would have to be flattened by the JET templates since there is no corresponding Java support.

? UML2Ecore ? StateMachine can be converted to an EClass, State to an EEnum, Port/Trigger/Event to ? operations/enumerations with variant strategies. But this doesn't work for interpreted execution.

? OCL Pivot ? StateMachine etc can exist and support interpreted execution. OCL2Java CG can synthesize a compiled form. Might need some JET changes to allow eSet() to be an event unless everything incurs eNotify() overheads.

eclipse-ocl-bot commented 1 day ago

By Ed Willink on Sep 14, 2020 03:11

(In reply to Ed Willink from comment #1)

Port/Trigger/Event to ? operations/enumerations with variant strategies.

A uniform base API could require

'E'StateMachine::eTrigger(Object port, Object event)

to be synthesized for classes with state machines; directly for one state machine, by additional containment (and delegation) for multiples. 'port' can be reified as null for no/only port, as Integer/String/EnumLiteral for lightweight ports or as something substantial. Similarly 'event' can be null/String/Integer/EnumLiteral or a substantial Message.

EMF is marginally threadsafe. To provide any hope of thread safety, state machines and an overall controller must implement

'E'TimeController::addStateMachine('E'StateMachine stateMachine)\
'E'TimeController::removeStateMachine('E'StateMachine stateMachine)\
'E'StateMachine::setController('E'TimeController controller)

The overall controller manages delta times and pending interactions queued by

'E'TimeController::eTrigger('E'StateMachine target, Object port, Object event)

Variant TimeController implementations can prioritize/filter/synchronize state machines in a possibly distributed environment. Optimization may be possible where global StateMachine analysis permits.

eclipse-ocl-bot commented 1 day ago

By Ed Willink on Sep 14, 2020 03:35

(In reply to Ed Willink from comment #2)

Optimization may be possible where global StateMachine analysis permits.

If the eTrigger synthesis or associated meta-data adequately characterizes the behaviour, dynamic global StateMachine analysis may be possible and avoid the problem that the global closure of state machines may be hard to know at compile time.