Merge pull request '18.03.26' (#2) from 18.03.26 into master
Reviewed-on: #2
This commit is contained in:
11
Projet.iml
Normal file
11
Projet.iml
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<module type="JAVA_MODULE" version="4">
|
||||||
|
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||||
|
<exclude-output />
|
||||||
|
<content url="file://$MODULE_DIR$">
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
|
||||||
|
</content>
|
||||||
|
<orderEntry type="inheritedJdk" />
|
||||||
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
|
</component>
|
||||||
|
</module>
|
||||||
10
src/ecoparasite/input/DataParsing.java
Normal file
10
src/ecoparasite/input/DataParsing.java
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
package ecoparasite.input;
|
||||||
|
|
||||||
|
import ecoparasite.poisson.Poisson;
|
||||||
|
|
||||||
|
import java.util.HashSet;
|
||||||
|
|
||||||
|
public interface DataParsing {
|
||||||
|
|
||||||
|
public HashSet<Poisson> parse(RawData data);
|
||||||
|
}
|
||||||
22
src/ecoparasite/poisson/Mackerel.java
Normal file
22
src/ecoparasite/poisson/Mackerel.java
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
package ecoparasite.poisson;
|
||||||
|
|
||||||
|
import ecoparasite.input.DataParsing;
|
||||||
|
import ecoparasite.input.RawData;
|
||||||
|
|
||||||
|
import java.util.HashSet;
|
||||||
|
|
||||||
|
public class Mackerel extends Poisson implements DataParsing {
|
||||||
|
public Mackerel(String species, Double length, Double infestation) {
|
||||||
|
super(species, length, null, infestation);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public HashSet<Poisson> parse(RawData data) {
|
||||||
|
|
||||||
|
HashSet<Poisson> fishSet;
|
||||||
|
fishSet = new HashSet<>();
|
||||||
|
|
||||||
|
|
||||||
|
return fishSet;
|
||||||
|
}
|
||||||
|
}
|
||||||
33
src/ecoparasite/poisson/Merlu.java
Normal file
33
src/ecoparasite/poisson/Merlu.java
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
package ecoparasite.poisson;
|
||||||
|
|
||||||
|
import ecoparasite.input.DataParsing;
|
||||||
|
import ecoparasite.input.RawData;
|
||||||
|
|
||||||
|
import java.util.HashSet;
|
||||||
|
|
||||||
|
public class Merlu extends Poisson implements DataParsing {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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
|
||||||
|
*/
|
||||||
|
public Merlu(Double length, Double infestation) {
|
||||||
|
super("Merlu", length, null, infestation);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Implémentation de la fonction parse de Dataparsing
|
||||||
|
* @param data
|
||||||
|
* @return tableau des poissons
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public HashSet<Poisson> parse(RawData data) { //TODO
|
||||||
|
|
||||||
|
HashSet<Poisson> fishSet;
|
||||||
|
fishSet = new HashSet<>();
|
||||||
|
|
||||||
|
|
||||||
|
return fishSet;
|
||||||
|
}
|
||||||
|
}
|
||||||
4
src/ecoparasite/poisson/PartiePoisson.java
Normal file
4
src/ecoparasite/poisson/PartiePoisson.java
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
package ecoparasite.poisson;
|
||||||
|
|
||||||
|
public abstract class PartiePoisson {
|
||||||
|
}
|
||||||
69
src/ecoparasite/poisson/Poisson.java
Normal file
69
src/ecoparasite/poisson/Poisson.java
Normal file
@@ -0,0 +1,69 @@
|
|||||||
|
package ecoparasite.poisson;
|
||||||
|
|
||||||
|
import java.util.HashSet;
|
||||||
|
|
||||||
|
public class Poisson{
|
||||||
|
|
||||||
|
private String specie;
|
||||||
|
private Double length;
|
||||||
|
private Double weight;
|
||||||
|
private Double infestation;
|
||||||
|
protected HashSet<PartiePoisson> fishParts;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructeur de l'objet Poisson
|
||||||
|
* @param specie Une String representant l'espece du poisson
|
||||||
|
* @param length Un Wrapper Double representant la longueur/taille du poisson
|
||||||
|
* @param weight Un Wrapper Double representant le poids du poisson
|
||||||
|
* @param infestation Un Wrapper Double representant le taux de parasite du poisson
|
||||||
|
*/
|
||||||
|
public Poisson(String specie, Double length, Double weight, Double infestation){
|
||||||
|
this.specie = specie;
|
||||||
|
this.length = length;
|
||||||
|
this.weight = weight;
|
||||||
|
this.infestation = infestation;
|
||||||
|
this.fishParts = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Getter de l'attribut specie
|
||||||
|
* @return La string de l'attribut specie
|
||||||
|
*/
|
||||||
|
public String getSpecie() {
|
||||||
|
return specie;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Getter de l'attribut length
|
||||||
|
* @return Le Double de l'attribut length
|
||||||
|
*/
|
||||||
|
public Double getLength() {
|
||||||
|
return length;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Getter de l'attribut weight
|
||||||
|
* @return Le Double de l'attribut weight
|
||||||
|
*/
|
||||||
|
public Double getWeight() {
|
||||||
|
return weight;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Getter de l'attribut infestation
|
||||||
|
* @return Le Double de l'attribut infestation
|
||||||
|
*/
|
||||||
|
public Double getInfestation() {
|
||||||
|
return infestation;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Permet d'afficher les informations de notre poisson
|
||||||
|
* @return La string contenant les informations
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public String toString(){
|
||||||
|
String result = "[ %5s : %4d mm, %4d g, %4d taux d'infestation ]";
|
||||||
|
return String.format(result, this.getClass().getSimpleName(), this.getLength(), this.getWeight(), this.getInfestation());
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user