[abc-users] Relational aspects to tracematches

From: Alan Teoh <alan.teoh07_at_imperial.ac.uk>
Date: Tue, 11 Mar 2008 20:49:18 +0000

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.
Received on Tue Mar 11 2008 - 20:49:29 GMT

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