This commit is contained in:
Bertrand BRUN 2011-02-02 10:08:26 +01:00
parent bb4e49d1bf
commit 9a5d3d9cb9
2 changed files with 101 additions and 15 deletions

View File

@ -13,20 +13,20 @@ import java.util.ArrayList;
*/
public class GamePlayed implements Serializable {
private static final long serialVersionUID = 1L;
private ArrayList<CharSequence> relation1;
private ArrayList<CharSequence> relation2;
private ArrayList<CharSequence> relation3;
private ArrayList<CharSequence> relation4;
private ArrayList<CharSequence> poubelle;
private DownloadedGame game;
private static final long serialVersionUID = 1L;
private ArrayList<String> relation1;
private ArrayList<String> relation2;
private ArrayList<String> relation3;
private ArrayList<String> relation4;
private ArrayList<String> trash;
private DownloadedGame game;
public GamePlayed() {
relation1 = new ArrayList<CharSequence>();
relation2 = new ArrayList<CharSequence>();
relation3 = new ArrayList<CharSequence>();
relation4 = new ArrayList<CharSequence>();
poubelle = new ArrayList<CharSequence>();
relation1 = new ArrayList<String>();
relation2 = new ArrayList<String>();
relation3 = new ArrayList<String>();
relation4 = new ArrayList<String>();
trash = new ArrayList<String>();
}
public void setGame(DownloadedGame game) {
@ -37,13 +37,85 @@ public class GamePlayed implements Serializable {
return game;
}
public void add(int relation, CharSequence word) {
public void add(int relation, String word) {
switch (relation) {
case 1: relation1.add(word); break;
case 2: relation2.add(word); break;
case 3: relation3.add(word); break;
case 4: relation4.add(word); break;
default: poubelle.add(word); break;
default: trash.add(word); break;
}
}
/**
* @return the relation1
*/
public ArrayList<String> getRelation1() {
return relation1;
}
/**
* @return the relation2
*/
public ArrayList<String> getRelation2() {
return relation2;
}
/**
* @return the relation3
*/
public ArrayList<String> getRelation3() {
return relation3;
}
/**
* @return the relation4
*/
public ArrayList<String> getRelation4() {
return relation4;
}
/**
* @return the trash
*/
public ArrayList<String> getTrash() {
return trash;
}
/**
* @param relation1 the relation1 to set
*/
public void setRelation1(ArrayList<String> relation1) {
this.relation1 = relation1;
}
/**
* @param relation2 the relation2 to set
*/
public void setRelation2(ArrayList<String> relation2) {
this.relation2 = relation2;
}
/**
* @param relation3 the relation3 to set
*/
public void setRelation3(ArrayList<String> relation3) {
this.relation3 = relation3;
}
/**
* @param relation4 the relation4 to set
*/
public void setRelation4(ArrayList<String> relation4) {
this.relation4 = relation4;
}
/**
* @param trash the trash to set
*/
public void setTrash(ArrayList<String> trash) {
this.trash = trash;
}
}

View File

@ -82,7 +82,7 @@ public class Network {
reader.close();
} catch (IOException e) {
e.printStackTrace();
return null;
}
@ -148,6 +148,20 @@ public class Network {
connection.addRequestProperty("passwd", this.passwd);
connection.addRequestProperty("mode", mode.value());
if (game.getGame().getCat1() != -1) {
// for (game.getRelation1())
// connection.addRequestProperty("cat1[]", newValue);
}
if (game.getGame().getCat2() != -1) {
}
if (game.getGame().getCat3() != -1) {
}
if (game.getGame().getCat4() != -1) {
}
Gson gson = new Gson();
String json = gson.toJson(game);