RessourceLoader
This commit is contained in:
parent
4734e9bb7d
commit
35f87bd62e
@ -8,6 +8,7 @@ import java.util.Map;
|
||||
|
||||
import carte.Carte;
|
||||
import carte.CartePiochable;
|
||||
import personnage.CartePersonnage;
|
||||
|
||||
public class RessourceLoader {
|
||||
|
||||
@ -50,8 +51,22 @@ public class RessourceLoader {
|
||||
return cartesType;
|
||||
}
|
||||
|
||||
|
||||
|
||||
private static Map<Integer, CartePersonnage> getMapPersonnage(Map<Integer, Carte> cartes){
|
||||
|
||||
Map<Integer, CartePersonnage> cartesPersonnage = new HashMap<Integer, CartePersonnage>();
|
||||
|
||||
for(Integer i: cartes.keySet()) {
|
||||
|
||||
Carte c = cartes.get(i);
|
||||
if(cartes.get(i) instanceof CartePersonnage) {
|
||||
|
||||
CartePersonnage carte = (CartePersonnage) c;
|
||||
cartesPersonnage.put(i,carte);
|
||||
}
|
||||
}
|
||||
return cartesPersonnage;
|
||||
}
|
||||
|
||||
public static Object deserialize(byte[] data) throws IOException, ClassNotFoundException {
|
||||
ByteArrayInputStream in = new ByteArrayInputStream(data);
|
||||
ObjectInputStream is = new ObjectInputStream(in);
|
||||
|
@ -27,10 +27,8 @@ public class Table {
|
||||
|
||||
public void remplirTableQuery(String query) {
|
||||
try (Connection connection = DriverManager.getConnection("jdbc:postgresql://localhost:5432/ShadowHunterDatabase", "shManager", "shadowhunter1234")) { //notre utilisateur que l'on utilisera (:
|
||||
|
||||
System.out.println("Connected to PostgreSQL database!");
|
||||
|
||||
Statement statement = connection.createStatement();
|
||||
System.out.println("Reading records...");
|
||||
ResultSet retour = statement.executeQuery(query);
|
||||
while (retour.next()) {
|
||||
list.add(new Record(retour.getString("id"), retour.getString("nom"), null, retour.getBytes("objet")));
|
||||
@ -65,10 +63,4 @@ public class Table {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user