03.08.2013 Views

Rapport de fin de phase I - Haute école du paysage, d'ingénierie et ...

Rapport de fin de phase I - Haute école du paysage, d'ingénierie et ...

Rapport de fin de phase I - Haute école du paysage, d'ingénierie et ...

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Il est cependant possible <strong>de</strong> dé<strong>fin</strong>ir un attribut ou une opération visible par toutes les<br />

contraintes d’un contexte. Pour cela, il faut dé<strong>fin</strong>ir une contrainte stéréotypée<br />

« <strong>de</strong><strong>fin</strong>ition ». Une telle contrainte ne peut contenir que <strong>de</strong>s dé<strong>fin</strong>itions d’attributs <strong>et</strong><br />

d’opérations.<br />

context Person <strong>de</strong>f :<br />

l<strong>et</strong> income : Integer = job.salary -> sum()<br />

l<strong>et</strong> hasTitle(aTitle: String) : Boolean =<br />

job->exists(title = aTitle)<br />

context Person inv :<br />

if isUnemployed then<br />

income < 100<br />

else<br />

income >= 100 and hasTitle(‘manager’)<br />

endif<br />

Le nom d’un attribut ou d’une opération dé<strong>fin</strong>i par l<strong>et</strong> ne doit pas entrer en conflit<br />

avec le nom d’un attribut, d’une extrémité d’association ou d’une opération <strong>du</strong><br />

classificateur <strong>du</strong> contexte <strong>de</strong> la contrainte.<br />

Conformité <strong>de</strong>s types <strong>de</strong> base<br />

Type Opérations<br />

Integer Real<br />

Transtypage<br />

La fonction oclAsType(Type) perm<strong>et</strong> <strong>de</strong> faire un down cast (transtypage vers un<br />

sous-type).<br />

unClient.oclAsType(PersonneMorale)<br />

Règles <strong>de</strong> précé<strong>de</strong>nce<br />

1) @pre<br />

2) . -><br />

3) not -(unaire)<br />

4) * /<br />

5) + -(binaire)<br />

6) if-then-else-endif<br />

7) < > =<br />

8) = <br />

9) and or xor<br />

10) implies<br />

22.06.2005 16/78

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

Saved successfully!

Ooh no, something went wrong!