Compare commits
1 Commits
7800a92dae
...
Ben8AvrilA
| Author | SHA1 | Date | |
|---|---|---|---|
| 255ad3809c |
BIN
UML/classes.png
BIN
UML/classes.png
Binary file not shown.
|
Before Width: | Height: | Size: 240 KiB After Width: | Height: | Size: 283 KiB |
@@ -3,6 +3,7 @@
|
|||||||
namespace ecoparasite {
|
namespace ecoparasite {
|
||||||
|
|
||||||
class Application {
|
class Application {
|
||||||
|
+ {static} main
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace ecoparasite.input {
|
namespace ecoparasite.input {
|
||||||
@@ -119,30 +120,70 @@ namespace ecoparasite {
|
|||||||
|
|
||||||
namespace ecoparasite.completion {
|
namespace ecoparasite.completion {
|
||||||
class Completion {
|
class Completion {
|
||||||
+ {static} completeColumnsMoyenne
|
+ {static} completeColumnsMoyenne()
|
||||||
+ {static} completeColumnsLinear
|
+ {static} completeColumnsLinear()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace ecoparasite.nettoyage {
|
namespace ecoparasite.nettoyage {
|
||||||
class Nettoyage {
|
class Nettoyage {
|
||||||
+ {static} nettoieColumnsMoyenne
|
+ {static} nettoieColumns()
|
||||||
+ {static} nettoieColumnsLinear
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace ecoparasite.unknown {
|
namespace ecoparasite.representation {
|
||||||
|
class ValeursXY {
|
||||||
|
- double x
|
||||||
|
- double y
|
||||||
|
+ {static} HashSet<ValeursXY> convertToXY()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
note top of ecoparasite.unknown : Ce paquet est temporaire pour des classes / interfaces qui devront avoir plus de déclinaisons.
|
namespace ecoparasite.svg {
|
||||||
|
class SVGFactory {
|
||||||
class DataCleaner {
|
+ {static} createSVG()
|
||||||
+ DataCleaner()
|
+ {static} createSVGCode()
|
||||||
+ String toString()
|
+ {static} createFile()
|
||||||
}
|
}
|
||||||
|
|
||||||
interface DataCompletion {
|
class Coordonnees {
|
||||||
+ void exception()
|
- double x
|
||||||
|
- double y
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace ecoparasite.svg.elements {
|
||||||
|
|
||||||
|
class ElementsFactory {
|
||||||
|
+ {static} SVGAxes()
|
||||||
|
}
|
||||||
|
|
||||||
|
abstract class Element {
|
||||||
|
+ {abstract} toSVG()
|
||||||
|
}
|
||||||
|
|
||||||
|
Element o--> ecoparasite.svg.Coordonnees : # coordonnees
|
||||||
|
|
||||||
|
class Circle extends Element {
|
||||||
|
- int rayon
|
||||||
|
- String color
|
||||||
|
}
|
||||||
|
|
||||||
|
class Line extends Element {
|
||||||
|
- int lineWidth
|
||||||
|
- String color
|
||||||
|
}
|
||||||
|
|
||||||
|
class Text extends Element {
|
||||||
|
- String text
|
||||||
|
- String color
|
||||||
|
- int size
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Line o--> ecoparasite.svg.Coordonnees : # coordonneesB
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
124
src/ecoparasite/LectureEval.java
Normal file
124
src/ecoparasite/LectureEval.java
Normal file
@@ -0,0 +1,124 @@
|
|||||||
|
package ecoparasite;
|
||||||
|
|
||||||
|
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.Poisson;
|
||||||
|
import ecoparasite.population.Population;
|
||||||
|
import ecoparasite.population.PopulationArgInterval;
|
||||||
|
import ecoparasite.population.PopulationArgs;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.function.BiConsumer;
|
||||||
|
import java.util.function.Function;
|
||||||
|
|
||||||
|
public class LectureEval {
|
||||||
|
|
||||||
|
public static HashSet<Population> parseEval( RawData popRaw ){
|
||||||
|
|
||||||
|
HashSet<Population> popEspece = new HashSet<>();
|
||||||
|
|
||||||
|
int index = 1;
|
||||||
|
try {
|
||||||
|
while(true){
|
||||||
|
HashMap<String,String> fields = popRaw.getEntry(index);
|
||||||
|
|
||||||
|
String espece = fields.get("Espèce");
|
||||||
|
|
||||||
|
Population population = new Population(espece);
|
||||||
|
|
||||||
|
if( population.getTotal() == null ){
|
||||||
|
population.setTotal( new PopulationArgs() );
|
||||||
|
}
|
||||||
|
for( String k: fields.keySet() ){
|
||||||
|
if( k.equals("Espèce") )
|
||||||
|
continue;
|
||||||
|
|
||||||
|
LectureEval.applyValueForPopEval( population.getTotal(), k, fields.get(k) );
|
||||||
|
}
|
||||||
|
|
||||||
|
popEspece.add(population);
|
||||||
|
index++;
|
||||||
|
}
|
||||||
|
} catch (RawDataOverflow e) {
|
||||||
|
// Fin de la liste.
|
||||||
|
}
|
||||||
|
|
||||||
|
return popEspece;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void applyValueForPopEval( PopulationArgs popArgs, String column, String value ){
|
||||||
|
|
||||||
|
if( value == null || value == "" ) // On n'ajoute pas les valeurs nulles.
|
||||||
|
return;
|
||||||
|
|
||||||
|
switch (column){
|
||||||
|
case "zone":
|
||||||
|
popArgs.setZone(value);
|
||||||
|
break;
|
||||||
|
case "N":
|
||||||
|
popArgs.setNumber( Integer.parseInt(value) );
|
||||||
|
break;
|
||||||
|
case "Prevalence":
|
||||||
|
popArgs.setPrevalence(PopulationArgInterval.fromString(value));
|
||||||
|
break;
|
||||||
|
case "LT mm":
|
||||||
|
popArgs.setLength(PopulationArgInterval.fromString(value));
|
||||||
|
break;
|
||||||
|
case "Masse g":
|
||||||
|
popArgs.setWidth(PopulationArgInterval.fromString(value));
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void main(String[] args) throws RawDataOverflow {
|
||||||
|
|
||||||
|
RawData popRaw; int index;
|
||||||
|
try {
|
||||||
|
popRaw = InputFactory.readData("test3.csv", "," );
|
||||||
|
} catch(InputFileException e) {
|
||||||
|
System.out.println(e.getMessage());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
HashSet<Population> pop = parseEval(popRaw);
|
||||||
|
|
||||||
|
// System.out.println( popRaw.getEntry(1) );
|
||||||
|
|
||||||
|
index = 1;
|
||||||
|
for( Population p: pop){
|
||||||
|
System.out.println(String.valueOf(index++) + p);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Nettoyage de la masse.
|
||||||
|
Function<Population,Double> getWeight = population -> {
|
||||||
|
return population.getTotal().getWidth() != null ? population.getTotal().getWidth().transformToDouble() : null;
|
||||||
|
};
|
||||||
|
BiConsumer<Population,Double> setWeight = (population, aDouble) -> {
|
||||||
|
population.getTotal().setWidth(aDouble != null ? new PopulationArgInterval(aDouble,aDouble) : null);
|
||||||
|
};
|
||||||
|
|
||||||
|
pop = Nettoyage.nettoieColumns(pop, getWeight, setWeight, false);
|
||||||
|
System.out.println("---");
|
||||||
|
index = 1;
|
||||||
|
for( Population p: pop){
|
||||||
|
System.out.println(String.valueOf(index++) + p);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Complétion de la masse.
|
||||||
|
pop = Completion.completeColumnsMoyenne(pop, getWeight, setWeight);
|
||||||
|
System.out.println("---");
|
||||||
|
index = 1;
|
||||||
|
for( Population p: pop){
|
||||||
|
System.out.println(String.valueOf(index++) + p);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -32,7 +32,7 @@ class NettoyageTest {
|
|||||||
|
|
||||||
System.out.println(testp);
|
System.out.println(testp);
|
||||||
|
|
||||||
testp = Nettoyage.nettoieColumnsMoyenne( testp, getInfes, setInfes );
|
// testp = Nettoyage.nettoieColumnsMoyenne( testp, getInfes, setInfes );
|
||||||
|
|
||||||
System.out.println(testp);
|
System.out.println(testp);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user