conception.adoc 1.57 KB
Newer Older
Gerson Sunyé's avatar
Gerson Sunyé committed
1
= Conception détaillée
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83


== Game Server

.GameSever
[plantuml]
....
interface GameServer {
    createGame(numberOfPlayers : Integer): Integer
    join(gameId : Integer): Integer
    start()
}

package game {
    class "GameServerController" as controller {
        createGame(numberOfPlayers : Integer): Integer
        join(gameId : Integer): Integer
        start()
    }
    class "Game" as game {
        id : Integer {id}
        numberOfPlayers : Integer
    }
    class "Player" as player {
        id : Integer {id}
    }
    GameServer <|-- controller
    controller *- "[*] games" game : \t\t\t
    controller *-- "[0..7] players" player
}
note right of game: Uncompleted!
....

[plantuml]
....
state Game {
    [*] --> Created
    Created -> Started : start()
    Started -> Phase1 : \t
    Phase1 --> [*]
}
note right of Game : Uncompleted!
....

=== Opérations du GameServerController

.Create Game
[source,OCL]
----
GameServerController::createGame(numberOfPlayers : Integer): Integer
pre:
    numberOfPlayers > 1 and numberOfPlayers <= 7

post:
    self.games -> exists(each | each.isOclNew())and
    game.oclinState(Created)
----

.Join Game
[source,OCL]
----
GameServerController::join(gameId : Integer): Integer
pre:
    self.games -> exists(each | each.id = gameId)
post:
    let game = self.games->select(id = gameId)->first() in
    game.players->exists(each| each.isOclNew())
----

.Start Game
[plantuml]
----
partition GameServerController::start() {
    start
    while (enough players?)
        :JoinRequest<
        :handleRequest();
    endwhile
    :Game Start>
    stop
}
----