www

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

commit 47fc940d00941823bb0f688fc1f159b462633bee
parent 3bb6f98e483751b09d8ea024d822772394df9725
Author: Bertrand BRUN <bertrand0brun@gmail.com>
Date:   Wed,  9 Feb 2011 23:26:13 +0100

Amelioration au niveau de la genericite de la classe Network
Diffstat:
Mcode/PtiClic/src/org/pticlic/model/Network.java | 15++++++++++++---
1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/code/PtiClic/src/org/pticlic/model/Network.java b/code/PtiClic/src/org/pticlic/model/Network.java @@ -124,7 +124,16 @@ public class Network { * @return */ public DownloadedGame getGames(int nbGames) { - DownloadedGame game = null; + switch (mode) { + case SIMPLE_GAME: + return DownloadBaseGame(nbGames); + default: + return null; + } + } + + private DownloadedBaseGame DownloadBaseGame(int nbGames) { + DownloadedBaseGame game = null; try { // TODO : ne restera le temps que les requete du serveur passe du GET au POST String urlS = this.serverURL+"/pticlic.php?" @@ -150,7 +159,7 @@ public class Network { // FIXME : Attention lorsque l'on pourra vraiment recupere plusieur partie, il faudra changer ce qui suit. reader.beginArray(); while (reader.hasNext()) { - game = makeGame(reader, gson); + game = makeBaseGame(reader, gson); } reader.endArray(); reader.close(); @@ -171,7 +180,7 @@ public class Network { * @return Une nouvelle instance de Game. * @throws IOException */ - private DownloadedGame makeGame(JsonReader reader, Gson gson) throws IOException { + private DownloadedBaseGame makeBaseGame(JsonReader reader, Gson gson) throws IOException { int gid = -1; int pgid = -1; int id = -1;