Re: [abc-users] Relational aspects to tracematches

From: Eric Bodden <eric.bodden_at_mail.mcgill.ca>
Date: Tue, 11 Mar 2008 16:56:25 -0400

Hi, Alan.

This seems correct except two things:

1.) Treatment of per-association state
2.) The regular expression is a bit more complicated in real life, to
avoid re-association when associate(..) is called twice on the same
values

Eric

On 11/03/2008, Alan Teoh <alan.teoh07_at_imperial.ac.uk> wrote:
> Hi there,
>
> I just wanted to make sure that my understanding is about the
> translation from relational aspects to tracematches is correct.
> I have the following relational aspect, based on the idea from Sakurai
> et al, using an Equality to synchronise two Bit objects as follows:
>
> relational aspect Equality((Bit b1, (Bit b2) {
>
> pointcut set(Bit b) : call(void Bit.set()) && target(b);
>
> relational after(): set(b1) { propagateSet(b2); }
>
> relational after(): set(b2) { propagateSet(b1); }
>
>
> boolean busy = false;
>
> void propagateSet(Bit opponent) {
>
> if(!busy) {
>
> busy = true;
>
> opponent.set();
>
> busy = false;
>
> }
>
> }
>
> }
>
> My question is, seeing that I have two relational advices, there will be
> two sets of tracematches that will be generated during the translation
> process, like this right?
>
> This translation of course is incomplete (like how the report mentioned
> about the lack of per-association fields)
>
> I am aware that this translation is not visible to the user, but I just
> want to confirm that it is correct. Code is as follows:
>
> aspect Equality {
> tracematch(Bit b1, Bit b2) {
> sym associate after:
> call(* Equality.associate(..)) && args(b1, b2);
> sym release after:
> call(* Equality.release(..)) && args(b1, b2);
> sym action after: call(void Bit.set()) && target(b1);
>
> associate action+ {
> propagateSet(b2);
> }
> }
>
> tracematch(Bit b1, Bit b2) {
> sym associate after:
> call(* Equality.associate(..)) && args(b1, b2);
> sym release after:
> call(* Equality.release(..)) && args(b1, b2);
> sym action after: call(void Bit.set()) && target(b2);
>
> associate action+ {
> propagateSet(b1);
> }
> }
>
> public void associate(Bit b1, Bit b2) {}
> public void release(Bit b1, Bit b2) {}
>
> boolean busy = false;
> void propagateSet(Bit opponent) {
> if(!busy) {
> busy = true;
> opponent.set();
> busy = false;
> }
> }
> }
>
>
> Thanks.
>
>
>

-- 
Eric Bodden
Sable Research Group
McGill University, Montréal, Canada
Received on Tue Mar 11 2008 - 20:56:28 GMT

This archive was generated by hypermail 2.2.0 : Wed Mar 12 2008 - 02:40:11 GMT