12.01.2015 Views

Download - Academy Publisher

Download - Academy Publisher

Download - Academy Publisher

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

the Environment chooses. Expressed as an ATL<br />

formulaϕ s=ϕ .<br />

Definition 3.4 (Transparency) Transparency means<br />

that monitoring code should not impair the characters,<br />

such as function or semantic, of original program. That is<br />

to say, on an AOSM structure, all paths decided by the<br />

strategy of BaseCode should satisfy the characters ϕ of<br />

original program, no mater how the other players chooses.<br />

Expressed as an ATL formula ϕ t=ϕ 。<br />

ϕ t would be described differently according to the<br />

characters of original program:<br />

Given AOSM structure and soundness and<br />

transparency ATL formulas of an AOSM program, we<br />

can conclude whether this program satisfy the correct<br />

property by model-checking the formulas against the<br />

abstract structure.<br />

ⅴ . AN EXAMPLE<br />

Example.2 A program module makes use of the point<br />

class, which has a method move, to move a point on<br />

canvas. The program interface contains a canvas, two<br />

numeric text fields where the user can fill in x and y<br />

coordinates, and press “ok” button to move the point to<br />

the specified location on the canvas. The program only<br />

reads the text fields; it does not write to them. Their<br />

values are therefore determined by the environment alone.<br />

We assume that the text fields only accept non-negative<br />

coordinates.<br />

Class Point<br />

{ int x, y;<br />

int scaleFactor=1;<br />

public int getX() {return x}<br />

public int getY() {return y}<br />

public coordinate(int a, int b)<br />

{this.x=a; this. y=b;}<br />

public void move (int nx, int ny)<br />

{ x=nx*scaleFactor;<br />

y=ny*scaleFactor;}<br />

}<br />

……<br />

While(!Cancel)<br />

{ if (Ok)<br />

p.coordinate (getX(),getY())<br />

p. move (x , y)<br />

}<br />

( Base Code)<br />

Figure 3. Code of Example 2<br />

aspect adjustscale<br />

{<br />

Pointcut m(Point p):<br />

execution(void<br />

Point.move(int,int))<br />

&&targets(p);<br />

Before m()<br />

{ if ((p.x

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!