diff --git a/README.md b/README.md index b499780..c304bab 100644 --- a/README.md +++ b/README.md @@ -18,5 +18,5 @@ Les fichiers de tests se trouvent dans le dossier ``tests``. Actuellement, nous avons terminé la complétion/nettoyage par Moyenne/Régression Linéaire. Nous allons donc voir pour l'interface graphique. -Le fichier qui permet de tester l'ouverture du fichier Test3 pour l'évaluation est le fichier ``ecoparasite.LectureEval``. -Ce fichier a été réalisé par Benjamin THOREL. \ No newline at end of file +Le fichier qui permet de tester l'ouverture du fichier Test2 pour l'évaluation est le fichier ``ecoparasite.LectureEvaltest2``. +Ce fichier a été réalisé par Sébastien BOUSQUET. \ No newline at end of file diff --git a/src/ecoparasite/poisson/Poisson.java b/src/ecoparasite/poisson/Poisson.java index f0deeee..425a5da 100644 --- a/src/ecoparasite/poisson/Poisson.java +++ b/src/ecoparasite/poisson/Poisson.java @@ -77,6 +77,13 @@ public class Poisson{ this.infestation = infestation; } + /** + * Setter de l'attribut length + * @param length le Double de la nouvelle valeur de length + */ + public void setLength(Double length) { + this.length = length; + } /** * Setter de l'attribut des parties de poisson. diff --git a/src/ecoparasite/svg/SVGFactory/SVGFactory.java b/src/ecoparasite/svg/SVGFactory/SVGFactory.java new file mode 100644 index 0000000..acaa757 --- /dev/null +++ b/src/ecoparasite/svg/SVGFactory/SVGFactory.java @@ -0,0 +1,76 @@ +package ecoparasite.svg.SVGFactory; + +import ecoparasite.svg.elements.Element; + +import java.io.FileWriter; +import java.io.IOException; +import java.util.HashSet; +import java.util.UUID; + +public class SVGFactory { + + static final private String EXPORT_PATH = "export/"; + static final private String EXTENSION = ".svg"; + + public static boolean createSVG(HashSet mesElements){ + + String code = createSVGCode(mesElements); + + try { + createFile(code); + } catch (Exception e) { + return false; + } + + return true; + } + + public static boolean createSVG(HashSet mesElements, String filename) { + + String code = createSVGCode(mesElements); + + try { + createFile(code,filename); + } catch (Exception e) { + return false; + } + + return true; + } + + public static String createSVGCode(HashSet mesElements){ + + String code = ""; + + for (Element e : mesElements){ + + code += e.toSVG(); + + } + + code += ""; + + return code; + } + + public static void createFile(String data) throws IOException { + String id = UUID.randomUUID().toString(); + createFile(data,id); + } + + public static void createFile(String data, String filename) throws IOException { + + // create a FileWriter object with the file name + FileWriter writer = new FileWriter(EXPORT_PATH + filename + EXTENSION); + + // write the string to the file + writer.write(data); + + // close the writer + writer.close(); + + System.out.println("Successfully wrote text to file."); + + } + +} diff --git a/src/ecoparasite/svg/elements/Element.java b/src/ecoparasite/svg/elements/Element.java new file mode 100644 index 0000000..8ed3386 --- /dev/null +++ b/src/ecoparasite/svg/elements/Element.java @@ -0,0 +1,12 @@ +package ecoparasite.svg.elements; + +public class Element { + + public Element() { + System.out.println("Un Element... Non implémenter encore"); + } + + public String toSVG() { + return "une string"; + } +} diff --git a/tests/ecoparasite/poisson/MackerelSerraTest.java b/tests/ecoparasite/poisson/MackerelSerraTest.java new file mode 100644 index 0000000..4e76946 --- /dev/null +++ b/tests/ecoparasite/poisson/MackerelSerraTest.java @@ -0,0 +1,23 @@ +package ecoparasite.poisson; + +import ecoparasite.input.InputFactory; +import ecoparasite.input.InputFileException; +import ecoparasite.input.RawData; +import ecoparasite.input.RawDataOverflow; +import org.junit.jupiter.api.Test; + +import java.util.HashSet; + +import static org.junit.jupiter.api.Assertions.*; + +class MackerelSerraTest { + + @Test + void parse() throws InputFileException, RawDataOverflow { + RawData test = InputFactory.readData("test2.csv", ","); + + HashSet testp = MackerelSerra.parse(test); + + System.out.println(testp); + } +} \ No newline at end of file diff --git a/tests/ecoparasite/svg/SVGFactory/SVGFactoryTest.java b/tests/ecoparasite/svg/SVGFactory/SVGFactoryTest.java new file mode 100644 index 0000000..73fd82d --- /dev/null +++ b/tests/ecoparasite/svg/SVGFactory/SVGFactoryTest.java @@ -0,0 +1,25 @@ +package ecoparasite.svg.SVGFactory; + +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.*; + +class SVGFactoryTest { + + @Test + void createSVGCode() { + + //String ret = SVGFactory.createSVGCode(); + + //System.out.println(ret); + } + + @Test + void testCreateFile() { + + //String ret = SVGFactory.createSVGCode(); + + //SVGFactory.createFile(ret); + + } +} \ No newline at end of file