Compare commits
3 Commits
9ee8a06dd6
...
25.03.26
| Author | SHA1 | Date | |
|---|---|---|---|
| 2bf0ca34df | |||
| 73e91b3264 | |||
| 4902c2c492 |
34
Projet.iml
34
Projet.iml
@@ -7,5 +7,39 @@
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="module-library" scope="TEST">
|
||||
<library name="JUnit6">
|
||||
<CLASSES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/junit/jupiter/junit-jupiter/6.0.0/junit-jupiter-6.0.0.jar!/" />
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/junit/jupiter/junit-jupiter-api/6.0.0/junit-jupiter-api-6.0.0.jar!/" />
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/opentest4j/opentest4j/1.3.0/opentest4j-1.3.0.jar!/" />
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/junit/platform/junit-platform-commons/6.0.0/junit-platform-commons-6.0.0.jar!/" />
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/apiguardian/apiguardian-api/1.1.2/apiguardian-api-1.1.2.jar!/" />
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/jspecify/jspecify/1.0.0/jspecify-1.0.0.jar!/" />
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/junit/jupiter/junit-jupiter-params/6.0.0/junit-jupiter-params-6.0.0.jar!/" />
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/junit/jupiter/junit-jupiter-engine/6.0.0/junit-jupiter-engine-6.0.0.jar!/" />
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/junit/platform/junit-platform-engine/6.0.0/junit-platform-engine-6.0.0.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
</library>
|
||||
</orderEntry>
|
||||
<orderEntry type="module-library">
|
||||
<library>
|
||||
<CLASSES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/junit/jupiter/junit-jupiter/6.0.0/junit-jupiter-6.0.0.jar!/" />
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/junit/jupiter/junit-jupiter-api/6.0.0/junit-jupiter-api-6.0.0.jar!/" />
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/opentest4j/opentest4j/1.3.0/opentest4j-1.3.0.jar!/" />
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/junit/platform/junit-platform-commons/6.0.0/junit-platform-commons-6.0.0.jar!/" />
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/apiguardian/apiguardian-api/1.1.2/apiguardian-api-1.1.2.jar!/" />
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/jspecify/jspecify/1.0.0/jspecify-1.0.0.jar!/" />
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/junit/jupiter/junit-jupiter-params/6.0.0/junit-jupiter-params-6.0.0.jar!/" />
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/junit/jupiter/junit-jupiter-engine/6.0.0/junit-jupiter-engine-6.0.0.jar!/" />
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/junit/platform/junit-platform-engine/6.0.0/junit-platform-engine-6.0.0.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
</library>
|
||||
</orderEntry>
|
||||
</component>
|
||||
</module>
|
||||
@@ -46,7 +46,7 @@ namespace ecoparasite {
|
||||
namespace ecoparasite.poissons {
|
||||
|
||||
class Poisson {
|
||||
- String specie
|
||||
- String id
|
||||
- Double length
|
||||
- Double weight
|
||||
- Double infestation
|
||||
|
||||
4
data/test.csv
Normal file
4
data/test.csv
Normal file
@@ -0,0 +1,4 @@
|
||||
Sample_code;Station;Latitude;Longitude;Depth;d13C_raw;d13C_corr;d15N;C_N;StandardLength;TrophicLevel;Anisakis_abdominalcavity;Anisakis_Liver;Anisakis_gonads;Anisakis_stomach;NParasitesViscera;Anisakis_Muscle_Right;Anisakis_Muscle_Left;Aniskis_Muscle_total;NParasitesTotal
|
||||
TRACTRA_S0575_A0439;S0575;48.8692264;-4.3976635;96.84;-20.09735065;-19.14374028;12.52361179;4.316778148;257;3.117572211;7;1;0;1;9;1;3;4;13
|
||||
TRACTRA_S0575_A0440;S0575;48.8692264;-4.3976635;96.84;-20.02738845;-19.42703789;12.25444555;3.959950061;252;3.038405671;263;5;0;21;289;12;11;23;312
|
||||
TRACTRA_S0575_A0441;S0575;48.8692264;-4.3976635;96.84;-19.82735569;-18.83090708;12.97020596;4.360049101;254;3.248923438;51;1;12;1;65;2;3;5;70
|
||||
|
@@ -4,7 +4,10 @@ import ecoparasite.poisson.Poisson;
|
||||
|
||||
import java.util.HashSet;
|
||||
|
||||
/**
|
||||
* Interface définissant la fonction de Parsing des données
|
||||
*/
|
||||
public interface DataParsing {
|
||||
|
||||
public HashSet<Poisson> parse(RawData data);
|
||||
public HashSet<Poisson> parse(RawData data) throws RawDataOverflow;
|
||||
}
|
||||
|
||||
43
src/ecoparasite/input/RawDataTest.java
Normal file
43
src/ecoparasite/input/RawDataTest.java
Normal file
@@ -0,0 +1,43 @@
|
||||
package ecoparasite.input;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
import ecoparasite.input.RawData;
|
||||
|
||||
import java.util.HashSet;
|
||||
|
||||
class RawDataTest {
|
||||
|
||||
|
||||
@Test
|
||||
void getColumnsNames() throws InputFileException {
|
||||
RawData test = InputFactory.readData("test.csv");
|
||||
|
||||
HashSet<String> d = new HashSet<>();
|
||||
|
||||
for (int i = 0; i < test.getData().size(); i++){
|
||||
d.add(test.getData().get(i).getFirst());
|
||||
}
|
||||
|
||||
System.out.println(test.getColumnsNames());
|
||||
System.out.println(d);
|
||||
|
||||
assertIterableEquals(test.getColumnsNames(),d);
|
||||
}
|
||||
|
||||
@Test
|
||||
void getDataFromColumn() throws InputFileException {
|
||||
RawData test = InputFactory.readData("test.csv");
|
||||
|
||||
System.out.println(test.getDataFromColumn("Sample_code"));
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
void getEntry() throws InputFileException, RawDataOverflow {
|
||||
RawData test = InputFactory.readData("test.csv");
|
||||
|
||||
System.out.println(test.getEntry(2));
|
||||
}
|
||||
}
|
||||
@@ -2,24 +2,48 @@ package ecoparasite.poisson;
|
||||
|
||||
import ecoparasite.input.DataParsing;
|
||||
import ecoparasite.input.RawData;
|
||||
import ecoparasite.input.RawDataOverflow;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
|
||||
import static java.lang.Double.valueOf;
|
||||
|
||||
/**
|
||||
* Hérite de Poisson.
|
||||
* Ajoute les fonctions de Parsing liés aux données collectées sur le Mackerel.
|
||||
*/
|
||||
public class Mackerel extends Poisson implements DataParsing {
|
||||
public Mackerel(String species, Double length, Double infestation) {
|
||||
super(species, length, null, infestation);
|
||||
|
||||
/**
|
||||
* Constructeur de Mackerel
|
||||
* @param length
|
||||
* @param infestation
|
||||
*/
|
||||
public Mackerel(String id, Double length, Double infestation) {
|
||||
super(id, length, null, infestation);
|
||||
}
|
||||
|
||||
/**
|
||||
* Implémentation de la fonction parse de Dataparsing
|
||||
* @param data
|
||||
* @return tableau des poissons
|
||||
*/
|
||||
@Override
|
||||
public HashSet<Poisson> parse(RawData data) {
|
||||
public HashSet<Poisson> parse(RawData data) throws RawDataOverflow {
|
||||
|
||||
HashMap<String,String> temp = new HashMap<>();
|
||||
|
||||
HashSet<Poisson> fishSet;
|
||||
fishSet = new HashSet<>();
|
||||
|
||||
for (int i = 0; i < data.getData().getFirst().size(); i++) {
|
||||
temp = data.getEntry(i);
|
||||
Poisson newP = new Mackerel(temp.get("Sample_code"),valueOf(temp.get("StandardLength")),valueOf(temp.get("NParasitesViscera")));
|
||||
|
||||
fishSet.add(newP);
|
||||
}
|
||||
|
||||
|
||||
return fishSet;
|
||||
}
|
||||
|
||||
@@ -2,9 +2,13 @@ package ecoparasite.poisson;
|
||||
|
||||
import ecoparasite.input.DataParsing;
|
||||
import ecoparasite.input.RawData;
|
||||
import ecoparasite.input.RawDataOverflow;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
|
||||
import static java.lang.Double.valueOf;
|
||||
|
||||
/**
|
||||
* Hérite de Poisson.
|
||||
* Ajoute les fonctions de Parsing liés aux données collectées sur le Merlu.
|
||||
@@ -16,8 +20,8 @@ public class Merlu extends Poisson implements DataParsing {
|
||||
* @param length Un Wrapper Double representant la longueur/taille du poisson
|
||||
* @param infestation Un Wrapper Double representant le taux de parasite du poisson
|
||||
*/
|
||||
public Merlu(Double length, Double infestation) {
|
||||
super("Merlu", length, null, infestation);
|
||||
public Merlu(String id, Double length, Double infestation) {
|
||||
super(id, length, null, infestation);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -26,11 +30,20 @@ public class Merlu extends Poisson implements DataParsing {
|
||||
* @return tableau des poissons
|
||||
*/
|
||||
@Override
|
||||
public HashSet<Poisson> parse(RawData data) { //TODO
|
||||
public HashSet<Poisson> parse(RawData data) throws RawDataOverflow {
|
||||
|
||||
HashMap<String,String> temp = new HashMap<>();
|
||||
|
||||
HashSet<Poisson> fishSet;
|
||||
fishSet = new HashSet<>();
|
||||
|
||||
for (int i = 0; i < data.getData().getFirst().size(); i++) {
|
||||
temp = data.getEntry(i);
|
||||
Poisson newP = new Merlu(temp.get("nom.merlu"),valueOf(temp.get("m.size")),valueOf(temp.get("number of Anisakis sp L3")));
|
||||
|
||||
fishSet.add(newP);
|
||||
}
|
||||
|
||||
|
||||
return fishSet;
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ import java.util.HashSet;
|
||||
*/
|
||||
public class Poisson{
|
||||
|
||||
private String specie;
|
||||
private String id;
|
||||
private Double length;
|
||||
private Double weight;
|
||||
private Double infestation;
|
||||
@@ -16,13 +16,13 @@ public class Poisson{
|
||||
|
||||
/**
|
||||
* Constructeur de l'objet Poisson
|
||||
* @param specie Une String representant l'espece du poisson
|
||||
* @param id Une String representant l'espece du poisson
|
||||
* @param length Un Wrapper Double representant la longueur/taille du poisson
|
||||
* @param weight Un Wrapper Double representant le poids du poisson
|
||||
* @param infestation Un Wrapper Double representant le taux de parasite du poisson
|
||||
*/
|
||||
public Poisson(String specie, Double length, Double weight, Double infestation){
|
||||
this.specie = specie;
|
||||
public Poisson(String id, Double length, Double weight, Double infestation){
|
||||
this.id = id;
|
||||
this.length = length;
|
||||
this.weight = weight;
|
||||
this.infestation = infestation;
|
||||
@@ -30,11 +30,11 @@ public class Poisson{
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter de l'attribut specie
|
||||
* @return La string de l'attribut specie
|
||||
* Getter de l'attribut Id
|
||||
* @return La string de l'attribut Id
|
||||
*/
|
||||
public String getSpecie() {
|
||||
return specie;
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
36
src/ecoparasite/test/InputFactoryTest.java
Normal file
36
src/ecoparasite/test/InputFactoryTest.java
Normal file
@@ -0,0 +1,36 @@
|
||||
package ecoparasite.test;
|
||||
|
||||
|
||||
import static ecoparasite.input.InputFactory.*;
|
||||
import static org.junit.jupiter.api.Assertions.assertArrayEquals;
|
||||
|
||||
import ecoparasite.input.InputFactory;
|
||||
import ecoparasite.input.InputFileException;
|
||||
import ecoparasite.input.RawData;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
class InputFactoryTest{
|
||||
|
||||
@org.junit.jupiter.api.Test
|
||||
void buildDataPath() {
|
||||
|
||||
String d = "data/Campagne/mackerel.97442.csv";
|
||||
String e = "data/Campagne/merlu2018_75164.csv";
|
||||
|
||||
assertArrayEquals(d.toCharArray(), InputFactory.buildDataPath("Campagne/mackerel.97442.csv").toCharArray());
|
||||
assertArrayEquals(e.toCharArray(), InputFactory.buildDataPath("Campagne/merlu2018_75164.csv").toCharArray());
|
||||
|
||||
}
|
||||
|
||||
@org.junit.jupiter.api.Test
|
||||
void readData() throws InputFileException {
|
||||
RawData test = InputFactory.readData("test.csv");
|
||||
|
||||
System.out.println(test.getData());
|
||||
|
||||
}
|
||||
|
||||
@org.junit.jupiter.api.Test
|
||||
void testReadData() {
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user