5 Commits

Author SHA1 Message Date
9026c901ba Actualiser src/ecoparasite/poisson/Poisson.java 2026-04-01 13:07:52 +00:00
19bf68c2aa JavaDoc et Completion Bullshit. 2026-04-01 15:05:16 +02:00
6e4b3337fb JavaDoc et Completion Bullshit. Par sure qu'elle reste en "completion" 2026-04-01 14:34:26 +02:00
38a5e37380 Merge pull request '31.03.26' (#4) from 31.03.26 into master
Reviewed-on: #4
2026-03-31 17:01:36 +00:00
3a6968f40f A lot of things.
- Change tests directory location.
- Fix Merlu CSV UTF8 encoding.
- Make classes for ParasitesPeru2021.csv Parsing.
2026-03-31 19:00:19 +02:00
22 changed files with 574 additions and 60 deletions

View File

@@ -4,6 +4,7 @@
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/tests" isTestSource="true" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />

View File

@@ -1,4 +1,4 @@
nom.merlu;m.size (mm);number of Anisakis sp L3;m.d15N (<EFBFBD>);m.d13C (<EFBFBD>);m.C/N;m.MeHg (ng g-1 dw);m.IHg (ng g-1 dw);m.THg (ng g-1 dw);m.PCB 101 (ng g-1 dw);m.PCB 118 (ng g-1 dw);m.PCB 138 (ng g-1 dw);m.PCB 149 (ng g-1 dw);m.PCB 153 (ng g-1 dw);m.PCB 180 (ng g-1 dw);m.PCB 194 (ng g-1 dw);m.HHCB (ng g-1 dw);m.AHTN (ng g-1 dw);m.EHMC (ng g-1 dw);;a.d15N (<EFBFBD>);a.d13C (<EFBFBD>);a.CN;a.MeHg (ng g-1 dw);a.IHg (ng g-1 dw);a.THg (ng g-1 dw);a.PCB 101 (ng g-1 dw);a.PCB 118 (ng g-1 dw);a.PCB 138 (ng g-1 dw);a.PCB 149 (ng g-1 dw);a.PCB 153 (ng g-1 dw);a.PCB 180 (ng g-1 dw);a.PCB 194 (ng g-1 dw);a.HHCB (ng g-1 dw);a.AHTN (ng g-1 dw);a.OC (ng g-1 dw)
nom.merlu;m.size (mm);number of Anisakis sp L3;m.d15N ();m.d13C ();m.C/N;m.MeHg (ng g-1 dw);m.IHg (ng g-1 dw);m.THg (ng g-1 dw);m.PCB 101 (ng g-1 dw);m.PCB 118 (ng g-1 dw);m.PCB 138 (ng g-1 dw);m.PCB 149 (ng g-1 dw);m.PCB 153 (ng g-1 dw);m.PCB 180 (ng g-1 dw);m.PCB 194 (ng g-1 dw);m.HHCB (ng g-1 dw);m.AHTN (ng g-1 dw);m.EHMC (ng g-1 dw);;a.d15N ();a.d13C ();a.CN;a.MeHg (ng g-1 dw);a.IHg (ng g-1 dw);a.THg (ng g-1 dw);a.PCB 101 (ng g-1 dw);a.PCB 118 (ng g-1 dw);a.PCB 138 (ng g-1 dw);a.PCB 149 (ng g-1 dw);a.PCB 153 (ng g-1 dw);a.PCB 180 (ng g-1 dw);a.PCB 194 (ng g-1 dw);a.HHCB (ng g-1 dw);a.AHTN (ng g-1 dw);a.OC (ng g-1 dw)
150318 HKE01;425;237;13.36;-18.23;3.10;610.21;244.26;854.48;2.85;1.59;28.78;9.10;32.84;22.60;3.40;1.26;<LOQ;<LOQ;;10.84;-19.32;5.88;67.69;8.57;76.26;18.26;10.74;45.90;17.54;41.19;32.64;<LOQ;<LOQ;<LOQ;83.21
150318 HKE08;527;276;13.44;-18.22;3.15;749.39;1110.64;1860.03;3.25;1.32;27.91;8.73;34.12;22.66;1.73;0.19;<LOQ;<LOQ;;11.57;-18.74;5.01;77.88;14.85;92.73;11.56;6.56;31.88;15.19;37.80;21.68;<LOQ;3.38;2.31;63.30
150318 HKE09;540;454;13.53;-17.99;3.11;796.23;299.18;1095.40;3.74;3.39;25.72;9.04;32.81;13.87;2.80;1.09;0.11;<LOQ;;11.13;-18.69;5.23;86.01;16.39;102.40;10.74;9.06;63.45;22.81;73.25;47.00;<LOQ;1.96;<LOQ;36.78
1 nom.merlu m.size (mm) number of Anisakis sp L3 m.d15N (‰) m.d13C (‰) m.C/N m.MeHg (ng g-1 dw) m.IHg (ng g-1 dw) m.THg (ng g-1 dw) m.PCB 101 (ng g-1 dw) m.PCB 118 (ng g-1 dw) m.PCB 138 (ng g-1 dw) m.PCB 149 (ng g-1 dw) m.PCB 153 (ng g-1 dw) m.PCB 180 (ng g-1 dw) m.PCB 194 (ng g-1 dw) m.HHCB (ng g-1 dw) m.AHTN (ng g-1 dw) m.EHMC (ng g-1 dw) a.d15N (‰) a.d13C (‰) a.CN a.MeHg (ng g-1 dw) a.IHg (ng g-1 dw) a.THg (ng g-1 dw) a.PCB 101 (ng g-1 dw) a.PCB 118 (ng g-1 dw) a.PCB 138 (ng g-1 dw) a.PCB 149 (ng g-1 dw) a.PCB 153 (ng g-1 dw) a.PCB 180 (ng g-1 dw) a.PCB 194 (ng g-1 dw) a.HHCB (ng g-1 dw) a.AHTN (ng g-1 dw) a.OC (ng g-1 dw)
2 150318 HKE01 425 237 13.36 -18.23 3.10 610.21 244.26 854.48 2.85 1.59 28.78 9.10 32.84 22.60 3.40 1.26 <LOQ <LOQ 10.84 -19.32 5.88 67.69 8.57 76.26 18.26 10.74 45.90 17.54 41.19 32.64 <LOQ <LOQ <LOQ 83.21
3 150318 HKE08 527 276 13.44 -18.22 3.15 749.39 1110.64 1860.03 3.25 1.32 27.91 8.73 34.12 22.66 1.73 0.19 <LOQ <LOQ 11.57 -18.74 5.01 77.88 14.85 92.73 11.56 6.56 31.88 15.19 37.80 21.68 <LOQ 3.38 2.31 63.30
4 150318 HKE09 540 454 13.53 -17.99 3.11 796.23 299.18 1095.40 3.74 3.39 25.72 9.04 32.81 13.87 2.80 1.09 0.11 <LOQ 11.13 -18.69 5.23 86.01 16.39 102.40 10.74 9.06 63.45 22.81 73.25 47.00 <LOQ 1.96 <LOQ 36.78

View File

@@ -1,4 +1,9 @@
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
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
TRACTRA_S0575_A0442;S0575;48.8692264;-4.3976635;96.84;-19.37802102;-18.26777864;13.43393806;4.4749923;242;3.385315231;158;6;0;1;165;9;19;28;193
TRACTRA_S0575_A0443;S0575;48.8692264;-4.3976635;96.84;-18.20541518;-18.20541518;12.68793425;3.369189318;254;3.165902347;67;1;10;1;79;1;6;7;86
TRACTRA_S0575_A0444;S0575;48.8692264;-4.3976635;96.84;-20.21559661;-18.91007641;12.62442312;4.672242625;251;3.147222601;140;1;0;0;141;3;6;9;150
TRACTRA_S0575_A0888;S0575;48.8692264;-4.3976635;96.84;-20.21559661;-18.91007641;12.62442312;4.672242625;259;3.147222601;;;;;;;;;
TRACTRA_S0575_A0445;S0575;48.8692264;-4.3976635;96.84;-19.43517323;-19.13886211;11.25439721;3.65283952;258;2.744273805;281;5;0;3;289;1;8;9;298
1 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
2 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
3 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
4 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
5 TRACTRA_S0575_A0442 S0575 48.8692264 -4.3976635 96.84 -19.37802102 -18.26777864 13.43393806 4.4749923 242 3.385315231 158 6 0 1 165 9 19 28 193
6 TRACTRA_S0575_A0443 S0575 48.8692264 -4.3976635 96.84 -18.20541518 -18.20541518 12.68793425 3.369189318 254 3.165902347 67 1 10 1 79 1 6 7 86
7 TRACTRA_S0575_A0444 S0575 48.8692264 -4.3976635 96.84 -20.21559661 -18.91007641 12.62442312 4.672242625 251 3.147222601 140 1 0 0 141 3 6 9 150
8 TRACTRA_S0575_A0888 S0575 48.8692264 -4.3976635 96.84 -20.21559661 -18.91007641 12.62442312 4.672242625 259 3.147222601
9 TRACTRA_S0575_A0445 S0575 48.8692264 -4.3976635 96.84 -19.43517323 -19.13886211 11.25439721 3.65283952 258 2.744273805 281 5 0 3 289 1 8 9 298

View File

@@ -0,0 +1,35 @@
package ecoparasite.completion;
import ecoparasite.poisson.Poisson;
import java.util.HashSet;
public class Completion {
public static HashSet<Poisson> completePoisson(HashSet<Poisson> tablePoisson){
double mean = mean(tablePoisson);
for (Poisson p : tablePoisson) {
if ( p.getInfestation().isNaN() ) {
p.setInfestation(mean);
}
}
return tablePoisson;
}
private static double mean(HashSet<Poisson> tablePoisson){
double mean = 0.0;
for (Poisson p : tablePoisson){
mean += p.getInfestation();
}
return mean / tablePoisson.size();
}
}

View File

@@ -9,5 +9,7 @@ import java.util.HashSet;
*/
public interface DataParsing {
public HashSet<Poisson> parse(RawData data) throws RawDataOverflow;
public static HashSet<Poisson> parse(RawData data) throws RawDataOverflow {
return null;
}
}

View File

@@ -18,6 +18,7 @@ public class InputFactory {
final public static String DATA_MACKEREL = "Campagne/mackerel.97442.csv";
final public static String DATA_MERLU = "Campagne/merlu2018_75164.csv";
final public static String DATA_PARASITES_PERU = "Combinés/ParasitesPeru2021.csv";
/**
* Construit le chemin vers le fichier de données voulu.

View File

@@ -110,7 +110,7 @@ public class RawData {
HashMap<String,String> entry = new HashMap<>();
for( ArrayList<String> row : data ){
if( index > row.size()){
if( index >= row.size()){
throw new RawDataOverflow( index, row.size() );
}
entry.put( row.getFirst(), row.get( index ) );

View File

@@ -0,0 +1,63 @@
package ecoparasite.nettoyage;
import ecoparasite.poisson.Poisson;
import java.util.HashSet;
public class Nettoyage {
/**
*
* @param tablePoisson
* @return
*/
public static HashSet<Poisson> nettoiePoisson(HashSet<Poisson> tablePoisson){
double mean = mean(tablePoisson); //Moyenne
double ecart = ecartType(tablePoisson); // Ecart Type
double z = 0;
for (Poisson p : tablePoisson) {
z = ( p.getInfestation() - mean ) / ecart;
if ( z >= 3 ) {
p.setInfestation(mean);
}
}
return tablePoisson;
}
private static double mean(HashSet<Poisson> tablePoisson){
double mean = 0.0;
for (Poisson p : tablePoisson){
mean += p.getInfestation();
}
return mean / tablePoisson.size();
}
private static double variance(HashSet<Poisson> tablePoisson){
double vari = 0.0;
double mean = mean(tablePoisson);
for (Poisson p : tablePoisson) {
vari += Math.pow( (p.getInfestation() - mean), 2);
}
return vari / tablePoisson.size();
}
private static double ecartType(HashSet<Poisson> tablePoisson){
double vari = variance(tablePoisson);
return Math.sqrt(vari);
}
}

View File

@@ -29,8 +29,7 @@ public class Mackerel extends Poisson implements DataParsing {
* @param data
* @return tableau des poissons
*/
@Override
public HashSet<Poisson> parse(RawData data) throws RawDataOverflow {
public static HashSet<Poisson> parse(RawData data) throws RawDataOverflow {
HashMap<String,String> temp = new HashMap<>();

View File

@@ -29,8 +29,7 @@ public class Merlu extends Poisson implements DataParsing {
* @param data
* @return tableau des poissons
*/
@Override
public HashSet<Poisson> parse(RawData data) throws RawDataOverflow {
public static HashSet<Poisson> parse(RawData data) throws RawDataOverflow {
HashMap<String,String> temp = new HashMap<>();
@@ -39,7 +38,7 @@ public class Merlu extends Poisson implements DataParsing {
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")));
Poisson newP = new Merlu(temp.get("nom.merlu"),valueOf(temp.get("m.size (mm)")),valueOf(temp.get("number of Anisakis sp L3")));
fishSet.add(newP);
}

View File

@@ -67,7 +67,7 @@ public class Poisson{
*/
@Override
public String toString(){
String result = "[ %5s : %4d mm, %4d g, %4d taux d'infestation ]";
return String.format(result, this.getClass().getSimpleName(), this.getLength(), this.getWeight(), this.getInfestation());
String result = "[ %5s : %4f mm, %4f g, %4f taux d'infestation ]";
return String.format(result, this.getClass().getSimpleName(), this.getLength(), this.getWeight(), this.getInfestation() );
}
}

View File

@@ -0,0 +1,50 @@
package ecoparasite.population;
import java.util.HashMap;
import java.util.HashSet;
public class Population {
private String id;
private PopulationArgs total;
private HashMap<Integer,PopulationArgs> perYear;
public Population(String id, PopulationArgs total, HashMap<Integer,PopulationArgs> perYear) {
this.id = id;
this.total = total;
this.perYear = perYear;
}
public Population(String id, PopulationArgs total) {
this.id = id;
this.total = total;
this.perYear = new HashMap<>();
}
public Population(String id) {
this.id = id;
this.total = null;
this.perYear = new HashMap<>();
}
public String getId() {
return id;
}
public PopulationArgs getTotal() {
return total;
}
public HashMap<Integer,PopulationArgs> getPerYear() {
return perYear;
}
public void setTotal(PopulationArgs total) {
this.total = total;
}
public void setPerYear(HashMap<Integer,PopulationArgs> perYear) {
this.perYear = perYear;
}
}

View File

@@ -0,0 +1,60 @@
package ecoparasite.population;
public class PopulationArgInterval {
private Double min;
private Double max;
private Double mean;
public PopulationArgInterval(Double min, Double max, Double mean) {
this.min = min;
this.max = max;
this.mean = mean;
}
public PopulationArgInterval(Double min, Double max) {
this.min = min;
this.max = max;
this.mean = ( this.max + this.min ) / 2;
}
public Double getMin() {
return this.min;
}
public Double getMax() {
return this.max;
}
public Double getMean() {
return this.mean;
}
public Double transformToDouble(){
if( this.min == this.max )
return this.min;
return this.mean;
}
public static PopulationArgInterval fromString( String rawValue ){
if( rawValue.contains( "±" ) ){ // Plus ou moins.
String[] numbers = rawValue.split("±");
Double mean = Double.parseDouble(numbers[0].trim());
Double interval = Double.parseDouble(numbers[1].trim());
return new PopulationArgInterval(mean - interval, mean + interval, mean);
} else if( rawValue.contains( "-" ) ){ // Entre.
String[] numbers = rawValue.split("-");
Double min = Double.parseDouble(numbers[0].trim());
Double max = Double.parseDouble(numbers[1].trim());
return new PopulationArgInterval(min, max);
} else {
Double number = Double.parseDouble(rawValue);
return new PopulationArgInterval(number, number);
}
}
}

View File

@@ -0,0 +1,124 @@
package ecoparasite.population;
public class PopulationArgs {
private int year;
private int number;
private PopulationArgInterval length;
private PopulationArgInterval width;
private PopulationArgInterval prevalence;
private PopulationArgInterval ic;
private Double intensity;
private Double abondance;
public PopulationArgs(
int N,
PopulationArgInterval length,
PopulationArgInterval width,
PopulationArgInterval prevalence,
PopulationArgInterval ic,
Double intensity,
Double abondance
){
this.year = 0;
this.number = N;
this.length = length;
this.width = width;
this.prevalence = prevalence;
this.ic = ic;
this.intensity = intensity;
this.abondance = abondance;
}
public PopulationArgs(
int year,
int N,
PopulationArgInterval length,
PopulationArgInterval width,
PopulationArgInterval prevalence,
PopulationArgInterval ic,
Double intensity,
Double abondance
){
this.year = year;
this.number = N;
this.length = length;
this.width = width;
this.prevalence = prevalence;
this.ic = ic;
this.intensity = intensity;
this.abondance = abondance;
}
public PopulationArgs(
int year
){
this.year = year;
}
public PopulationArgs(){
this.year = 0;
}
public int getYear() {
return year;
}
public int getNumber() {
return number;
}
public PopulationArgInterval getLength() {
return length;
}
public PopulationArgInterval getWidth() {
return width;
}
public PopulationArgInterval getPrevalence() {
return prevalence;
}
public PopulationArgInterval getIc() {
return ic;
}
public Double getIntensity() {
return intensity;
}
public Double getAbondance() {
return abondance;
}
public void setNumber(int number) {
this.number = number;
}
public void setLength(PopulationArgInterval length) {
this.length = length;
}
public void setWidth(PopulationArgInterval width) {
this.width = width;
}
public void setPrevalence(PopulationArgInterval prevalence) {
this.prevalence = prevalence;
}
public void setIc(PopulationArgInterval ic) {
this.ic = ic;
}
public void setIntensity(Double intensity) {
this.intensity = intensity;
}
public void setAbondance(Double abondance) {
this.abondance = abondance;
}
}

View File

@@ -0,0 +1,97 @@
package ecoparasite.population;
import ecoparasite.input.RawData;
import ecoparasite.input.RawDataOverflow;
import java.util.HashMap;
import java.util.HashSet;
public class PopulationParsing {
public static HashMap<String,Population> parseParasitesPeru(RawData peruRawData ){
HashMap<String,Population> response = new HashMap<>();
int index = 1;
try {
while(true){ // Tant que l'on ne fait pas de débordements d'entrées.
HashMap<String,String> fields = peruRawData.getEntry(index);
String espece = fields.get("Espèce");
System.out.println(espece);
String parametre = fields.get("Paramètre");
Population population = null;
if( response.containsKey( espece ) ){
population = response.get(espece);
} else {
population = new Population(espece);
response.put(espece, population);
}
// Traiter le total
if( fields.containsKey( "Total" ) ){
if( population.getTotal() == null ){
population.setTotal( new PopulationArgs() );
}
PopulationParsing.applyValueForParasitesPeru( population.getTotal(), parametre, fields.get("Total") );
}
// Traiter les années.
for( String k: fields.keySet() ){
if( k.equals( "Total" ) || k.equals("Paramètre") || k.equals("Espèce") ) // Déjà traité. Pas des années.
continue;
Integer year = Integer.parseInt(k);
PopulationArgs popArgsYear = null;
if( !population.getPerYear().containsKey(year) ){
popArgsYear = new PopulationArgs( year );
population.getPerYear().put(year, popArgsYear);
} else {
popArgsYear = population.getPerYear().get(year);
}
PopulationParsing.applyValueForParasitesPeru( popArgsYear, parametre, fields.get(k) );
}
response.put( espece, population );
index++;
}
} catch (RawDataOverflow e){
// Stop.
}
return response;
}
private static void applyValueForParasitesPeru( PopulationArgs populationArgs, String column, String value ){
switch( column ){
case "N":
populationArgs.setNumber(Integer.parseInt(value));
break;
case "Longueur moyenne ± SD (cm)":
populationArgs.setLength( PopulationArgInterval.fromString( value ) );
break;
case "Poids moyen ± SD (g)":
populationArgs.setWidth( PopulationArgInterval.fromString( value ) );
break;
case "Prévalence (%)":
populationArgs.setPrevalence( PopulationArgInterval.fromString( value ) );
break;
case "IC 95%":
populationArgs.setIc( PopulationArgInterval.fromString( value ) );
break;
case "Intensité moyenne (étendue)":
populationArgs.setIntensity( Double.parseDouble( value.split( " " )[0] ) );
break;
case "Abondance moyenne":
populationArgs.setAbondance( Double.parseDouble( value ) );
break;
default:
break;
}
}
}

View File

@@ -1,36 +0,0 @@
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() {
}
}

View File

@@ -0,0 +1,28 @@
package ecoparasite.completion;
import ecoparasite.input.InputFactory;
import ecoparasite.input.InputFileException;
import ecoparasite.input.RawData;
import ecoparasite.input.RawDataOverflow;
import ecoparasite.poisson.Mackerel;
import ecoparasite.poisson.Poisson;
import org.junit.jupiter.api.Test;
import java.util.HashSet;
import static org.junit.jupiter.api.Assertions.*;
class CompletionTest {
@org.junit.jupiter.api.Test
void completePoisson() throws InputFileException, RawDataOverflow {
RawData test = InputFactory.readData("test.csv");
HashSet<Poisson> testp = Mackerel.parse(test);
testp = Completion.completePoisson(testp);
System.out.println(testp);
}
}

View File

@@ -1,21 +1,36 @@
package ecoparasite.input;
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;
import java.io.IOException;
import static org.junit.jupiter.api.Assertions.*;
class InputFactoryTest {
// TODO : Test a être effectué par Sébastien.
@Test
void readFile() throws InputFileException, RawDataOverflow {
RawData r = InputFactory.readData( InputFactory.DATA_MACKEREL );
System.out.println( r );
System.out.println( r.getColumnsNames() );
System.out.println( r.getDataFromColumn( "Sample_codE" ) );
System.out.println( r.getEntry( 2 ) );
@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() {
}
}

View File

@@ -3,7 +3,6 @@ package ecoparasite.input;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.*;
import ecoparasite.input.RawData;
import java.util.HashSet;

View File

@@ -0,0 +1,24 @@
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;
class MackerelTest {
@Test
void parse() throws InputFileException, RawDataOverflow {
RawData test = InputFactory.readData( InputFactory.DATA_MACKEREL );
HashSet<Poisson> fishs = Mackerel.parse( test );
for( Poisson poisson : fishs){
System.out.println(poisson);
}
}
}

View File

@@ -0,0 +1,26 @@
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 MerluTest {
@Test
void parse() throws InputFileException, RawDataOverflow {
RawData test = InputFactory.readData( InputFactory.DATA_MERLU );
HashSet<Poisson> fishs = Merlu.parse( test );
for( Poisson poisson : fishs){
System.out.println(poisson);
}
}
}

View File

@@ -0,0 +1,22 @@
package ecoparasite.population;
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.HashMap;
import static org.junit.jupiter.api.Assertions.*;
class PopulationParsingTest {
@Test
void parseParasitesPeru() throws InputFileException, RawDataOverflow {
RawData parasitesPeru = InputFactory.readData( InputFactory.DATA_PARASITES_PERU, "," );
HashMap<String,Population> populations = PopulationParsing.parseParasitesPeru( parasitesPeru );
System.out.println( populations);
}
}