diff --git a/JAVA/PROJET-PMT_STRI1A/src/json/gsonGenerator.java b/JAVA/PROJET-PMT_STRI1A/src/json/gsonGenerator.java index 3afdb48..ba7f88a 100644 --- a/JAVA/PROJET-PMT_STRI1A/src/json/gsonGenerator.java +++ b/JAVA/PROJET-PMT_STRI1A/src/json/gsonGenerator.java @@ -1,5 +1,5 @@ package json; -import modeles.*; +import modeles.Salle; import com.google.gson.Gson; public class gsonGenerator { @@ -19,9 +19,11 @@ public class gsonGenerator { 'monstre':[{'nom':premier monstre,'pAttaque':5}], 'porte':[{'ouvert':=true, 'position':"H"}]}" */ - public void generate(String chaine) { + public Salle generate(String chaine) { Gson gson = new Gson(); Salle salle = gson.fromJson(chaine, Salle.class); + System.out.println(salle.estVide()); + return salle; } diff --git a/JAVA/PROJET-PMT_STRI1A/src/modeles/EtreVivant.java b/JAVA/PROJET-PMT_STRI1A/src/modeles/EtreVivant.java index c22feee..419932c 100644 --- a/JAVA/PROJET-PMT_STRI1A/src/modeles/EtreVivant.java +++ b/JAVA/PROJET-PMT_STRI1A/src/modeles/EtreVivant.java @@ -24,6 +24,9 @@ public class EtreVivant { * @param salle * @param vivant */ + public EtreVivant() { + + } public EtreVivant(String nom, int pVieMax, int pAttaque) { super(); this.nom = nom; diff --git a/JAVA/PROJET-PMT_STRI1A/src/modeles/Monstre.java b/JAVA/PROJET-PMT_STRI1A/src/modeles/Monstre.java index 65b865c..53ca121 100644 --- a/JAVA/PROJET-PMT_STRI1A/src/modeles/Monstre.java +++ b/JAVA/PROJET-PMT_STRI1A/src/modeles/Monstre.java @@ -17,6 +17,9 @@ public class Monstre extends EtreVivant { public Monstre(String nom, int pAttaque) { super(nom, 5, pAttaque); + } + public Monstre() { + } public int attaquer(Personnage def) { int pAttaqueLoc; diff --git a/JAVA/PROJET-PMT_STRI1A/src/modeles/Porte.java b/JAVA/PROJET-PMT_STRI1A/src/modeles/Porte.java index 5ef1b67..ca4fd90 100644 --- a/JAVA/PROJET-PMT_STRI1A/src/modeles/Porte.java +++ b/JAVA/PROJET-PMT_STRI1A/src/modeles/Porte.java @@ -11,6 +11,10 @@ public class Porte { private boolean ouvert; private char orientation; + public Porte() { + + } + public Porte(boolean ouvert, char orientation) { super(); this.ouvert = ouvert; diff --git a/JAVA/PROJET-PMT_STRI1A/src/modeles/Salle.java b/JAVA/PROJET-PMT_STRI1A/src/modeles/Salle.java index 9b57cde..f4d3e40 100644 --- a/JAVA/PROJET-PMT_STRI1A/src/modeles/Salle.java +++ b/JAVA/PROJET-PMT_STRI1A/src/modeles/Salle.java @@ -1,6 +1,4 @@ -/** - * - */ + package modeles; import java.util.ArrayList; @@ -11,7 +9,7 @@ import java.util.List; * */ public class Salle { - private int positionX; + public static int positionX; /** * @param positionX * @param positionY @@ -19,28 +17,33 @@ public class Salle { * @param listeEnnemie * @param listePorte */ - public Salle(int positionX, int positionY, boolean sortie, List listeEnnemie, List listePorte) { + + public Salle(int positionX, int positionY, boolean sortie, List listeEnnemie, List listePorte) { this.positionX = positionX; this.positionY = positionY; this.sortie = sortie; this.listeEnnemie = listeEnnemie; this.listePorte = listePorte; } + public Salle() { + + } - private int positionY; - private boolean sortie; - private List listeEnnemie= new ArrayList(); - private List listePorte = new ArrayList(); + private static int positionY; + private static boolean sortie; + private static List listeEnnemie= new ArrayList(); + private static List listePorte = new ArrayList(); + public String getType(){ return "salle"; } public int getPositionX() { - return this.positionX; + return positionX; } public int getPositionY() { - return this.positionY; + return positionY; } public boolean estSortie() { diff --git a/JAVA/PROJET-PMT_STRI1A/src/modeles/Snippet.java b/JAVA/PROJET-PMT_STRI1A/src/modeles/Snippet.java deleted file mode 100644 index 3bfa5e3..0000000 --- a/JAVA/PROJET-PMT_STRI1A/src/modeles/Snippet.java +++ /dev/null @@ -1,7 +0,0 @@ -package modeles; - -public class Snippet { - public static void main(String[] args) { - org.json } -} - diff --git a/JAVA/PROJET-PMT_STRI1A/src/modeles/parseurJson.java b/JAVA/PROJET-PMT_STRI1A/src/modeles/parseurJson.java deleted file mode 100644 index e6165e0..0000000 --- a/JAVA/PROJET-PMT_STRI1A/src/modeles/parseurJson.java +++ /dev/null @@ -1,17 +0,0 @@ -package modeles; - -import java.io.FileReader; -import java.util.Iterator; -import java.util.Map; -import org.json.*; -import org.json.simple.JSONArray; -import org.json.simple.JSONObject; -import org.json.simple.parser.*; - -import jdk.nashorn.internal.parser.JSONParser; -import jdk.nashorn.internal.runtime.JSONListAdapter; -public class parseurJson { - Object obj = new JSONParser().parse(new FileReader("map.json")); - JSONObject = jo = (JSONObject) obj; - -} diff --git a/JAVA/PROJET-PMT_STRI1A/src/module-info.java b/JAVA/PROJET-PMT_STRI1A/src/module-info.java index cf59b57..92d135a 100644 --- a/JAVA/PROJET-PMT_STRI1A/src/module-info.java +++ b/JAVA/PROJET-PMT_STRI1A/src/module-info.java @@ -7,5 +7,6 @@ */ module projet { requires gson; - + requires java.sql; + opens modeles to gson; } \ No newline at end of file