JavaDoc et Gradation des axes Dones

This commit is contained in:
2026-04-29 11:02:31 +02:00
parent 35b2fc2660
commit fa51196427

View File

@@ -20,16 +20,13 @@ import ecoparasite.svg.SVGFactory;
import ecoparasite.svg.elements.Element;
import java.io.File;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Scanner;
import java.util.*;
import java.util.function.BiConsumer;
import java.util.function.Function;
public class Application {
static final String[] VALID_FILES = {"mackerel.97442.csv", "merlu2018_75164.csv","ParasitesPeru2021.csv"};
static final String[] VALID_FILES = {"Campagne/mackerel.97442.csv", "Campagne/merlu2018_75164.csv","Combinés/ParasitesPeru2021.csv"};
public static void validFileName(File dir, HashSet<String> listeName){
@@ -51,30 +48,24 @@ public class Application {
String name = "";
boolean isValid = false;
/*
File dir = new File("data");
HashSet<String> listeName = new HashSet<>();
Application.validFileName(dir,listeName);
*/
while (!isValid) {
System.out.println("Veuillez rentrez le nom du fichier :");
name = sc.nextLine();
if (listeName.contains(name)){
for (int i = 0; i < 3; i++) {
if (VALID_FILES[i] == name){
isValid = true;
break;
}
for (int i = 0; i < 3; i++) {
if (name.contains(VALID_FILES[i])){
isValid = true;
break;
}
if (!isValid){
System.out.println("Ce Fichier existe mais n'est pas valide");
}
} else {
System.out.println("Ce Fichier n'existe pas dans le dossier data.");
}
}
return name;
@@ -166,21 +157,18 @@ public class Application {
}
// Nettoyage de la taille.
Function<Population,Double> getWeight = population -> {
Function<Population,Double> getLength = population -> {
return population.getTotal().getLength() != null ? population.getTotal().getLength().transformToDouble() : null;
};
BiConsumer<Population,Double> setWeight = (population, aDouble) -> {
BiConsumer<Population,Double> setLength = (population, aDouble) -> {
population.getTotal().setLength(aDouble != null ? new PopulationArgInterval(aDouble,aDouble) : null);
};
Function<Population,Double> getInfes = population -> {
return population.getTotal().getAbondance() != null ? population.getTotal().getPrevalence().transformToDouble() : null;
};
BiConsumer<Population,Double> setInfes = (population, aDouble) -> {
population.getTotal().setAbondance(aDouble != null ? new PopulationArgInterval(aDouble,aDouble) : null);
};
popSet = Nettoyage.nettoieColumns(popSet, getWeight, setWeight, false);
popSet = Nettoyage.nettoieColumns(popSet, getLength, setLength, false);
System.out.println("---");
index = 1;
for( Population p: popSet){
@@ -188,14 +176,14 @@ public class Application {
}
// Complétion de la masse.
popSet = Completion.completeColumnsMoyenne(popSet, getWeight, setWeight);
popSet = Completion.completeColumnsMoyenne(popSet, getLength, setLength);
System.out.println("---");
for( Population p: popSet){
System.out.println(String.valueOf(index++) + p);
}
HashSet<ValeursXY> merluXY = ValeursXY.convertToXY( popSet, getLength, getInfes );
HashMap<String, ArrayList<Double>> axes = SVGBuilder.calcPointAxes( merluXY );
HashSet<ValeursXY> popXY = ValeursXY.convertToXY( popSet, getLength, getInfes );
HashMap<String, ArrayList<Double>> axes = SVGBuilder.calcPointAxes( popXY );
System.out.println( axes );
SVGBuilder axesInstance;
@@ -209,10 +197,12 @@ public class Application {
ArrayList<Element> elements = new ArrayList<>();
elements.addAll(buildAxes(XLabel, YLabel));
elements.addAll(buildXTicks());
elements.addAll(buildYTicks());
elements.addAll(buildPoints(points));
elements.addAll(axesInstance.buildAxes("Taille en mm", "Abondance"));
elements.addAll(axesInstance.buildXTicks());
elements.addAll(axesInstance.buildYTicks());
elements.addAll(axesInstance.buildPoints(popXY));
SVGFactory.createSVG(elements);
}
public static void main(String[] args) throws InputFileException, RawDataOverflow {