From 5d9e2c4227aca316dd1cb52956d8663566c0a1c3 Mon Sep 17 00:00:00 2001 From: Keane Reynolds <keane.reynolds@gmail.com> Date: Fri, 18 Jun 2021 14:23:38 +0000 Subject: [PATCH] Uploaded example 31 from the manual --- Example31_Aspect_Oriented_Paradigm.mp | 32 +++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 Example31_Aspect_Oriented_Paradigm.mp diff --git a/Example31_Aspect_Oriented_Paradigm.mp b/Example31_Aspect_Oriented_Paradigm.mp new file mode 100644 index 0000000..63efa4a --- /dev/null +++ b/Example31_Aspect_Oriented_Paradigm.mp @@ -0,0 +1,32 @@ +/* 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 -- GitLab