2026-03-18 13:00:50 +01:00
|
|
|
package ecoparasite;
|
|
|
|
|
|
2026-04-08 14:47:42 +02:00
|
|
|
import ecoparasite.completion.Completion;
|
|
|
|
|
import ecoparasite.input.InputFactory;
|
|
|
|
|
import ecoparasite.input.InputFileException;
|
|
|
|
|
import ecoparasite.input.RawData;
|
|
|
|
|
import ecoparasite.input.RawDataOverflow;
|
|
|
|
|
import ecoparasite.nettoyage.Nettoyage;
|
|
|
|
|
import ecoparasite.poisson.MackerelSerra;
|
|
|
|
|
import ecoparasite.poisson.Poisson;
|
|
|
|
|
import ecoparasite.representation.ValeursXY;
|
2026-04-27 12:56:24 +02:00
|
|
|
import ecoparasite.svg.IncorrectAxesPointsException;
|
2026-04-27 15:18:30 +02:00
|
|
|
import ecoparasite.svg.SVGBuilder;
|
2026-04-27 12:56:24 +02:00
|
|
|
import ecoparasite.svg.SVGFactory;
|
|
|
|
|
import ecoparasite.svg.elements.Element;
|
|
|
|
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
import java.util.HashMap;
|
2026-04-08 14:47:42 +02:00
|
|
|
import java.util.HashSet;
|
|
|
|
|
import java.util.function.BiConsumer;
|
|
|
|
|
import java.util.function.Function;
|
|
|
|
|
|
2026-03-18 13:00:50 +01:00
|
|
|
public class Application {
|
2026-04-27 12:56:24 +02:00
|
|
|
|
2026-04-08 14:47:42 +02:00
|
|
|
public static void main(String[] args) throws InputFileException, RawDataOverflow {
|
|
|
|
|
|
|
|
|
|
RawData rawMackerel = InputFactory.readData("test2.csv", ",");
|
|
|
|
|
|
|
|
|
|
HashSet<Poisson> mackerelSet = MackerelSerra.parse(rawMackerel);
|
|
|
|
|
|
|
|
|
|
System.out.println( mackerelSet );
|
|
|
|
|
|
|
|
|
|
Function<Poisson,Double> getLength = Poisson::getLength;
|
|
|
|
|
Function<Poisson,Double> getInfes = Poisson::getInfestation;
|
|
|
|
|
BiConsumer<Poisson,Double> setInfes = Poisson::setInfestation;
|
|
|
|
|
|
2026-04-08 15:25:40 +02:00
|
|
|
mackerelSet = Nettoyage.nettoieColumns( mackerelSet, getInfes, setInfes, false );
|
2026-04-08 14:47:42 +02:00
|
|
|
mackerelSet = Completion.completeColumnsLinear( mackerelSet, getLength, getInfes, setInfes );
|
|
|
|
|
|
|
|
|
|
HashSet<ValeursXY> mackerelXY = ValeursXY.convertToXY( mackerelSet, getLength, getInfes );
|
2026-04-27 15:18:30 +02:00
|
|
|
HashMap<String, ArrayList<Double>> axes = SVGBuilder.calcPointAxes( mackerelXY );
|
2026-04-27 12:56:24 +02:00
|
|
|
System.out.println( axes );
|
|
|
|
|
|
2026-04-27 15:18:30 +02:00
|
|
|
SVGBuilder axesInstance;
|
2026-04-27 12:56:24 +02:00
|
|
|
try {
|
2026-04-27 15:18:30 +02:00
|
|
|
axesInstance = new SVGBuilder(axes);
|
2026-04-27 12:56:24 +02:00
|
|
|
} catch (IncorrectAxesPointsException e) {
|
|
|
|
|
System.out.println( "Mauvais format communiqué" );
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2026-04-27 15:18:30 +02:00
|
|
|
// Sauvegarde pour plus tard.
|
|
|
|
|
double[] ABCoef = Completion.getLinearCoef(mackerelSet, getLength, getInfes);
|
|
|
|
|
|
|
|
|
|
ArrayList<Element> SVGElements = axesInstance.buildAll( "Length", "Infestation", mackerelXY, ABCoef[0], ABCoef[1] );
|
2026-04-27 12:56:24 +02:00
|
|
|
SVGFactory.createSVG( SVGElements );
|
2026-04-08 14:47:42 +02:00
|
|
|
|
2026-03-18 13:00:50 +01:00
|
|
|
}
|
|
|
|
|
}
|