improved constraints
This commit is contained in:
parent
e471d47fd5
commit
ebac675b3b
1 changed files with 6 additions and 10 deletions
16
projet.use
16
projet.use
|
@ -63,10 +63,8 @@ operations
|
||||||
changerEtat(nouveauEtat: TypeCase)
|
changerEtat(nouveauEtat: TypeCase)
|
||||||
getEtat(): TypeCase
|
getEtat(): TypeCase
|
||||||
constraints
|
constraints
|
||||||
inv:
|
inv: plateau.cases->select(c: Case | c.x = x and c.y = y)->size() = 1
|
||||||
plateau.cases->select(c: Case | c.x = x and c.y = y)->size() = 1
|
inv: x <= 10 and x > 0 and y > 0 and y <= 10
|
||||||
inv coordonne:
|
|
||||||
x <= 10 and x > 0 and y > 0 and y <= 10
|
|
||||||
end
|
end
|
||||||
|
|
||||||
class Bateau
|
class Bateau
|
||||||
|
@ -75,12 +73,10 @@ attributes
|
||||||
longueur: Integer
|
longueur: Integer
|
||||||
Etat: EtatBateau
|
Etat: EtatBateau
|
||||||
constraints
|
constraints
|
||||||
inv longueur:
|
inv: type = TypeBateau::Torpilleur implies longueur = 2
|
||||||
if type = TypeBateau::Torpilleur then longueur = 2
|
inv: type = TypeBateau::Contre_Torpilleur implies longueur = 3
|
||||||
else if type = TypeBateau::Contre_Torpilleur then longueur = 3
|
inv: type = TypeBateau::Croiseur implies longueur = 4
|
||||||
else if type = TypeBateau::Croiseur then longueur = 4
|
inv: type = TypeBateau::Porte_Avions implies longueur = 5
|
||||||
else longueur = 5
|
|
||||||
endif endif endif
|
|
||||||
end
|
end
|
||||||
|
|
||||||
association Utilise between
|
association Utilise between
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue