2026-03-18 15:19:10 +01:00
|
|
|
package ecoparasite.poisson;
|
|
|
|
|
|
|
|
|
|
import ecoparasite.input.DataParsing;
|
|
|
|
|
import ecoparasite.input.RawData;
|
2026-03-25 16:22:16 +01:00
|
|
|
import ecoparasite.input.RawDataOverflow;
|
2026-03-18 15:19:10 +01:00
|
|
|
|
2026-03-25 16:22:16 +01:00
|
|
|
import java.util.HashMap;
|
2026-03-18 15:19:10 +01:00
|
|
|
import java.util.HashSet;
|
|
|
|
|
|
2026-03-25 16:22:16 +01:00
|
|
|
import static java.lang.Double.valueOf;
|
|
|
|
|
|
2026-03-18 16:45:42 +01:00
|
|
|
/**
|
|
|
|
|
* Hérite de Poisson.
|
|
|
|
|
* Ajoute les fonctions de Parsing liés aux données collectées sur le Merlu.
|
|
|
|
|
*/
|
2026-03-18 15:19:10 +01:00
|
|
|
public class Merlu extends Poisson implements DataParsing {
|
2026-03-18 15:37:18 +01:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Construteur d'un merlu
|
|
|
|
|
* @param length Un Wrapper Double representant la longueur/taille du poisson
|
|
|
|
|
* @param infestation Un Wrapper Double representant le taux de parasite du poisson
|
|
|
|
|
*/
|
2026-03-25 16:22:16 +01:00
|
|
|
public Merlu(String id, Double length, Double infestation) {
|
|
|
|
|
super(id, length, null, infestation);
|
2026-03-18 15:19:10 +01:00
|
|
|
}
|
|
|
|
|
|
2026-03-18 15:37:18 +01:00
|
|
|
/**
|
|
|
|
|
* Implémentation de la fonction parse de Dataparsing
|
|
|
|
|
* @param data
|
|
|
|
|
* @return tableau des poissons
|
|
|
|
|
*/
|
2026-03-18 15:19:10 +01:00
|
|
|
@Override
|
2026-03-25 16:22:16 +01:00
|
|
|
public HashSet<Poisson> parse(RawData data) throws RawDataOverflow {
|
|
|
|
|
|
|
|
|
|
HashMap<String,String> temp = new HashMap<>();
|
2026-03-18 15:19:10 +01:00
|
|
|
|
|
|
|
|
HashSet<Poisson> fishSet;
|
|
|
|
|
fishSet = new HashSet<>();
|
|
|
|
|
|
2026-03-25 16:22:16 +01:00
|
|
|
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")));
|
|
|
|
|
|
|
|
|
|
fishSet.add(newP);
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-18 15:19:10 +01:00
|
|
|
|
|
|
|
|
return fishSet;
|
|
|
|
|
}
|
|
|
|
|
}
|