Skip to content
Snippets Groups Projects
Commit 5d9e2c42 authored by Keane Reynolds's avatar Keane Reynolds
Browse files

Uploaded example 31 from the manual

parent be281292
No related branches found
No related tags found
4 merge requests!6Keane branch,!5Keane branch,!4Keane branch,!3Keane branch
/* Example31_Aspect_Oriented_Paradigm.mp
The COORDINATE operation supports a “cause-effect” refinement for
the behavior of two components and it bears a certain similarity
to Aspect-Oriented Programming (AOP) paradigm [Kiczales et al. 1997]
(or read https://en.wikipedia.org/wiki/Aspect-oriented_programming).
For example, the following AOP pattern could be modeled by MP schema
where event coordination implements AOP join point and advice
coordination.
Suppose that the main stream of execution contains calls to
methods M1 and M2 as join points, and the aspect behavior requires
a call to Prolog before, and to Epilog after each method call as an
advice. The corresponding MP model may look like the following.
*/
SCHEMA Aspect_Oriented_Paradigm
ROOT Main: (* ( M1 | M2 | do_something_else ) *);
ROOT PreAdvice: (* Prolog *);
ROOT PostAdvice: (* Epilog *);
COORDINATE
$jp: ( M1 | M2 ) FROM Main,
$a1: Prolog FROM PreAdvice,
$a2: Epilog FROM PostAdvice
DO ADD
$a1 PRECEDES $jp,
$jp PRECEDES $a2;
OD;
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment