A lot of things².
- Change DataParsing to a generic interface. - Add PartiePoisson - Add comments to Population class.
This commit is contained in:
@@ -1,17 +1,44 @@
|
||||
package ecoparasite.population;
|
||||
|
||||
/**
|
||||
* Classe qui permet de gérer un intervalle de données issues d'un CSV.
|
||||
*
|
||||
* Trois données : minimum, maximum et moyenne entre minimum et maximum.
|
||||
*/
|
||||
public class PopulationArgInterval {
|
||||
|
||||
/**
|
||||
* Valeur minimale.
|
||||
*/
|
||||
private Double min;
|
||||
|
||||
/**
|
||||
* Valeur maximale.
|
||||
*/
|
||||
private Double max;
|
||||
|
||||
/**
|
||||
* Moyenne entre la valeur minimale et maximale.
|
||||
*/
|
||||
private Double mean;
|
||||
|
||||
/**
|
||||
* Constructeur. La moyenne doit être précisée.
|
||||
* @param min Valeur minimale
|
||||
* @param max Valeur maximale
|
||||
* @param mean Moyenne
|
||||
*/
|
||||
public PopulationArgInterval(Double min, Double max, Double mean) {
|
||||
this.min = min;
|
||||
this.max = max;
|
||||
this.mean = mean;
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructeur. La moyenne est calculé automatiquement.
|
||||
* @param min Valeur minimale
|
||||
* @param max Valeur maximale.
|
||||
*/
|
||||
public PopulationArgInterval(Double min, Double max) {
|
||||
this.min = min;
|
||||
this.max = max;
|
||||
@@ -28,12 +55,26 @@ public class PopulationArgInterval {
|
||||
return this.mean;
|
||||
}
|
||||
|
||||
/**
|
||||
* Permet de transformer un intervalle en double.
|
||||
* Si le minimum est égal au maximum, cette valeur est retourné.
|
||||
* Sinon la moyenne est retourné.
|
||||
*
|
||||
* @return La valeur transformée en Double.
|
||||
*/
|
||||
public Double transformToDouble(){
|
||||
if( this.min == this.max )
|
||||
return this.min;
|
||||
return this.mean;
|
||||
}
|
||||
|
||||
/**
|
||||
* Permet de transformer une String (Extraite d'un fichier CSV) et de la transformer en Intervalle.
|
||||
* Gère les séparateurs +/- ainsi que l'entre deux. Sinon, elle sera juste convertie avec minimum = maximum.
|
||||
*
|
||||
* @param rawValue La valeur brute.
|
||||
* @return La valeur en tant qu'intervalle.
|
||||
*/
|
||||
public static PopulationArgInterval fromString( String rawValue ){
|
||||
|
||||
if( rawValue.contains( "±" ) ){ // Plus ou moins.
|
||||
|
||||
Reference in New Issue
Block a user