JavaDoc et Gradation des axes Dones
This commit is contained in:
@@ -20,16 +20,13 @@ import ecoparasite.svg.SVGFactory;
|
|||||||
import ecoparasite.svg.elements.Element;
|
import ecoparasite.svg.elements.Element;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.Scanner;
|
|
||||||
import java.util.function.BiConsumer;
|
import java.util.function.BiConsumer;
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
|
|
||||||
public class Application {
|
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){
|
public static void validFileName(File dir, HashSet<String> listeName){
|
||||||
|
|
||||||
@@ -51,30 +48,24 @@ public class Application {
|
|||||||
String name = "";
|
String name = "";
|
||||||
boolean isValid = false;
|
boolean isValid = false;
|
||||||
|
|
||||||
|
/*
|
||||||
File dir = new File("data");
|
File dir = new File("data");
|
||||||
|
|
||||||
HashSet<String> listeName = new HashSet<>();
|
HashSet<String> listeName = new HashSet<>();
|
||||||
|
|
||||||
Application.validFileName(dir,listeName);
|
Application.validFileName(dir,listeName);
|
||||||
|
*/
|
||||||
|
|
||||||
while (!isValid) {
|
while (!isValid) {
|
||||||
System.out.println("Veuillez rentrez le nom du fichier :");
|
System.out.println("Veuillez rentrez le nom du fichier :");
|
||||||
name = sc.nextLine();
|
name = sc.nextLine();
|
||||||
|
|
||||||
if (listeName.contains(name)){
|
for (int i = 0; i < 3; i++) {
|
||||||
for (int i = 0; i < 3; i++) {
|
if (name.contains(VALID_FILES[i])){
|
||||||
if (VALID_FILES[i] == name){
|
isValid = true;
|
||||||
isValid = true;
|
break;
|
||||||
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;
|
return name;
|
||||||
@@ -166,21 +157,18 @@ public class Application {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Nettoyage de la taille.
|
// Nettoyage de la taille.
|
||||||
Function<Population,Double> getWeight = population -> {
|
Function<Population,Double> getLength = population -> {
|
||||||
return population.getTotal().getLength() != null ? population.getTotal().getLength().transformToDouble() : null;
|
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);
|
population.getTotal().setLength(aDouble != null ? new PopulationArgInterval(aDouble,aDouble) : null);
|
||||||
};
|
};
|
||||||
|
|
||||||
Function<Population,Double> getInfes = population -> {
|
Function<Population,Double> getInfes = population -> {
|
||||||
return population.getTotal().getAbondance() != null ? population.getTotal().getPrevalence().transformToDouble() : null;
|
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("---");
|
System.out.println("---");
|
||||||
index = 1;
|
index = 1;
|
||||||
for( Population p: popSet){
|
for( Population p: popSet){
|
||||||
@@ -188,14 +176,14 @@ public class Application {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Complétion de la masse.
|
// Complétion de la masse.
|
||||||
popSet = Completion.completeColumnsMoyenne(popSet, getWeight, setWeight);
|
popSet = Completion.completeColumnsMoyenne(popSet, getLength, setLength);
|
||||||
System.out.println("---");
|
System.out.println("---");
|
||||||
for( Population p: popSet){
|
for( Population p: popSet){
|
||||||
System.out.println(String.valueOf(index++) + p);
|
System.out.println(String.valueOf(index++) + p);
|
||||||
}
|
}
|
||||||
|
|
||||||
HashSet<ValeursXY> merluXY = ValeursXY.convertToXY( popSet, getLength, getInfes );
|
HashSet<ValeursXY> popXY = ValeursXY.convertToXY( popSet, getLength, getInfes );
|
||||||
HashMap<String, ArrayList<Double>> axes = SVGBuilder.calcPointAxes( merluXY );
|
HashMap<String, ArrayList<Double>> axes = SVGBuilder.calcPointAxes( popXY );
|
||||||
System.out.println( axes );
|
System.out.println( axes );
|
||||||
|
|
||||||
SVGBuilder axesInstance;
|
SVGBuilder axesInstance;
|
||||||
@@ -209,10 +197,12 @@ public class Application {
|
|||||||
|
|
||||||
ArrayList<Element> elements = new ArrayList<>();
|
ArrayList<Element> elements = new ArrayList<>();
|
||||||
|
|
||||||
elements.addAll(buildAxes(XLabel, YLabel));
|
elements.addAll(axesInstance.buildAxes("Taille en mm", "Abondance"));
|
||||||
elements.addAll(buildXTicks());
|
elements.addAll(axesInstance.buildXTicks());
|
||||||
elements.addAll(buildYTicks());
|
elements.addAll(axesInstance.buildYTicks());
|
||||||
elements.addAll(buildPoints(points));
|
elements.addAll(axesInstance.buildPoints(popXY));
|
||||||
|
|
||||||
|
SVGFactory.createSVG(elements);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void main(String[] args) throws InputFileException, RawDataOverflow {
|
public static void main(String[] args) throws InputFileException, RawDataOverflow {
|
||||||
|
|||||||
Reference in New Issue
Block a user