Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
Not Alone
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Environments
Packages & Registries
Packages & Registries
Package Registry
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Ibrahima DIALLO
Not Alone
Commits
10313d83
Commit
10313d83
authored
Nov 18, 2020
by
Gerson Sunyé
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Back to Java 1.8
parent
d2e991fd
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
17 additions
and
39 deletions
+17
-39
not-alone-core/src/main/thrift/game-server.thrift
not-alone-core/src/main/thrift/game-server.thrift
+0
-2
not-alone-doc/src/doc/asciidoc/_sections/composants.adoc
not-alone-doc/src/doc/asciidoc/_sections/composants.adoc
+0
-2
not-alone-doc/src/doc/asciidoc/_sections/conception.adoc
not-alone-doc/src/doc/asciidoc/_sections/conception.adoc
+3
-5
not-alone-server/pom.xml
not-alone-server/pom.xml
+0
-4
not-alone-server/src/main/java/fr/univnantes/alma/common/GameService.java
.../src/main/java/fr/univnantes/alma/common/GameService.java
+0
-1
not-alone-server/src/main/java/fr/univnantes/alma/game/Game.java
...ne-server/src/main/java/fr/univnantes/alma/game/Game.java
+9
-7
not-alone-server/src/main/java/fr/univnantes/alma/game/GameServiceController.java
...n/java/fr/univnantes/alma/game/GameServiceController.java
+0
-6
not-alone-server/src/main/java/fr/univnantes/alma/handler/GameServiceHandler.java
...n/java/fr/univnantes/alma/handler/GameServiceHandler.java
+1
-9
not-alone-server/src/test/java/fr/univnantes/alma/NotAloneApplicationTest.java
...test/java/fr/univnantes/alma/NotAloneApplicationTest.java
+1
-1
pom.xml
pom.xml
+3
-2
No files found.
not-alone-core/src/main/thrift/game-server.thrift
View file @
10313d83
...
...
@@ -11,6 +11,4 @@ service GameServerService {
i32 createGame(i32 numberOfPlayers)
i32 join(i32 gameId, JoinRequest request) throws (1:common.GameNotFound e)
void start(i32 gameId) throws (1:common.GameNotFound e)
}
not-alone-doc/src/doc/asciidoc/_sections/composants.adoc
View file @
10313d83
...
...
@@ -22,7 +22,6 @@ par
player5 -> game : playerId := join(id, five)
player6 -> game : playerId := join(id, six)
end
game -> game : start()
....
.Questions ouveres (à faire)
...
...
@@ -35,6 +34,5 @@ game -> game : start()
interface GameServer {
createGame(numberOfPlayers : Integer): Integer
join(gameId : Integer): Integer
satrt()
}
....
not-alone-doc/src/doc/asciidoc/_sections/conception.adoc
View file @
10313d83
...
...
@@ -9,16 +9,14 @@
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
{
class
"Game
\n
[Thread]
"
as
game
{
id
:
Integer
{
id
}
numberOfPlayers
:
Integer
}
...
...
@@ -27,7 +25,7 @@ package game {
}
GameServer
<|--
controller
controller
*-
"[*] games"
game
:
\
t
\
t
\
t
controller
*--
"[0..7] players"
player
game
*--
"[0..7] players"
player
}
note
right
of
game
:
Uncompleted
!
....
...
...
@@ -71,7 +69,7 @@ post:
.
Start
Game
[
plantuml
]
----
partition
Game
ServerController
::
start
()
{
partition
Game
::
run
()
{
start
while
(
enough
players
?)
:
JoinRequest
<
...
...
not-alone-server/pom.xml
View file @
10313d83
...
...
@@ -16,10 +16,6 @@
<name>
Not Alone Server
</name>
<description>
Spring Boot Not Alone server
</description>
<properties>
<java.version>
11
</java.version>
</properties>
<dependencies>
<dependency>
<groupId>
fr.univnantes.alma
</groupId>
...
...
not-alone-server/src/main/java/fr/univnantes/alma/common/GameService.java
View file @
10313d83
...
...
@@ -20,5 +20,4 @@ public interface GameService {
*/
int
join
(
int
gameId
,
GameJoinRequest
request
);
void
start
(
int
gameId
)
throws
InterruptedException
;
}
not-alone-server/src/main/java/fr/univnantes/alma/game/Game.java
View file @
10313d83
...
...
@@ -20,9 +20,14 @@ public class Game {
private
final
AtomicInteger
expectedPlayers
;
private
Thread
play
;
public
Game
(
int
expectedPlayers
)
{
this
.
expectedPlayers
=
new
AtomicInteger
(
expectedPlayers
);
this
.
requests
=
new
ArrayBlockingQueue
<
GameJoinRequest
>(
expectedPlayers
);
play
=
new
Thread
(()
->
this
.
start
());
play
.
start
();
}
public
int
join
(
GameJoinRequest
request
)
{
...
...
@@ -31,13 +36,10 @@ public class Game {
return
id
;
}
public
void
start
()
{
Thread
t
=
new
Thread
(()
->
{
this
.
waitForPlayers
();
Log
.
info
(
"We can start !"
);
}
);
t
.
start
();
private
void
start
()
{
this
.
waitForPlayers
();
Log
.
info
(
"We can start !"
);
}
private
void
waitForPlayers
()
{
...
...
not-alone-server/src/main/java/fr/univnantes/alma/game/GameServiceController.java
View file @
10313d83
...
...
@@ -34,10 +34,4 @@ public class GameServiceController implements GameService {
return
game
.
join
(
request
);
}
@Override
public
void
start
(
int
gameId
)
throws
InterruptedException
{
Game
game
=
games
.
get
(
gameId
);
game
.
start
();
}
}
not-alone-server/src/main/java/fr/univnantes/alma/handler/GameServiceHandler.java
View file @
10313d83
...
...
@@ -22,16 +22,8 @@ public class GameServiceHandler implements GameServerService.Iface {
@Override
public
int
join
(
int
gameId
,
JoinRequest
request
)
throws
TException
{
//TODO: translate JoinRequest into GameJoinRequest
return
service
.
join
(
gameId
,
new
GameJoinRequest
());
}
@Override
public
void
start
(
int
gameId
)
throws
GameNotFound
,
TException
{
try
{
service
.
start
(
gameId
);
}
catch
(
InterruptedException
e
)
{
throw
new
GameNotFound
();
}
}
}
not-alone-server/src/test/java/fr/univnantes/alma/NotAloneApplicationTest.java
View file @
10313d83
...
...
@@ -50,7 +50,7 @@ class NotAloneApplicationTest {
client
.
join
(
id
,
new
JoinRequest
(
"two"
));
client
.
join
(
id
,
new
JoinRequest
(
"three"
));
client
.
join
(
id
,
new
JoinRequest
(
"four"
));
client
.
start
(
id
);
Thread
.
sleep
(
1000
);
}
...
...
pom.xml
View file @
10313d83
...
...
@@ -12,8 +12,9 @@
<properties>
<project.build.sourceEncoding>
UTF-8
</project.build.sourceEncoding>
<maven.compiler.source>
1.9
</maven.compiler.source>
<maven.compiler.target>
1.9
</maven.compiler.target>
<maven.compiler.source>
1.8
</maven.compiler.source>
<maven.compiler.target>
1.8
</maven.compiler.target>
<java.version>
1.8
</java.version>
<commons.version>
1.0.5
</commons.version>
</properties>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment