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 Mackerel.
|
|
|
|
|
*/
|
2026-03-18 15:19:10 +01:00
|
|
|
public class Mackerel extends Poisson implements DataParsing {
|
2026-03-25 15:30:59 +01:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Constructeur de Mackerel
|
|
|
|
|
* @param length
|
|
|
|
|
* @param infestation
|
|
|
|
|
*/
|
2026-03-25 16:22:16 +01:00
|
|
|
public Mackerel(String id, Double length, Double infestation) {
|
|
|
|
|
super(id, length, null, infestation);
|
2026-03-18 15:19:10 +01:00
|
|
|
}
|
|
|
|
|
|
2026-03-25 15:30:59 +01:00
|
|
|
/**
|
|
|
|
|
* Implémentation de la fonction parse de Dataparsing
|
|
|
|
|
* @param data
|
|
|
|
|
* @return tableau des poissons
|
|
|
|
|
*/
|
2026-03-31 19:00:19 +02:00
|
|
|
public static HashSet<Poisson> parse(RawData data) throws RawDataOverflow {
|
2026-03-25 16:22:16 +01:00
|
|
|
|
|
|
|
|
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 Mackerel(temp.get("Sample_code"),valueOf(temp.get("StandardLength")),valueOf(temp.get("NParasitesViscera")));
|
|
|
|
|
|
|
|
|
|
fishSet.add(newP);
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-18 15:19:10 +01:00
|
|
|
|
|
|
|
|
return fishSet;
|
|
|
|
|
}
|
|
|
|
|
}
|