Compare commits
11 Commits
9026c901ba
...
1.04.26-la
| Author | SHA1 | Date | |
|---|---|---|---|
| 603ac5dbbd | |||
| fda799a8a4 | |||
| 038d4b3b88 | |||
| 4efb0d71ba | |||
| 8708b00b49 | |||
| 2e3da3d249 | |||
| 375fb3f3ed | |||
| cf3d5b4929 | |||
| 0fb5604d2d | |||
| 1a1e7a24d9 | |||
| 6420a4c606 |
@@ -27,7 +27,7 @@ namespace ecoparasite {
|
||||
InputFactory o--> RawData
|
||||
|
||||
interface DataParsing {
|
||||
+ HashSet<Poisson> parse()
|
||||
+ HashSet<T> parse()
|
||||
}
|
||||
|
||||
exception InputFileException {
|
||||
@@ -41,6 +41,11 @@ namespace ecoparasite {
|
||||
+ String getMessage()
|
||||
}
|
||||
|
||||
exception InvalidParsingException {
|
||||
- int parsingId
|
||||
- String parsingClass
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
namespace ecoparasite.poissons {
|
||||
@@ -64,12 +69,54 @@ namespace ecoparasite {
|
||||
+ Mackerel()
|
||||
}
|
||||
|
||||
abstract class PartiePoisson {
|
||||
class PartiePoisson {
|
||||
- String name
|
||||
- Double infestation
|
||||
+ PartiePoisson(String name, Double infestation)
|
||||
}
|
||||
|
||||
Poisson o--> PartiePoisson : # fishParts
|
||||
}
|
||||
|
||||
namespace ecoparasite.population {
|
||||
|
||||
class Population implements ecoparasite.input.DataParsing {
|
||||
- String id
|
||||
- HashMap<Integer,PopulationArgs> perYear
|
||||
+ Population()
|
||||
}
|
||||
|
||||
Population o--> PopulationArgs : - total
|
||||
|
||||
class PopulationArgs {
|
||||
- int year
|
||||
- int number
|
||||
- Double intensity
|
||||
- Double abondance
|
||||
+ PopulationArgs()
|
||||
}
|
||||
|
||||
PopulationArgs o--> PopulationArgInterval : - length
|
||||
PopulationArgs o--> PopulationArgInterval : - width
|
||||
PopulationArgs o--> PopulationArgInterval : - prevalence
|
||||
PopulationArgs o--> PopulationArgInterval : - ic
|
||||
|
||||
class PopulationArgInterval {
|
||||
- Double min
|
||||
- Double max
|
||||
- Double mean
|
||||
+ PopulationArgInterval()
|
||||
+ PopulationArgInterval()
|
||||
+ Double transformToDouble()
|
||||
+ {static} PopulationArgInterval fromString()
|
||||
}
|
||||
|
||||
class PopulationParsing {
|
||||
+ {static} HashSet<Population> parseParasitesPeru()
|
||||
- {static} void applyValueForParasitesPeru()
|
||||
}
|
||||
}
|
||||
|
||||
namespace ecoparasite.unknown {
|
||||
|
||||
note top of ecoparasite.unknown : Ce paquet est temporaire pour des classes / interfaces qui devront avoir plus de déclinaisons.
|
||||
|
||||
112
data/testNettoie.csv
Normal file
112
data/testNettoie.csv
Normal file
@@ -0,0 +1,112 @@
|
||||
Sample_code;Station;Latitude;Longitude;Depth;d13C_raw;d13C_corr;d15N;C_N;StandardLength;TrophicLevel;Anisakis_abdominalcavity;Anisakis_Liver;Anisakis_gonads;Anisakis_stomach;NParasitesViscera;Anisakis_Muscle_Right;Anisakis_Muscle_Left;Aniskis_Muscle_total;NParasitesTotal
|
||||
TRACTRA_S0575_A0439;S0575;48.8692264;-4.3976635;96.84;-20.09735065;-19.14374028;12.52361179;4.316778148;257;3.117572211;7;1;0;1;9;1;3;4;13
|
||||
TRACTRA_S0575_A0440;S0575;48.8692264;-4.3976635;96.84;-20.02738845;-19.42703789;12.25444555;3.959950061;252;3.038405671;263;5;0;21;289;12;11;23;312
|
||||
TRACTRA_S0575_A0441;S0575;48.8692264;-4.3976635;96.84;-19.82735569;-18.83090708;12.97020596;4.360049101;254;3.248923438;51;1;12;1;65;2;3;5;70
|
||||
TRACTRA_S0575_A0442;S0575;48.8692264;-4.3976635;96.84;-19.37802102;-18.26777864;13.43393806;4.4749923;242;3.385315231;158;6;0;1;165;9;19;28;193
|
||||
TRACTRA_S0575_A0443;S0575;48.8692264;-4.3976635;96.84;-18.20541518;-18.20541518;12.68793425;3.369189318;254;3.165902347;67;1;10;1;79;1;6;7;86
|
||||
TRACTRA_S0575_A0444;S0575;48.8692264;-4.3976635;96.84;-20.21559661;-18.91007641;12.62442312;4.672242625;251;3.147222601;140;1;0;0;141;3;6;9;150
|
||||
TRACTRA_S0575_A0445;S0575;48.8692264;-4.3976635;96.84;-19.43517323;-19.13886211;11.25439721;3.65283952;258;2.744273805;281;5;0;3;289;1;8;9;298
|
||||
TRACTRA_S0575_A0446;S0575;48.8692264;-4.3976635;96.84;-19.98304621;-19.35255493;11.69796704;3.990395229;250;2.87473552;113;2;6;5;126;2;9;11;137
|
||||
TRACTRA_S0575_A0447;S0575;48.8692264;-4.3976635;96.84;-19.4952816;-18.88631609;11.96007648;3.968652028;244;2.951826533;81;2;0;0;83;0;3;3;86
|
||||
TRACTRA_S0575_A0448;S0575;48.8692264;-4.3976635;96.84;-19.94560166;-19.34814395;11.90664648;3.957027986;244;2.936111826;182;0;1;4;187;10;20;30;217
|
||||
TRACTRA_S0577_A0454;S0577;49.2061879;-4.3343404;94.02;-19.0301808;-18.69065175;12.62744746;3.696493987;230;3.212854832;23;0;0;1;24;0;0;0;24
|
||||
TRACTRA_S0577_A0455;S0577;49.2061879;-4.3343404;94.02;-20.15942978;-19.22294902;12.21916159;4.299475509;247;3.092770753;53;0;0;1;54;4;6;10;64
|
||||
TRACTRA_S0577_A0456;S0577;49.2061879;-4.3343404;94.02;-21.11919287;-19.10756928;13.20207201;5.38547838;250;3.381862053;11;0;0;1;12;0;3;3;15
|
||||
TRACTRA_S0577_A0457;S0577;49.2061879;-4.3343404;94.02;-20.47770851;-19.25004326;11.60824496;4.593601258;264;2.913089392;72;7;0;3;82;3;7;10;92
|
||||
TRACTRA_S0577_A0458;S0577;49.2061879;-4.3343404;94.02;-18.80551346;-18.80551346;11.29371363;3.405172632;258;2.820580176;18;2;0;5;25;0;4;4;29
|
||||
TRACTRA_S0577_A0459;S0577;49.2061879;-4.3343404;94.02;-18.55424078;-18.55424078;11.99334422;3.368856741;268;3.02635388;3;0;2;0;5;0;1;1;6
|
||||
TRACTRA_S0577_A0460;S0577;49.2061879;-4.3343404;94.02;-20.65507746;-18.90565571;12.2504131;5.120628022;244;3.101962374;5;0;0;0;5;0;0;0;5
|
||||
TRACTRA_S0577_A0461;S0577;49.2061879;-4.3343404;94.02;-20.2747196;-19.30665873;13.06496861;4.331374612;236;3.341537523;18;0;0;0;18;1;1;2;20
|
||||
TRACTRA_S0577_A0462;S0577;49.2061879;-4.3343404;94.02;-20.4373078;-19.16897407;12.28972952;4.634680534;258;3.113526026;46;0;0;0;46;0;9;9;55
|
||||
TRACTRA_S0577_A0463;S0577;49.2061879;-4.3343404;94.02;-19.45685166;-19.11472538;12.60426085;3.699117451;251;3.206035242;106;0;0;3;109;6;19;25;134
|
||||
TRACTRA_S0754_A0805;S0754;49.6547785;-0.1474217;37.3;-17.83990445;-17.83990445;13.08890102;3.215085281;166;3.453596065;0;0;0;0;0;0;0;0;0
|
||||
TRACTRA_S0754_A0806;S0754;49.6547785;-0.1474217;37.3;-20.15486746;-18.67023918;12.91860136;4.853159877;166;3.403507929;1;0;0;0;1;0;0;0;1
|
||||
TRACTRA_S0754_A0807;S0754;49.6547785;-0.1474217;37.3;-18.26558775;-18.26558775;12.73923249;3.355335311;162;3.350752377;4;1;0;1;6;0;0;0;6
|
||||
TRACTRA_S0754_A0808;S0754;49.6547785;-0.1474217;37.3;-18.30726304;-18.09681562;13.04657803;3.566108505;169;3.441148126;0;0;0;0;0;0;0;0;0
|
||||
TRACTRA_S0754_A0809;S0754;49.6547785;-0.1474217;37.3;-17.48070316;-17.48070316;13.28439294;3.361704857;170;3.511093688;0;0;0;0;0;0;0;0;151
|
||||
TRACTRA_S0754_A0810;S0754;49.6547785;-0.1474217;37.3;-17.78334513;-17.78334513;13.07882412;3.489125859;176;3.45063227;0;0;0;0;0;0;0;0;0
|
||||
TRACTRA_S0754_A0811;S0754;49.6547785;-0.1474217;37.3;-18.28047178;-18.12027726;12.87224761;3.515348002;165;3.389874472;4;0;0;0;4;1;0;1;5
|
||||
TRACTRA_S0754_A0812;S0754;49.6547785;-0.1474217;37.3;-20.27989332;-18.492208;13.65522298;5.159278103;193;3.620161346;4;0;0;0;4;0;0;0;4
|
||||
TRACTRA_S0754_A0813;S0754;49.6547785;-0.1474217;37.3;-18.35389967;-18.35389967;12.72814789;3.262758686;165;3.347492203;1;0;0;0;1;0;0;0;1
|
||||
TRACTRA_S0754_A0814;S0754;49.6547785;-0.1474217;37.3;-18.87880984;-18.22558141;13.21587;4.013362047;166;3.490939882;1;0;0;2;3;0;0;0;3
|
||||
TRACTRA_S0613_A0725;S0613;49.6962144;-3.7446409;77.61;-20.02823743;-19.77660999;13.31184525;3.607704481;108;3.386206548;0;0;0;0;0;0;0;0;0
|
||||
TRACTRA_S0613_A0726;S0613;49.6962144;-3.7446409;77.61;-19.51899808;-19.51899808;13.58432266;3.286796067;109;3.466346962;0;0;0;0;0;0;0;0;0
|
||||
TRACTRA_S0613_A0727;S0613;49.6962144;-3.7446409;77.61;-20.25818465;-19.92813931;13.27363809;3.686914482;112;3.374969147;0;0;0;0;0;0;0;0;0
|
||||
TRACTRA_S0613_A0728;S0613;49.6962144;-3.7446409;77.61;-19.89105861;-19.61530935;13.69693325;3.632069961;110;3.499467723;0;0;0;0;0;0;0;0;0
|
||||
TRACTRA_S0613_A0729;S0613;49.6962144;-3.7446409;77.61;-20.56708371;-20.05444437;13.52500101;3.871352865;105;3.448899418;0;0;0;0;0;0;0;0;0
|
||||
TRACTRA_S0613_A0730;S0613;49.6962144;-3.7446409;77.61;-19.84072681;-19.65364002;13.56220272;3.542511911;102;3.459841098;0;0;0;0;0;0;0;0;0
|
||||
TRACTRA_S0613_A0731;S0613;49.6962144;-3.7446409;77.61;-19.40353102;-19.40353102;13.7894348;3.4531337;112;3.526674063;0;0;0;0;0;0;0;0;0
|
||||
TRACTRA_S0613_A0732;S0613;49.6962144;-3.7446409;77.61;-19.72032526;-19.72032526;13.78440755;3.440747909;108;3.525195458;0;0;0;1;1;0;0;0;1
|
||||
TRACTRA_S0613_A0733;S0613;49.6962144;-3.7446409;77.61;-20.51675191;-20.25700129;13.69190599;3.615909722;108;3.497989118;0;0;0;0;0;0;0;0;0
|
||||
TRACTRA_S0613_A0734;S0613;49.6962144;-3.7446409;77.61;-19.85158269;-19.85158269;13.74821128;3.427824163;105;3.514549498;0;0;0;0;0;0;0;0;0
|
||||
TRACTRA_S0613_A0735;S0613;49.6962144;-3.7446409;77.61;-19.52985396;-18.77319749;12.19277752;4.117834812;155;3.057068981;0;0;0;0;0;0;0;0;0
|
||||
TRACTRA_S0613_A0736;S0613;49.6962144;-3.7446409;77.61;-18.71566314;-18.30038536;12.72566692;3.773007861;151;3.213801156;0;0;0;0;0;0;0;0;0
|
||||
TRACTRA_S0613_A0737;S0613;49.6962144;-3.7446409;77.61;-18.55578567;-18.55578567;12.52055477;3.488579888;148;3.153474054;1;0;0;0;1;0;0;0;1
|
||||
TRACTRA_S0613_A0738;S0613;49.6962144;-3.7446409;77.61;-18.64559339;-18.23789283;12.46525493;3.765354093;159;3.137209395;0;0;0;0;0;0;0;0;0
|
||||
TRACTRA_S0613_A0739;S0613;49.6962144;-3.7446409;77.61;-18.41367237;-18.41367237;12.2078593;3.420834314;152;3.061504797;0;0;0;1;1;0;0;0;1
|
||||
TRACTRA_S0613_A0740;S0613;49.6962144;-3.7446409;77.61;-19.79532951;-18.68335824;12.39487331;4.476738651;152;3.116508919;2;0;0;0;2;0;0;0;2
|
||||
TRACTRA_S0613_A0741;S0613;49.6962144;-3.7446409;77.61;-19.33543506;-18.69166914;12.3576716;4.003803955;168;3.105567239;1;0;0;0;1;0;0;0;1
|
||||
TRACTRA_S0613_A0742;S0613;49.6962144;-3.7446409;77.61;-18.99002077;-18.43223945;12.39386786;3.916950835;155;3.116213198;0;0;0;0;0;0;0;0;0
|
||||
TRACTRA_S0613_A0743;S0613;49.6962144;-3.7446409;77.61;-18.75711286;-18.24630612;12.60501272;3.869501751;152;3.178314625;0;0;0;0;0;0;0;0;0
|
||||
TRACTRA_S0613_A0744;S0613;49.6962144;-3.7446409;77.61;-18.72454522;-18.36228847;12.90363187;3.719451262;154;3.266143788;0;0;0;1;1;0;0;0;1
|
||||
TRACTRA_S0639_A0745;S0639;49.8793196;-3.3251101;73.12;-18.6902161;-18.22204182;12.52076814;3.826438667;161;3.191653695;0;0;0;0;0;0;0;0;0
|
||||
TRACTRA_S0639_A0746;S0639;49.8793196;-3.3251101;73.12;-19.314296;-19.05048806;13.17690571;3.620008022;140;3.384635333;0;0;0;0;0;0;0;0;0
|
||||
TRACTRA_S0639_A0747;S0639;49.8793196;-3.3251101;73.12;-17.51895714;-17.51895714;12.92408206;3.193663511;151;3.310275436;1;0;0;0;1;0;0;0;1
|
||||
TRACTRA_S0639_A0748;S0639;49.8793196;-3.3251101;73.12;-18.54923123;-18.54923123;12.58497732;3.228276352;157;3.210538748;6;0;0;1;7;0;0;0;7
|
||||
TRACTRA_S0639_A0749;S0639;49.8793196;-3.3251101;73.12;-19.71753247;-18.8812651;12.99631739;4.198249861;152;3.33152112;0;0;0;0;0;0;0;0;0
|
||||
TRACTRA_S0639_A0750;S0639;49.8793196;-3.3251101;73.12;-17.97247492;-17.97247492;12.93612128;3.493877982;164;3.313816383;3;0;0;0;3;0;0;0;3
|
||||
TRACTRA_S0639_A0751;S0639;49.8793196;-3.3251101;73.12;-18.22683924;-18.22683924;13.03042851;3.308824647;156;3.341553805;0;1;0;0;1;0;0;0;1
|
||||
TRACTRA_S0639_A0752;S0639;49.8793196;-3.3251101;73.12;-18.65472341;-18.39365742;12.7986735;3.617238364;160;3.273390566;0;0;0;0;0;0;0;0;0
|
||||
TRACTRA_S0639_A0753;S0639;49.8793196;-3.3251101;73.12;-18.20120563;-18.00843545;13.09162789;3.548252699;147;3.359553621;1;0;0;0;1;0;0;0;1
|
||||
TRACTRA_S0639_A0754;S0639;49.8793196;-3.3251101;73.12;-18.62711798;-18.62711798;12.45154262;3.427913827;152;3.171293247;0;0;0;0;0;0;0;0;0
|
||||
TRACTRA_S0670_A0765;S0670;49.9406453;-2.5046981;66.38;-18.39954403;-18.16590933;13.53933859;3.589530001;219;3.44755523;45;1;0;4;50;0;4;4;54
|
||||
TRACTRA_S0670_A0766;S0670;49.9406453;-2.5046981;66.38;-22.61073263;-18.6255476;12.78760162;7.378974781;231;3.226456121;80;1;0;2;83;5;9;14;97
|
||||
TRACTRA_S0670_A0767;S0670;49.9406453;-2.5046981;66.38;-18.96116815;-18.96116815;12.2484873;3.306833193;288;3.067893087;64;0;0;0;64;8;18;26;90
|
||||
TRACTRA_S0670_A0768;S0670;49.9406453;-2.5046981;66.38;-19.73216097;-19.37320368;12.70497102;3.716118472;229;3.202153002;8;0;0;0;8;0;1;1;9
|
||||
TRACTRA_S0670_A0769;S0670;49.9406453;-2.5046981;66.38;-19.16557551;-19.16557551;12.74729401;3.415841427;239;3.214600941;81;3;36;0;120;6;9;15;135
|
||||
TRACTRA_S0670_A0770;S0670;49.9406453;-2.5046981;66.38;-18.85003405;-18.85003405;13.00526273;3.264809579;243;3.290474094;192;1;6;0;199;18;19;37;236
|
||||
TRACTRA_S0670_A0771;S0670;49.9406453;-2.5046981;66.38;-18.87285623;-18.87285623;11.61767317;3.362037589;241;2.882359518;28;2;17;3;50;1;2;3;53
|
||||
TRACTRA_S0670_A0772;S0670;49.9406453;-2.5046981;66.38;-20.42774137;-18.87583805;12.42181004;4.921114462;224;3.118870361;3;16;3;1;23;0;0;0;23
|
||||
TRACTRA_S0670_A0773;S0670;49.9406453;-2.5046981;66.38;-18.57716014;-18.24889867;14.27092176;3.685112599;230;3.662726749;19;1;5;2;27;0;0;0;27
|
||||
TRACTRA_S0670_A0774;S0670;49.9406453;-2.5046981;66.38;-18.91850059;-18.38588965;14.00892228;3.891526197;234;3.585668078;2;0;0;6;8;0;0;0;8
|
||||
TRACTRA_S0705_A0775;S0705;49.9998717;-0.7750398;59.36;-19.22709617;-19.0603341;12.51350986;3.521981887;251;3.145733742;98;8;0;0;106;11;3;14;120
|
||||
TRACTRA_S0705_A0776;S0705;49.9998717;-0.7750398;59.36;-20.77205862;-19.64910728;14.18929884;4.487829645;215;3.638612855;0;0;0;0;0;0;0;0;0
|
||||
TRACTRA_S0705_A0777;S0705;49.9998717;-0.7750398;59.36;-19.9693132;-18.92818389;13.0183627;4.405181126;215;3.294219873;5;0;0;1;6;0;0;0;6
|
||||
TRACTRA_S0705_A0778;S0705;49.9998717;-0.7750398;59.36;-18.89369387;-18.89369387;13.11711635;3.426883767;236;3.323265064;111;9;2;2;124;29;28;57;181
|
||||
TRACTRA_S0705_A0779;S0705;49.9998717;-0.7750398;59.36;-18.92842328;-18.22356212;13.5907308;4.065516322;229;3.462563431;44;2;1;1;48;2;12;14;62
|
||||
TRACTRA_S0705_A0780;S0705;49.9998717;-0.7750398;59.36;-18.87583303;-18.71659415;12.63241731;3.51438271;261;3.180706523;96;1;13;3;113;9;7;16;129
|
||||
TRACTRA_S0705_A0781;S0705;49.9998717;-0.7750398;59.36;-19.76589811;-18.66433058;15.14962771;4.466229823;207;3.921062522;0;1;0;1;2;0;0;0;2
|
||||
TRACTRA_S0705_A0782;S0705;49.9998717;-0.7750398;59.36;-18.77561389;-18.16356616;14.4432368;3.971765386;254;3.71330049;20;3;13;0;36;1;1;2;38
|
||||
TRACTRA_S0705_A0783;S0705;49.9998717;-0.7750398;59.36;-19.35112977;-18.1144013;14.06535293;4.602756025;228;3.602158177;32;0;0;0;32;4;7;11;43
|
||||
TRACTRA_S0705_A0784;S0705;49.9998717;-0.7750398;59.36;-18.20109028;-17.73148198;14.78585151;3.827887172;251;3.814069521;0;0;0;6;6;0;0;0;6
|
||||
TRACTRA_S0601_A0715;S0601;50.0395506;-4.3793424;74.88;-18.23504384;-18.23504384;12.2973445;3.424281959;155;3.161278164;4;0;0;0;4;0;0;0;4
|
||||
TRACTRA_S0601_A0716;S0601;50.0395506;-4.3793424;74.88;-18.88442269;-18.88442269;12.35666615;3.350603714;152;3.178725708;1;0;0;2;3;0;0;0;3
|
||||
TRACTRA_S0601_A0717;S0601;50.0395506;-4.3793424;74.88;-18.29820531;-18.06396027;12.98105165;3.590146502;154;3.362368502;0;0;0;1;1;0;0;0;1
|
||||
TRACTRA_S0601_A0718;S0601;50.0395506;-4.3793424;74.88;-19.62558306;-18.95671633;13.34603061;4.029158314;156;3.469715256;0;0;0;0;0;0;0;0;0
|
||||
TRACTRA_S0601_A0719;S0601;50.0395506;-4.3793424;74.88;-20.07659542;-18.94064042;12.474304;4.500964647;159;3.213325075;0;0;0;0;0;0;0;0;0
|
||||
TRACTRA_S0601_A0720;S0601;50.0395506;-4.3793424;74.88;-18.89823926;-18.55339871;13.00216613;3.701859148;150;3.368578645;3;0;0;2;5;0;0;0;5
|
||||
TRACTRA_S0601_A0721;S0601;50.0395506;-4.3793424;74.88;-17.76626731;-17.76626731;12.53262019;3.313925804;145;3.230476898;0;0;0;0;0;0;0;0;0
|
||||
TRACTRA_S0601_A0722;S0601;50.0395506;-4.3793424;74.88;-18.21530588;-18.21530588;12.60300181;3.423564038;152;3.251177374;0;0;0;0;0;0;0;0;0
|
||||
TRACTRA_S0601_A0723;S0601;50.0395506;-4.3793424;74.88;-18.81533984;-18.22521349;12.76487953;3.949622567;160;3.298788469;0;0;0;1;1;0;0;0;1
|
||||
TRACTRA_S0601_A0724;S0601;50.0395506;-4.3793424;74.88;-18.39196061;-18.19326953;12.75482502;3.554233413;147;3.295831258;1;0;0;0;1;0;0;0;1
|
||||
TRACTRA_S0718_A0453;S0718;50.0998065;-1.1453948;55.61;-18.66460368;-18.66460368;12.90165426;3.445225076;231;3.267606025;36;1;0;0;37;2;9;11;48
|
||||
TRACTRA_S0718_A0785;S0718;50.0998065;-1.1453948;55.61;-18.85995673;-18.50810575;13.29144678;3.70894039;206;3.382250883;1;0;0;0;1;0;0;0;1
|
||||
TRACTRA_S0718_A0786;S0718;50.0998065;-1.1453948;55.61;-19.93855287;-18.51682147;12.26561804;4.789627677;213;3.080536549;13;0;0;0;13;4;4;8;21
|
||||
TRACTRA_S0718_A0787;S0718;50.0998065;-1.1453948;55.61;-19.29556272;-18.58424925;13.6320461;4.072033803;217;3.482427155;1;0;0;0;1;0;0;0;1
|
||||
TRACTRA_S0718_A0788;S0718;50.0998065;-1.1453948;55.61;-18.65654164;-17.87326585;13.75296894;4.144723017;215;3.517992695;0;0;0;0;0;0;0;0;0
|
||||
TRACTRA_S0718_A0789;S0718;50.0998065;-1.1453948;55.61;-18.65654164;-17.87326585;13.75296894;4.144723017;212;3.517992695;0;0;0;0;0;0;0;0;0
|
||||
TRACTRA_S0718_A0790;S0718;50.0998065;-1.1453948;55.61;-20.30767685;-18.92634633;14.50772898;4.748818703;216;3.739980943;0;0;0;0;0;0;0;0;0
|
||||
TRACTRA_S0718_A0791;S0718;50.0998065;-1.1453948;55.61;-19.14771467;-18.81564248;13.41640037;3.688961812;206;3.419001941;5;0;0;0;5;0;0;0;5
|
||||
TRACTRA_S0718_A0792;S0718;50.0998065;-1.1453948;55.61;-19.39677413;-18.69591383;13.03448575;4.061475047;205;3.306674109;9;0;0;1;10;0;0;0;10
|
||||
TRACTRA_S0718_A0793;S0718;50.0998065;-1.1453948;55.61;-21.2999456;-18.95534509;13.954507;5.721818697;206;3.577268596;3;0;0;0;3;0;1;1;4
|
||||
TRACTRA_S0718_A0794;S0718;50.0998065;-1.1453948;55.61;-20.11815351;-19.18867431;13.2057931;4.29240324;206;3.357058625;2;1;0;0;3;0;0;0;3
|
||||
TRACTRA_S0648_A0755;S0648;50.1032755;-2.8780274;65.63;-18.14599476;-17.96730786;12.90100688;3.534027181;150;3.272095952;1;0;0;0;1;0;0;0;1
|
||||
TRACTRA_S0648_A0756;S0648;50.1032755;-2.8780274;65.63;-19.88316505;-18.41350538;12.80469311;4.838040066;153;3.243768372;0;0;0;0;0;0;0;0;0
|
||||
TRACTRA_S0648_A0757;S0648;50.1032755;-2.8780274;65.63;-17.38980316;-17.38980316;13.74375238;3.233544264;144;3.519962276;0;0;0;0;0;0;1;1;1
|
||||
TRACTRA_S0648_A0758;S0648;50.1032755;-2.8780274;65.63;-18.19627608;-18.19627608;12.25189219;3.175007351;149;3.081179867;0;0;1;0;1;0;0;0;1
|
||||
TRACTRA_S0648_A0759;S0648;50.1032755;-2.8780274;65.63;-20.22330338;-18.62749624;12.36124845;4.965461761;156;3.113343473;0;0;0;1;1;0;0;0;1
|
||||
TRACTRA_S0648_A0760;S0648;50.1032755;-2.8780274;65.63;-18.55830703;-18.20627505;12.64148653;3.709123215;148;3.195766435;0;0;0;0;0;0;0;0;0
|
||||
TRACTRA_S0648_A0761;S0648;50.1032755;-2.8780274;65.63;-18.58509829;-18.15123475;12.93673979;3.791781348;158;3.282605629;0;0;0;0;0;0;0;0;0
|
||||
TRACTRA_S0648_A0762;S0648;50.1032755;-2.8780274;65.63;-19.22411937;-18.51036414;13.00526273;4.074500229;156;3.302759436;0;0;0;0;0;0;0;0;0
|
||||
TRACTRA_S0648_A0763;S0648;50.1032755;-2.8780274;65.63;-20.13006074;-17.89104792;12.99518582;5.615164463;152;3.299795641;0;0;0;0;0;0;0;0;50000
|
||||
TRACTRA_S0648_A0764;S0648;50.1032755;-2.8780274;65.63;-17.69007187;-17.69007187;12.89139372;3.154829903;144;3.269268552;21;0;0;0;21;0;0;0;21
|
||||
|
@@ -4,15 +4,19 @@ import ecoparasite.poisson.Poisson;
|
||||
|
||||
import java.util.HashSet;
|
||||
|
||||
|
||||
/**
|
||||
* Class incluant des méthodes Statiques de Completion des données
|
||||
*/
|
||||
public class Completion {
|
||||
|
||||
public static HashSet<Poisson> completePoisson(HashSet<Poisson> tablePoisson){
|
||||
//TODO mais après remaniment
|
||||
public static HashSet<Poisson> completePoissonMean(HashSet<Poisson> tablePoisson){
|
||||
|
||||
double mean = mean(tablePoisson);
|
||||
Double mean = mean(tablePoisson);
|
||||
|
||||
for (Poisson p : tablePoisson) {
|
||||
|
||||
if ( p.getInfestation().isNaN() ) {
|
||||
if ( p.getInfestation() == null ) {
|
||||
p.setInfestation(mean);
|
||||
}
|
||||
}
|
||||
@@ -20,12 +24,14 @@ public class Completion {
|
||||
return tablePoisson;
|
||||
}
|
||||
|
||||
private static double mean(HashSet<Poisson> tablePoisson){
|
||||
private static Double mean(HashSet<Poisson> tablePoisson){
|
||||
|
||||
double mean = 0.0;
|
||||
Double mean = 0.0;
|
||||
|
||||
for (Poisson p : tablePoisson){
|
||||
mean += p.getInfestation();
|
||||
if (p.getInfestation() != null) {
|
||||
mean += p.getInfestation();
|
||||
}
|
||||
}
|
||||
|
||||
return mean / tablePoisson.size();
|
||||
|
||||
@@ -9,7 +9,21 @@ import java.util.HashSet;
|
||||
*/
|
||||
public interface DataParsing {
|
||||
|
||||
public static HashSet<Poisson> parse(RawData data) throws RawDataOverflow {
|
||||
/**
|
||||
* Permet de parser un élément à partir d'un objet RawData.
|
||||
* @param data l'objet RawData
|
||||
* @param parseTypeId Permet d'indiquer le type de Parsing que l'on veut.
|
||||
* @return Un HashSet de données T retourné.
|
||||
* @param <T> Notre paramètre générique adaptable à plusieurs classes.
|
||||
* @throws RawDataOverflow Si on dépasse la taille de l'objet RawData.
|
||||
* @throws InvalidParsingException Si le type de parsing n'existe pas.
|
||||
*/
|
||||
public static <T> HashSet<T> parse(RawData data, int parseTypeId ) throws RawDataOverflow, InvalidParsingException {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static <T> HashSet<T> parse(RawData data) throws RawDataOverflow, InvalidParsingException {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -2,11 +2,13 @@ package ecoparasite.input;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.Array;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
|
||||
/**
|
||||
@@ -93,7 +95,7 @@ public class InputFactory {
|
||||
// Lecture des autres lignes.
|
||||
try {
|
||||
while ((line = reader.readLine()) != null) {
|
||||
rowFields = line.split(separator);
|
||||
rowFields = line.split(separator, -1);
|
||||
for (int i = 0; i < rowFields.length; i++) {
|
||||
ArrayList<String> element = data.get(i);
|
||||
element.add(rowFields[i]);
|
||||
|
||||
37
src/ecoparasite/input/InvalidParsingException.java
Normal file
37
src/ecoparasite/input/InvalidParsingException.java
Normal file
@@ -0,0 +1,37 @@
|
||||
package ecoparasite.input;
|
||||
|
||||
/**
|
||||
* Gère une exception lorsque qu'un type de parsing n'existe pas ou bien
|
||||
* qu'une erreur est survenue durant le parsing d'une donnée.
|
||||
*/
|
||||
public class InvalidParsingException extends Exception {
|
||||
|
||||
/**
|
||||
* L'ID du parsing voulant être réalisé.
|
||||
*/
|
||||
private int parsingId;
|
||||
|
||||
/**
|
||||
* De quel classe provient ce parsing.
|
||||
*/
|
||||
private String parsingSource;
|
||||
|
||||
/**
|
||||
* Constructeur.
|
||||
* @param parsingId ID du parsing
|
||||
* @param parsingSource La classe d'où provient ce parsing.
|
||||
*/
|
||||
public InvalidParsingException(int parsingId, String parsingSource) {
|
||||
this.parsingId = parsingId;
|
||||
this.parsingSource = parsingSource;
|
||||
super();
|
||||
}
|
||||
|
||||
public int getParsingId() {
|
||||
return parsingId;
|
||||
}
|
||||
public String getParsingSource() {
|
||||
return parsingSource;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -99,7 +99,7 @@ public class RawData {
|
||||
* Permet d'obtenir tous les champs d'une entrée.
|
||||
* @param index Entrée que vous voulez obtenir, le minimum est l'entrée 1. Le maximum dépend du Dataframe.
|
||||
* @return Une HashMap <colonne, valeur>.
|
||||
* @throws RawDataOverflow Si vous avez dépasses le maximum d'entrées du DataFrame.
|
||||
* @throws RawDataOverflow Si vous avez dépassé le maximum d'entrées du DataFrame.
|
||||
*/
|
||||
public HashMap<String,String> getEntry(int index) throws RawDataOverflow {
|
||||
|
||||
|
||||
@@ -4,24 +4,27 @@ import ecoparasite.poisson.Poisson;
|
||||
|
||||
import java.util.HashSet;
|
||||
|
||||
/**
|
||||
* Class Définissant les méthodes statics de Nettoyage des données
|
||||
*/
|
||||
public class Nettoyage {
|
||||
|
||||
/**
|
||||
*
|
||||
* @param tablePoisson
|
||||
* @return
|
||||
* Methode Static de nettoyage des valeurs abérrante et absurde
|
||||
* @param tablePoisson Un Hashset de Poisson contenant nos données
|
||||
* @return Le Hashset de Poisson une fois qu'il est nettoyé
|
||||
*/
|
||||
public static HashSet<Poisson> nettoiePoisson(HashSet<Poisson> tablePoisson){
|
||||
public static HashSet<Poisson> nettoiePoissonMean(HashSet<Poisson> tablePoisson){
|
||||
|
||||
double mean = mean(tablePoisson); //Moyenne
|
||||
double ecart = ecartType(tablePoisson); // Ecart Type
|
||||
Double mean = mean(tablePoisson); //Moyenne
|
||||
Double ecart = ecartType(tablePoisson); // Ecart Type
|
||||
|
||||
double z = 0;
|
||||
Double z = 0.0;
|
||||
|
||||
for (Poisson p : tablePoisson) {
|
||||
z = ( p.getInfestation() - mean ) / ecart;
|
||||
|
||||
if ( z >= 3 ) {
|
||||
if ( z >= 2.5 ) {
|
||||
p.setInfestation(mean);
|
||||
}
|
||||
}
|
||||
@@ -29,9 +32,14 @@ public class Nettoyage {
|
||||
return tablePoisson;
|
||||
}
|
||||
|
||||
private static double mean(HashSet<Poisson> tablePoisson){
|
||||
/**
|
||||
* Methode Privée permettant de calculer la moyenne
|
||||
* @param tablePoisson Un Hashset de Poisson contenant nos données
|
||||
* @return Un Double correspondant à la moyenne
|
||||
*/
|
||||
private static Double mean(HashSet<Poisson> tablePoisson){
|
||||
|
||||
double mean = 0.0;
|
||||
Double mean = 0.0;
|
||||
|
||||
for (Poisson p : tablePoisson){
|
||||
mean += p.getInfestation();
|
||||
@@ -40,10 +48,15 @@ public class Nettoyage {
|
||||
return mean / tablePoisson.size();
|
||||
}
|
||||
|
||||
private static double variance(HashSet<Poisson> tablePoisson){
|
||||
/**
|
||||
* Methode Privée permettant de calculer la variance
|
||||
* @param tablePoisson Un Hashset de Poisson contenant nos données
|
||||
* @return Un Double correspondant à la variance
|
||||
*/
|
||||
private static Double variance(HashSet<Poisson> tablePoisson){
|
||||
|
||||
double vari = 0.0;
|
||||
double mean = mean(tablePoisson);
|
||||
Double vari = 0.0;
|
||||
Double mean = mean(tablePoisson);
|
||||
|
||||
for (Poisson p : tablePoisson) {
|
||||
vari += Math.pow( (p.getInfestation() - mean), 2);
|
||||
@@ -52,9 +65,14 @@ public class Nettoyage {
|
||||
return vari / tablePoisson.size();
|
||||
}
|
||||
|
||||
private static double ecartType(HashSet<Poisson> tablePoisson){
|
||||
/**
|
||||
* Methode Privée permettant de calculer l'écart-type
|
||||
* @param tablePoisson Un Hashset de Poisson contenant nos données
|
||||
* @return Un Double correspondant à l'écart-type
|
||||
*/
|
||||
private static Double ecartType(HashSet<Poisson> tablePoisson){
|
||||
|
||||
double vari = variance(tablePoisson);
|
||||
Double vari = variance(tablePoisson);
|
||||
|
||||
return Math.sqrt(vari);
|
||||
}
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
package ecoparasite.poisson;
|
||||
|
||||
import ecoparasite.input.DataParsing;
|
||||
import ecoparasite.input.InvalidParsingException;
|
||||
import ecoparasite.input.RawData;
|
||||
import ecoparasite.input.RawDataOverflow;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Objects;
|
||||
|
||||
import static java.lang.Double.valueOf;
|
||||
|
||||
@@ -24,10 +26,25 @@ public class Mackerel extends Poisson implements DataParsing {
|
||||
super(id, length, null, infestation);
|
||||
}
|
||||
|
||||
/**
|
||||
* Implémentation de la fonction parse de DataParsing.
|
||||
* Renvoie un tableau de poissons à partir d'un RawData.
|
||||
*
|
||||
* @param data Notre RawData
|
||||
* @param parseTypeId L'ID du type de parsing, ignoré ici.
|
||||
* @return Le tableau de poissons.
|
||||
* @throws RawDataOverflow Si on a un dépassement de données dans notre RawData.
|
||||
* @throws InvalidParsingException
|
||||
*/
|
||||
public static HashSet<Poisson> parse(RawData data, int parseTypeId) throws RawDataOverflow, InvalidParsingException {
|
||||
return Mackerel.parse(data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Implémentation de la fonction parse de Dataparsing
|
||||
* @param data
|
||||
* @param data Notre RawData.
|
||||
* @return tableau des poissons
|
||||
* @throws RawDataOverflow Si on a un dépassement de données dans notre RawDataOverflow.
|
||||
*/
|
||||
public static HashSet<Poisson> parse(RawData data) throws RawDataOverflow {
|
||||
|
||||
@@ -38,12 +55,38 @@ public class Mackerel extends Poisson implements DataParsing {
|
||||
|
||||
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")));
|
||||
|
||||
String id = !Objects.equals(temp.get("Sample_code"), "") ? temp.get("Sample_code") : null;
|
||||
Double size = !Objects.equals(temp.get("StandardLength"), "") ? valueOf(temp.get("StandardLength")) : null;
|
||||
Double infes = !Objects.equals(temp.get("NParasitesTotal"), "") ? valueOf(temp.get("NParasitesTotal")) : null;
|
||||
|
||||
Poisson newP = new Mackerel(id,size,infes);
|
||||
newP.setFishParts( Mackerel.parsePartiePoisson(temp) );
|
||||
fishSet.add(newP);
|
||||
}
|
||||
|
||||
|
||||
return fishSet;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param entry
|
||||
* @return
|
||||
*/
|
||||
private static HashSet<PartiePoisson> parsePartiePoisson(HashMap<String,String> entry){
|
||||
|
||||
HashSet<PartiePoisson> response = new HashSet<>();
|
||||
|
||||
for( String k: entry.keySet() ){
|
||||
if( k.contains( "Anisakis_" ) ){
|
||||
String bodyPart = k.split( "Anisakis_" )[1];
|
||||
Double value = !Objects.equals(entry.get(k), "") ? valueOf(entry.get(k)) : null;
|
||||
PartiePoisson p = new PartiePoisson(bodyPart, value);
|
||||
response.add(p);
|
||||
}
|
||||
}
|
||||
|
||||
return response;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package ecoparasite.poisson;
|
||||
|
||||
import ecoparasite.input.DataParsing;
|
||||
import ecoparasite.input.InvalidParsingException;
|
||||
import ecoparasite.input.RawData;
|
||||
import ecoparasite.input.RawDataOverflow;
|
||||
|
||||
@@ -24,10 +25,24 @@ public class Merlu extends Poisson implements DataParsing {
|
||||
super(id, length, null, infestation);
|
||||
}
|
||||
|
||||
/**
|
||||
* Implémentation de la fonction parse de DataParsing.
|
||||
* Renvoie un tableau de poissons à partir d'un RawData.
|
||||
*
|
||||
* @param data Notre RawData
|
||||
* @param parseTypeId L'ID du type de parsing, ignoré ici.
|
||||
* @return Le tableau de poissons.
|
||||
* @throws RawDataOverflow Si on a un dépassement de données dans notre RawData.
|
||||
*/
|
||||
public static HashSet<Poisson> parse(RawData data, int parseTypeId) throws RawDataOverflow, InvalidParsingException {
|
||||
return Mackerel.parse(data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Implémentation de la fonction parse de Dataparsing
|
||||
* @param data
|
||||
* @param data Notre RawData
|
||||
* @return tableau des poissons
|
||||
* @throws RawDataOverflow Si on a un dépassement des données de notre objet RawData.
|
||||
*/
|
||||
public static HashSet<Poisson> parse(RawData data) throws RawDataOverflow {
|
||||
|
||||
|
||||
@@ -1,4 +1,61 @@
|
||||
package ecoparasite.poisson;
|
||||
|
||||
public abstract class PartiePoisson {
|
||||
/**
|
||||
* Permet d'illustrer une partie d'un poisson.
|
||||
*/
|
||||
public class PartiePoisson {
|
||||
|
||||
/**
|
||||
* Nom de la partie du poisson.
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* Le taux d'infestation de cette partie du poisson.
|
||||
*/
|
||||
private Double infestation;
|
||||
|
||||
/**
|
||||
* Constructeur.
|
||||
* Génère une partie complète.
|
||||
*
|
||||
* @param name Le nom de la partie.
|
||||
* @param infestation Le taux d'infestation de la partie du poisson.
|
||||
*/
|
||||
public PartiePoisson(String name, Double infestation) {
|
||||
this.name = name;
|
||||
this.infestation = infestation;
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructeur.
|
||||
* Génère une infestation de null comme non communiqué.
|
||||
*
|
||||
* @param name Le nom de la partie.
|
||||
*/
|
||||
public PartiePoisson(String name){
|
||||
this.name = name;
|
||||
this.infestation = null;
|
||||
}
|
||||
|
||||
/*
|
||||
GETTERS / SETTERS
|
||||
*/
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public Double getInfestation() {
|
||||
return infestation;
|
||||
}
|
||||
|
||||
public void setInfestation(Double infestation) {
|
||||
this.infestation = infestation;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -61,6 +61,31 @@ public class Poisson{
|
||||
return infestation;
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter de l'attribut des parties de poisson.
|
||||
* @return Le HashSet des parties de poisson.
|
||||
*/
|
||||
public HashSet<PartiePoisson> getFishParts() {
|
||||
return fishParts;
|
||||
}
|
||||
|
||||
/**
|
||||
* Setter de l'attribut infestation
|
||||
* @param infestation le Double de la nouvelle valeur de l'infestation
|
||||
*/
|
||||
public void setInfestation(Double infestation) {
|
||||
this.infestation = infestation;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Setter de l'attribut des parties de poisson.
|
||||
* @param fishParts Un hashset de parties de poisson.
|
||||
*/
|
||||
public void setFishParts(HashSet<PartiePoisson> fishParts) {
|
||||
this.fishParts = fishParts;
|
||||
}
|
||||
|
||||
/**
|
||||
* Permet d'afficher les informations de notre poisson
|
||||
* @return La string contenant les informations
|
||||
|
||||
@@ -1,50 +1,118 @@
|
||||
package ecoparasite.population;
|
||||
package ecoparasite.population;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import ecoparasite.input.DataParsing;
|
||||
import ecoparasite.input.InvalidParsingException;
|
||||
import ecoparasite.input.RawData;
|
||||
import ecoparasite.input.RawDataOverflow;
|
||||
|
||||
public class Population {
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
|
||||
private String id;
|
||||
private PopulationArgs total;
|
||||
private HashMap<Integer,PopulationArgs> perYear;
|
||||
/**
|
||||
* Permet de gérer une population selon les années.
|
||||
*/
|
||||
public class Population implements DataParsing {
|
||||
|
||||
public Population(String id, PopulationArgs total, HashMap<Integer,PopulationArgs> perYear) {
|
||||
this.id = id;
|
||||
this.total = total;
|
||||
this.perYear = perYear;
|
||||
}
|
||||
/**
|
||||
* Espèce de la population.
|
||||
*/
|
||||
private String id;
|
||||
|
||||
public Population(String id, PopulationArgs total) {
|
||||
this.id = id;
|
||||
this.total = total;
|
||||
this.perYear = new HashMap<>();
|
||||
}
|
||||
/**
|
||||
* Les informations de la population sur le total.
|
||||
*/
|
||||
private PopulationArgs total;
|
||||
|
||||
public Population(String id) {
|
||||
this.id = id;
|
||||
this.total = null;
|
||||
this.perYear = new HashMap<>();
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public PopulationArgs getTotal() {
|
||||
return total;
|
||||
}
|
||||
|
||||
public HashMap<Integer,PopulationArgs> getPerYear() {
|
||||
return perYear;
|
||||
}
|
||||
|
||||
public void setTotal(PopulationArgs total) {
|
||||
this.total = total;
|
||||
}
|
||||
|
||||
public void setPerYear(HashMap<Integer,PopulationArgs> perYear) {
|
||||
this.perYear = perYear;
|
||||
}
|
||||
/**
|
||||
* Les informations de la population par année.
|
||||
* Clé : Année, Valeur : Informations de la population.
|
||||
*/
|
||||
private HashMap<Integer,PopulationArgs> perYear;
|
||||
|
||||
/**
|
||||
* Constructeur.
|
||||
* @param id Espèce
|
||||
* @param total Les informations totales.
|
||||
* @param perYear Les informations par année.
|
||||
*/
|
||||
public Population(String id, PopulationArgs total, HashMap<Integer,PopulationArgs> perYear) {
|
||||
this.id = id;
|
||||
this.total = total;
|
||||
this.perYear = perYear;
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructeur.
|
||||
* Pour les informations par année, crée une HashMap vide. Devra être rempli après coup.
|
||||
* @param id Espèce de la population.
|
||||
* @param total Les informations totales.
|
||||
*/
|
||||
public Population(String id, PopulationArgs total) {
|
||||
this.id = id;
|
||||
this.total = total;
|
||||
this.perYear = new HashMap<>();
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructeur.
|
||||
* Pour les informations du total, sont remplacés par null.
|
||||
* Pour les informations par année, crée une HashMap vide. Devra être rempli après coup.
|
||||
* @param id Espèce de la population.
|
||||
*/
|
||||
public Population(String id) {
|
||||
this.id = id;
|
||||
this.total = null;
|
||||
this.perYear = new HashMap<>();
|
||||
}
|
||||
|
||||
/*
|
||||
GETTERS / SETTERS
|
||||
*/
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public PopulationArgs getTotal() {
|
||||
return total;
|
||||
}
|
||||
|
||||
public HashMap<Integer,PopulationArgs> getPerYear() {
|
||||
return perYear;
|
||||
}
|
||||
|
||||
public void setTotal(PopulationArgs total) {
|
||||
this.total = total;
|
||||
}
|
||||
|
||||
public void setPerYear(HashMap<Integer,PopulationArgs> perYear) {
|
||||
this.perYear = perYear;
|
||||
}
|
||||
|
||||
/**
|
||||
* Raccourci vers les méthodes de DataParsing.
|
||||
* @param data Notre objet RawData.
|
||||
* @param parseTypeId L'ID de parsing.
|
||||
* @return
|
||||
*/
|
||||
public static HashSet<Population> parse(RawData data, int parseTypeId ) throws RawDataOverflow, InvalidParsingException {
|
||||
switch (parseTypeId) {
|
||||
case 1:
|
||||
return PopulationParsing.parseParasitesPeru(data);
|
||||
default:
|
||||
throw new InvalidParsingException(parseTypeId, Population.class.getSimpleName() );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Raccourci vers les méthodes de DataParsing.
|
||||
* Va par défaut faire ceux des parasites du Perou.
|
||||
*
|
||||
* @param data Notre objet RawData.
|
||||
* @return Notre tableau de populations.
|
||||
*/
|
||||
public static HashSet<Population> parse(RawData data){
|
||||
return PopulationParsing.parseParasitesPeru(data);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -1,9 +1,19 @@
|
||||
package ecoparasite.population;
|
||||
|
||||
/**
|
||||
* Permet de stocker les paramètres d'une population pour une année spécifique.
|
||||
* Par convention, si on est sur le total, on mettra comme année 0.
|
||||
*/
|
||||
public class PopulationArgs {
|
||||
|
||||
/**
|
||||
* Année de référence pour ces paramètres.
|
||||
*/
|
||||
private int year;
|
||||
|
||||
/**
|
||||
* Le nombre d'individus analysés.
|
||||
*/
|
||||
private int number;
|
||||
private PopulationArgInterval length;
|
||||
private PopulationArgInterval width;
|
||||
@@ -12,6 +22,19 @@ public class PopulationArgs {
|
||||
private Double intensity;
|
||||
private Double abondance;
|
||||
|
||||
/**
|
||||
* Constructeur.
|
||||
* Toutes les données peuvent être préremplis dans ce constructeur sauf l'année.
|
||||
* L'année sera par défaut à zéro.
|
||||
*
|
||||
* @param N
|
||||
* @param length
|
||||
* @param width
|
||||
* @param prevalence
|
||||
* @param ic
|
||||
* @param intensity
|
||||
* @param abondance
|
||||
*/
|
||||
public PopulationArgs(
|
||||
int N,
|
||||
PopulationArgInterval length,
|
||||
@@ -31,6 +54,19 @@ public class PopulationArgs {
|
||||
this.abondance = abondance;
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructeur.
|
||||
* Toutes les données ainsi que l'année peuvent être préremplis.
|
||||
*
|
||||
* @param year
|
||||
* @param N
|
||||
* @param length
|
||||
* @param width
|
||||
* @param prevalence
|
||||
* @param ic
|
||||
* @param intensity
|
||||
* @param abondance
|
||||
*/
|
||||
public PopulationArgs(
|
||||
int year,
|
||||
int N,
|
||||
@@ -51,16 +87,30 @@ public class PopulationArgs {
|
||||
this.abondance = abondance;
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructeur.
|
||||
* Permet de remplir tout d'abord l'année, les autres paramètres seront remplis par les setters.
|
||||
*
|
||||
* @param year
|
||||
*/
|
||||
public PopulationArgs(
|
||||
int year
|
||||
){
|
||||
this.year = year;
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructeur.
|
||||
* Initialise l'objet avec une année par défaut (0).
|
||||
*/
|
||||
public PopulationArgs(){
|
||||
this.year = 0;
|
||||
}
|
||||
|
||||
/*
|
||||
GETTERS / SETTERS
|
||||
*/
|
||||
|
||||
public int getYear() {
|
||||
return year;
|
||||
}
|
||||
|
||||
@@ -6,9 +6,18 @@ import ecoparasite.input.RawDataOverflow;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
|
||||
/**
|
||||
* Permet de parser une population spécifique via les schémas fournis.
|
||||
*/
|
||||
public class PopulationParsing {
|
||||
|
||||
public static HashMap<String,Population> parseParasitesPeru(RawData peruRawData ){
|
||||
/**
|
||||
* Permet, à partir d'un objet RawData, de parse les données tel que le fichier parasitesPeru est structuré.
|
||||
*
|
||||
* @param peruRawData
|
||||
* @return Une liste des populations incluses.
|
||||
*/
|
||||
public static HashSet<Population> parseParasitesPeru(RawData peruRawData ){
|
||||
|
||||
HashMap<String,Population> response = new HashMap<>();
|
||||
|
||||
@@ -19,9 +28,9 @@ public class PopulationParsing {
|
||||
HashMap<String,String> fields = peruRawData.getEntry(index);
|
||||
|
||||
String espece = fields.get("Espèce");
|
||||
System.out.println(espece);
|
||||
String parametre = fields.get("Paramètre");
|
||||
|
||||
// Récupère la population si elle existe déjà.
|
||||
Population population = null;
|
||||
if( response.containsKey( espece ) ){
|
||||
population = response.get(espece);
|
||||
@@ -59,13 +68,20 @@ public class PopulationParsing {
|
||||
response.put( espece, population );
|
||||
index++;
|
||||
}
|
||||
} catch (RawDataOverflow e){
|
||||
} catch (RawDataOverflow e){ // Débordement, on a atteint la fin de l'objet RawData.
|
||||
// Stop.
|
||||
}
|
||||
|
||||
return response;
|
||||
return new HashSet<Population>( response.values() );
|
||||
}
|
||||
|
||||
/**
|
||||
* Permet d'appliquer la valeur au paramètre respectif en se basant sur le nom de la colonne.
|
||||
*
|
||||
* @param populationArgs Les paramètres de la population actuelle.
|
||||
* @param column Le nom de la colonne dans le fichier CSV
|
||||
* @param value La valeur a affecter
|
||||
*/
|
||||
private static void applyValueForParasitesPeru( PopulationArgs populationArgs, String column, String value ){
|
||||
switch( column ){
|
||||
case "N":
|
||||
|
||||
@@ -15,13 +15,15 @@ import static org.junit.jupiter.api.Assertions.*;
|
||||
class CompletionTest {
|
||||
|
||||
@org.junit.jupiter.api.Test
|
||||
void completePoisson() throws InputFileException, RawDataOverflow {
|
||||
void completePoissonMean() throws InputFileException, RawDataOverflow {
|
||||
|
||||
RawData test = InputFactory.readData("test.csv");
|
||||
RawData test = InputFactory.readData("testComplete.csv");
|
||||
|
||||
HashSet<Poisson> testp = Mackerel.parse(test);
|
||||
|
||||
testp = Completion.completePoisson(testp);
|
||||
System.out.println(testp);
|
||||
|
||||
testp = Completion.completePoissonMean(testp);
|
||||
|
||||
System.out.println(testp);
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ class InputFactoryTest {
|
||||
|
||||
@org.junit.jupiter.api.Test
|
||||
void readData() throws InputFileException {
|
||||
RawData test = InputFactory.readData("test.csv");
|
||||
RawData test = InputFactory.readData("testComplete.csv");
|
||||
|
||||
System.out.println(test.getData());
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ class RawDataTest {
|
||||
|
||||
@Test
|
||||
void getColumnsNames() throws InputFileException {
|
||||
RawData test = InputFactory.readData("test.csv");
|
||||
RawData test = InputFactory.readData("testComplete.csv");
|
||||
|
||||
HashSet<String> d = new HashSet<>();
|
||||
|
||||
@@ -27,7 +27,7 @@ class RawDataTest {
|
||||
|
||||
@Test
|
||||
void getDataFromColumn() throws InputFileException {
|
||||
RawData test = InputFactory.readData("test.csv");
|
||||
RawData test = InputFactory.readData("testComplete.csv");
|
||||
|
||||
System.out.println(test.getDataFromColumn("Sample_code"));
|
||||
|
||||
@@ -35,7 +35,7 @@ class RawDataTest {
|
||||
|
||||
@Test
|
||||
void getEntry() throws InputFileException, RawDataOverflow {
|
||||
RawData test = InputFactory.readData("test.csv");
|
||||
RawData test = InputFactory.readData("testComplete.csv");
|
||||
|
||||
System.out.println(test.getEntry(2));
|
||||
}
|
||||
|
||||
30
tests/ecoparasite/nettoyage/NettoyageTest.java
Normal file
30
tests/ecoparasite/nettoyage/NettoyageTest.java
Normal file
@@ -0,0 +1,30 @@
|
||||
package ecoparasite.nettoyage;
|
||||
|
||||
import ecoparasite.completion.Completion;
|
||||
import ecoparasite.input.InputFactory;
|
||||
import ecoparasite.input.InputFileException;
|
||||
import ecoparasite.input.RawData;
|
||||
import ecoparasite.input.RawDataOverflow;
|
||||
import ecoparasite.poisson.Mackerel;
|
||||
import ecoparasite.poisson.Poisson;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.util.HashSet;
|
||||
|
||||
class NettoyageTest {
|
||||
|
||||
@org.junit.jupiter.api.Test
|
||||
void nettoiePoissonMean() throws InputFileException, RawDataOverflow {
|
||||
|
||||
RawData test = InputFactory.readData("testNettoie.csv");
|
||||
|
||||
HashSet<Poisson> testp = Mackerel.parse(test);
|
||||
|
||||
System.out.println(testp);
|
||||
|
||||
testp = Nettoyage.nettoiePoissonMean(testp);
|
||||
|
||||
System.out.println(testp);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -6,7 +6,7 @@ import ecoparasite.input.RawData;
|
||||
import ecoparasite.input.RawDataOverflow;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
|
||||
@@ -16,7 +16,8 @@ class PopulationParsingTest {
|
||||
void parseParasitesPeru() throws InputFileException, RawDataOverflow {
|
||||
|
||||
RawData parasitesPeru = InputFactory.readData( InputFactory.DATA_PARASITES_PERU, "," );
|
||||
HashMap<String,Population> populations = PopulationParsing.parseParasitesPeru( parasitesPeru );
|
||||
HashSet<Population> populations = Population.parse( parasitesPeru );
|
||||
System.out.println( populations);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user