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)
|
||||
getEtat(): TypeCase
|
||||
constraints
|
||||
inv:
|
||||
plateau.cases->select(c: Case | c.x = x and c.y = y)->size() = 1
|
||||
inv coordonne:
|
||||
x <= 10 and x > 0 and y > 0 and y <= 10
|
||||
inv: 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
|
||||
end
|
||||
|
||||
class Bateau
|
||||
|
@ -75,12 +73,10 @@ attributes
|
|||
longueur: Integer
|
||||
Etat: EtatBateau
|
||||
constraints
|
||||
inv longueur:
|
||||
if type = TypeBateau::Torpilleur then longueur = 2
|
||||
else if type = TypeBateau::Contre_Torpilleur then longueur = 3
|
||||
else if type = TypeBateau::Croiseur then longueur = 4
|
||||
else longueur = 5
|
||||
endif endif endif
|
||||
inv: type = TypeBateau::Torpilleur implies longueur = 2
|
||||
inv: type = TypeBateau::Contre_Torpilleur implies longueur = 3
|
||||
inv: type = TypeBateau::Croiseur implies longueur = 4
|
||||
inv: type = TypeBateau::Porte_Avions implies longueur = 5
|
||||
end
|
||||
|
||||
association Utilise between
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue