From ccf552ae602b7d4a5f558f4a6e21c448769ee8eb Mon Sep 17 00:00:00 2001 From: emerick-biron Date: Mon, 18 Jan 2021 10:57:55 +0100 Subject: [PATCH 001/111] First commit --- src/main/java/edt/umontp/fr/EmploiDuTemps.java | 12 ++++++++++++ src/main/java/edt/umontp/fr/Test.java | 7 +++++++ 2 files changed, 19 insertions(+) create mode 100644 src/main/java/edt/umontp/fr/EmploiDuTemps.java create mode 100644 src/main/java/edt/umontp/fr/Test.java diff --git a/src/main/java/edt/umontp/fr/EmploiDuTemps.java b/src/main/java/edt/umontp/fr/EmploiDuTemps.java new file mode 100644 index 0000000..b5f1921 --- /dev/null +++ b/src/main/java/edt/umontp/fr/EmploiDuTemps.java @@ -0,0 +1,12 @@ +package edt.umontp.fr; + +import java.io.File; + +public class EmploiDuTemps { + private final String LIEN_ICAL = ""; + private final EmploiDuTemps singleton = null; + + public File getIcs (String LIEN_ICAL){ + + } +} diff --git a/src/main/java/edt/umontp/fr/Test.java b/src/main/java/edt/umontp/fr/Test.java new file mode 100644 index 0000000..385a2ef --- /dev/null +++ b/src/main/java/edt/umontp/fr/Test.java @@ -0,0 +1,7 @@ +package edt.umontp.fr; + +public class Test { + public static void main(String[] args) { + + } +} From 5e886a3a8e52da7e2e2a2f6f4728b66feabafc3b Mon Sep 17 00:00:00 2001 From: MathieuSoysal Date: Mon, 18 Jan 2021 10:58:47 +0100 Subject: [PATCH 002/111] =?UTF-8?q?=F0=9F=93=9D=20Mise=20=C3=A0=20jour=20d?= =?UTF-8?q?iagramme=20UML?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ressources/uml/DiagrammeDeClasse.pdf | Bin 25178 -> 25140 bytes ressources/uml/Diagrammes.mdj | 194 ++++++++++++++------------- 2 files changed, 99 insertions(+), 95 deletions(-) diff --git a/ressources/uml/DiagrammeDeClasse.pdf b/ressources/uml/DiagrammeDeClasse.pdf index d59154971b7a3317f18c8d550a8d2201214bce2d..4659d4603ce6590ffca6c06e60d95b034d6fe213 100644 GIT binary patch delta 4128 zcmV+*5Z~|G!~wL#0kFdX2RJY}H8?Uilga^{224sqNK#s}YyuPk224sqNK#s}h670h z224sqNK#sp)dq@kKg^_=|BHGJpJ|OAG^aB zuIepD1K^$U+J=DLc|~6i|GN9`=P%Ix{mWhO&>0^)vPK1<=xhg0e|P_Wx_iF+<&6kJ zCx0?DOwgQRXt+PLpMJedHM(Da`U|)6-!mZoS`%XQ-RC<%2m??l`BW9ACA)wrC9i|| z`*NtIAIhE_T3n3iA3u(eV${lM=R)j2TV(=c=DUwf(4VLSl?yo)&Drm+uZNz zD(1Y*ZL~d+X|6wHQR)kMf&DlTW{pgGp4TnM&^pX^7zwsXPP#l3ZI;BbAD(G`6>XtE z{`)QV1XUZ;e>cFz3Kogco>g?;S?iT$&f3s1k+m!mWJ7~kkFxqw$H=SvpZXdKmncM6?%>90*g0+)<;xNZw8F zRhA~}fOeRx1qUvg3C)rk8 zM%)y@wgB4K+5_hRWBU?Suns|hdc}Z+b2Hd|9SDw0hbAz0ZHU)2QUJgyARrzYWVf~8 zqdNpmjClZy9id(w^oJHVAb`-S5G^{>dA7Hbe_O3A3qgSi9&HCiptRvR8M&C`*$aYw zHR=xhq9Nstvut+uHDs6_X{abpFw?7J8P9DV%YZ&r9a{|A&0xy2yf|Ui*O-u>HMFGj zaQBZYn=Cw_3!;7IXjujmBhZW-^@%z?a@1$)+{n>X!@$vo%3?oobSjH9F`{TO#yL!W zf0h>utWu2v`LdxUojY*!w1E4nxms=6;B}x2m=+4d(#l6|(WjCtE(@|;eL#fSR`YV( z>Pe5TuC%~EirSzj_v(FKG;Z6~o_S%+*0%dQ`^e53T-reANcKhfR(Bq?Xd%Qzj<-?i zK>S~thHqAn_FEKrg0c*l1=1K>Yg?WHe;|X?`-58%rzb&HlQja;>Lj>XQjT#uy5`n= z50ppT0w|YUQNXbrQkLbd>*D&}{F?-rPVptlz7ow@F4u-oqv!?ih60Fs-{H9DB#X&Y zJG@%ArgsXSc|m_u0Tqc4w7utY#fX}=#}IDr$lPFY+ltV5jwoQtS=F<~i>c0HZw`A_ z$2x^NTDYpFi-a9+YkK86`l^+8*!v&W_tE>;hR2Bc5H_^9Hn)eZ=2=8`W+sBK7M~U! z&*HE@w9}zmCm~h~788h8HbsKfe*;Wk)j5fsbS?KvyyZD{2^J7SyKho_u zds*YW3E1S=0(8m{I0HOl>m4@<$;Y%eu$6-tCjizv`4O^9%Sv=}53;UDD}jV1NVw+V zcO&eUO^2}M&w5%o?6G(rf6kvYdLD(Bs`cXxY0)xyO@7Sl|8kLfp};po-1-59Wz;Tg z5Lz)t^_)ra8+G(IE`Pjp81tHJV(e^HJKJhr5v&oJYi&@DxydVW37M52RZeFJyA$YLMccf4IvTTtMq{4R4P& zR1_ze>D8jljiFIxiw5T~`B`2puu3&bf{KQgbXJQ6)TSVsGDnLt@C8R<;%LI%PaN&3 z;~_J0G|?Z9HdGWRnCaD`EKZClS|mG%N&SljR;flwP|?tm&Z@D1Uo}^&rPX1@DLS1z z3N-G9O34-d2W-)*e-OQKY&4P_uDxKN(Df04>0ep0LSCQmn^<#0uuM|;mLp;>R>qr5 z5^;;HHt_CQAR6;R2aBB#SwC`oEAi4I=hG5W(+TXT3nqm#f{6@mhdrj_nhQ8&Rn@Z= z6(l-cx)tVNS&h^xI94X1i>&%uO78aKZ+@z$4eX9-t=@}Ze{wvu?8J#xQV*8*s0f)h zHh)-)i81ID1v^3Z-pLU#t34N3#ma_{`xqlHM^n^ZInNrAc>Yky9QP8tFmU7(*B}MX z7;e*v_7N>=nN)nE4Dzg!H;wX?G?Y(#kKMDEo(!~nbqI3o=;7BGF?v&0OOEw4FDDY#}J8TWDwmRRw!kQ1ziqjQnwK@exP z%?l(tU@^YYb`nn}tEM?+!_3(@9BMb0;vmK?X)@k#f6~{6SOn6bki2CLL(a3TZ2QA- z%-_A}M=r0UgZ`Q&*$6=$H|%7$hFloBg= zal9%kwl)Tgp5??CVQq$kG{j>6x&u2WSo*@7*7#%tcYYR>lI)_lPvtzhp?olj6}+yk zu|g7GfA63}?}x5iO>Zs(uPJoRI(HdeqK43=P3}@lV;8o$+mO^TdYikAoC6kgDQt7M zjVSLPUBAv<-_}$Uvtk8ZYD|!kS>-M@Cdddkx!aN;BiQC{LxK$BDtEClodMTBiGqzu z23-GCNkX@wv5R(_yYF-Yl@Mj$@pFG?lIzbxe|ZO994uhuG?}mI3n~uEaNtYs`0K5hg}h~j5gi(SDStVqz-KQ#8cp#eH;e6 zA?B$=aan??=E-pBlMFo+s_Mdc0jY{BpP^XXu{&4knM0~Yk8?YYg7yBHLAu)a<+v<5 zf3}r63BFm|YroIYZaF?FrBp8W(RK~M-Y@bvC~Jd_lA&=3Jf4c&6fO*;y!HgK^DLs6 zLZx#ho1%_I_UafUGlWe^7LPSjl=>WUToz4%!bNKVXV5~59WAht-%BcrXydSiRx8-J zAa;m~or-K3%Q`U;6HiAb_GHD0i9)tHf7VD*>T*16Su{nl7Oi>D+2qJ$J!`L6EJzNC<>E8JGExb44O^CaY9CZE@=qG>A5AaI{IuZNVSQBMG3}938MjL z6rAHo680pyk!1ND;aD3*X@VsToQfpn`=EnOt;xDkK;uVQT}EX1xxja7e_}~iO-=SI zVqvYNR}$EzNN<*?jF$&N?5csXga6PY9}vnDXpak`SL@pb3Lr{VvLxKND1-}d329Zr3Udl<1X={3tNXNRowA6 zE1v7w9n)(~SV}36SkA2&e`;y?2Bn=d+NII^(0f7XL7&Y1)<|v)0wad#>NhGbj>?v= zDMh2X!Oga@i2sAbrEuii8f4FbvqR+dg+f6~GhhWlJcaEV&Ln$p;!(CG?O* z(Fj#)VDOgbmz9&~IyyG}KAm{8o>15y(`yL@bh>k^KG5SL;daD=e`spPuDU`m6$Z3xvRIv2q+1Q(_?F31(2G206=W zS^5+vp`4$|I?^m+mTw!S2M%Sr-z!=P68rd}ZqMjc_J={L%QQAOCI;JpO` zTX&uDQ4&9DtekSvf3n#fZAcj=9VpADur@QuHliYLjKrPFOfzPm9l0ZBOn~AGQYjc~ zxE1|h^54UB+kgJFeC1_H|K^L5YSztr5l}7kY>7F%!2C@(>=KT}Gj+^&Zd6>6tQURz zCJWwS&tPzAJn8AnAmT$)|{z}b+rX_f$IYMm$>GVC52ZD zr6J!*T+iCFlv5rE#^>o7@-L5lRs zLE&R~SV)+hyKLt#1YRadL_afLEaYfq{4ck_)~uk;AG)BR=ZWNI>=|Mn-Lo^!x&z(Q ey|IS>&WQRSqiTczvuI%H0SPuR3MC~)Peuw~Q{6%U delta 4166 zcmV-M5V`NP!~xpG0kFdX2RAY>FgZ0ilga^{22Vy$Nk~+)YyuPk22Vy$Nk~+)h670h z22Vy$Nk~+a)dqzjwYAfIXA zQle-WH2?Vk{68D5!Y~|uz5DGB5*P;3@|QtcQM4{ng0H^tk6-=i>A(LvJpKLqZ->Jt zF6u2t1K^$U+J=C`>p-6l|GxX``%f_ZPvPK1<=Sr-~D)(N(?`K_cw0kf3Lv!V@r(D55L|4LYR;W#6E!iWS0{J|g zza5KO`k@@jsl_9S{`TXHDMqcFb}qyLv{fc>&;0O_3Hl2SfD9NuKHvTHwbmN=L4JrI z!;j_1@#Fak{KRhte{Yo3w}X_wFUmiBGw7d(kAJ=U^G7E1hbs{qTpR+fh{Q{Y%y1#@ zfu93EkNiC4axvF^9-9LAW&qGCPz=T-w)mn3cEc9ux7Y&A7NC)2U>1NKzw<=Z;K$!5 zwm=x!1@VZL^4ooeOC9+x?LFo)(iSrYp1Wa;F`M%8Mj03de-5D=k}=juM$BWGrvyyn zi~0M*_#J61GZObZoH9_A3}KV7BC#Q4(jGF&l-cFSsnFT@f6&T;=jG{DJVMEU>-i(jMirwY3WL#5^+yhQ&W3Cq^x zr$zUPzO4HP{ZM8$#}D(kC9^JjGcry|vrn2n)W=mUe_iqlbfoMuQx@fp2AMVo`4lVg zz8KhBX8~+V!)(-NHr$Gw>&?MUda9K1LRZZcg>EQfS=@BW++vF*s&Ge(`XYU|)N8Cw z>WFrjs|5!xnhD*wy-9YQ-I5)g_BW=_lPn$d>Aj8)XNcXLA&HWQqb-X(OVVylCr-ACml_QxW=8zcwqJcLr^r39GqOwNdW+-fPn49foxS`(x9H) zA?QNp0W7kCc4vxiW zIB-Qn${T0d?Ho(62XLyP0-SKBsxyq|wh9)|r=oLObh{yFw?NM@=;s#33A0{0WA$55Mi~|e7tS- zr01iqw7@@#*`Sx>)%(0?-1bp>=7lj^+wSjtM)oS<(gp@c$pT{b4<5BxA;d(^AEVNN z_`fs_-)tW3w2sxRmr2cfNLkjmZV0iuH~%IDrc-=L@~^~lmdEv>)F}GFRgLBM4j>xO4(B~5 zSxlb#;g#7wA!tBjD2|Oj<=9 z-RQb6xKkM};!R{oRLm9T#8sVn!U3yiB}v%ImGraL-f8!LTH)vOzdp{4m=9s7$3yhF zL2Nb8B3iq`;G0FLMaQ!^?2qkyfAH2>jLpKu1fvx{IPfgaI0eu!LQPP*W0dZiioqGH zSbqi9pdZ*bt?l(eUTBi7@SLB?PUzzR$Z8=Y(AJv$nss_Q87iy$`#5 zWJe5LT9dbB4JKA1Y)aN2hWR@U1vZoFFN%$3TcT-^G$DJIyjbo-6cSr4fB!DNiSvey z3GoM<_XD|>*I=C-RHAXg4dlIo=*E+gzlC%0arubyW;9Ua(X@qM~~(&>E^UZ~vWP1Ur@ z`f>9=t^UVL)C=>y8{*97ZRIj*7d8lO7^C`{N%9j7^fSXB?;OUwBAX~%VlBOFtAjGu zh|aY(D97Biu)@ryk3?XS;}VXPb2{`C_Mk1Qs9j`ul$)L@a-)Euf0;w0xVF;Pde%k} zBQjg!WTMXyqc zlAxlYV>+A00)Ek4e{GglhYhFbbUII326#mE&u@@`jO(u!BMOGVl_bd>dok0hSgAdt0a{N&?Rz%OIC8XsM zu%jU`tL0*kiHvQByauN&7jSY}$g>p{BsyJ&71n6kjMOSPe>Nszh-~^=^5Zq5Q#F5S zXASJ$(^jJw!Q^;o?_Baq+TrpZ6(L9*08^-94D7$HFniAiFFEfkZ+d4!aI)vM#wmbn zhLQ0o$6(3I9g=)iIGmh|v<`uIRolEkq61dr8*L}`e`K<0no~BcjvA*+?dH-xh;vJt zjQ5-L^`RDlG$1+Qy0R!HLO9c<|Ry6dX39U^#Lb=TCn%iSgFsJpbu zUFu18VVk=hX&qCKOG@4CI~r-Uf`j=zqd zQcN{iC_jOh0~RoHm&~_3S)se#MSolj5lnh zY~KmJ$TRLkRE>9IIBZ4Da<}PzeEK{$KpMcNS3Cv&u+M?PZXNS9pd49(X?Bv~*mL(8 ze+xA|!gztH$x%LIvAE-KR_R$|YDJH8J4!))d{&sQ_I^2rMaRCa{3z~cqvmT+Mp<+Ue>gJ%`R6e^ty*%Wmwx>v^_c_C~{ zvUsYI0_tWi0E$L`*!L znK+Ua7bXhX=2RmE)a7{C60}6I7Oi=^!sc@n?cAHhE;!Z5F>P(*i@z{NHoFkvBn5BE zy(d{oyc}r?;EF*mQAP5S5BmeeYB=%9yGnh95W938c{>*K_U_TLtSCg|c=0tJf0QF1 z+?dT=t7xJndCjeI5F{QzT&Ce*o0?pi@wkGOf-rd0`VBI@Sf{m!--@uO(fZ5$antmniDDV`i6kv#hYMXd*x5g z{T_RnMt1vEom)5i`Z#uFTIz3Ff4#AbeAebTYsnv+qOAFYJ+3ONrmdijg1$dR$CQ$wz!>Kk3XhJ6S3Q$-K z+NCvXR@iJ(j!S3c=aPm{+@3o|*2bQV1*tZ1uz+A(j4+z|jMC>glY}Ele{LpOen&Xf zMgdK@gnDW~Rwb}B~fek)+t6X(2V7^M9jlgtYsZUduJY%XKNVIup5a?^ZBWSs&F4^YUh)li` z$eSNp-RohS7h}ZaL`sl#R7_9?eV(WyHHj;AW42}sU zjVGB?C1%SmGJ=&%loBV)GmWj@R*p=7<#kRvg=0-0#RKs2W~t?4+8SI{c?lV7zJN6I zZ{CZ5X2EC2J%<-Pe^VcJ3CQBPI_En#DpqvsMQ^{!s(0Eof0zz6p7iqW@`oicjQl(9 zK3sY&wCKKrTKDO2qAPwpu(MWyPwMOIG3@Mhw7#<{1JBf0ldd|m3=fuC?SY`A2u<&V zlf;LR-UVkQw#>|*(tbfIw|q+FmQT$rnq7L=Ed6NiQ|_HP>fPMqt65QjoeqQ5nLcHs zII)YEX6>|3f2a%ib3P`UVo~3Fe-OFi_%?AeEYE%i#eQ;b1on?5#jG4x$pKSvnrwo| ziJMs<@B)(JpHuziQ>wRoYBgut_PW^udeqmW-oNZ?h8$CPwO|_7&=T2GTb6Q?gw@Xd zlCrwk8A8YX8i+xZ=V zmuV8Q&y1H0S<#C8A8YHHA2e9U&h*F=$<8=3#5}rZXPk8hx~F?%4gXyc^?$9@gzU3I QVCew~IXDU>B}Gq03g(gx;s5{u diff --git a/ressources/uml/Diagrammes.mdj b/ressources/uml/Diagrammes.mdj index 1f4515a..342abb7 100644 --- a/ressources/uml/Diagrammes.mdj +++ b/ressources/uml/Diagrammes.mdj @@ -366,7 +366,7 @@ "visible": false, "font": "Arial;13;0", "left": 160, - "top": -496, + "top": -528, "height": 13 }, { @@ -377,7 +377,7 @@ }, "font": "Arial;13;1", "left": 405, - "top": 183, + "top": 167, "width": 548.5517578125, "height": 13, "text": "Cours" @@ -391,7 +391,7 @@ "visible": false, "font": "Arial;13;0", "left": 160, - "top": -496, + "top": -528, "width": 73.67724609375, "height": 13, "text": "(from Model)" @@ -405,14 +405,14 @@ "visible": false, "font": "Arial;13;0", "left": 160, - "top": -496, + "top": -528, "height": 13, "horizontalAlignment": 1 } ], "font": "Arial;13;0", "left": 400, - "top": 176, + "top": 160, "width": 558.5517578125, "height": 25, "stereotypeLabel": { @@ -449,7 +449,7 @@ }, "font": "Arial;13;0", "left": 405, - "top": 206, + "top": 190, "width": 548.5517578125, "height": 13, "text": "-date: LocalDate", @@ -466,7 +466,7 @@ }, "font": "Arial;13;0", "left": 405, - "top": 221, + "top": 205, "width": 548.5517578125, "height": 13, "text": "-prof: String", @@ -483,7 +483,7 @@ }, "font": "Arial;13;0", "left": 405, - "top": 236, + "top": 220, "width": 548.5517578125, "height": 13, "text": "-heureDebut: LocalTime", @@ -500,7 +500,7 @@ }, "font": "Arial;13;0", "left": 405, - "top": 251, + "top": 235, "width": 548.5517578125, "height": 13, "text": "-heureFin: LocalTime", @@ -517,7 +517,7 @@ }, "font": "Arial;13;0", "left": 405, - "top": 266, + "top": 250, "width": 548.5517578125, "height": 13, "text": "-lieu: String", @@ -534,7 +534,7 @@ }, "font": "Arial;13;0", "left": 405, - "top": 281, + "top": 265, "width": 548.5517578125, "height": 13, "text": "-duree: int", @@ -552,7 +552,7 @@ "visible": false, "font": "Arial;13;0", "left": 669, - "top": 80, + "top": 48, "width": 142.23828125, "height": 13, "text": "+classe", @@ -561,7 +561,7 @@ ], "font": "Arial;13;0", "left": 400, - "top": 201, + "top": 185, "width": 558.5517578125, "height": 98 }, @@ -586,7 +586,7 @@ }, "font": "Arial;13;0", "left": 405, - "top": 304, + "top": 288, "width": 548.5517578125, "height": 13, "text": "+Cours(date: LocalDate, prof: String, heureDebut: LocalTime, heureFin: LocalTime, lieu: String)", @@ -603,7 +603,7 @@ }, "font": "Arial;13;0", "left": 405, - "top": 319, + "top": 303, "width": 548.5517578125, "height": 13, "text": "+hashCode(): int", @@ -620,7 +620,7 @@ }, "font": "Arial;13;0", "left": 405, - "top": 334, + "top": 318, "width": 548.5517578125, "height": 13, "text": "+equals(other: Cours): boolean", @@ -637,7 +637,7 @@ }, "font": "Arial;13;0", "left": 405, - "top": 349, + "top": 333, "width": 548.5517578125, "height": 13, "text": "+compareTo(other: Cours): int", @@ -646,7 +646,7 @@ ], "font": "Arial;13;0", "left": 400, - "top": 299, + "top": 283, "width": 558.5517578125, "height": 68 }, @@ -662,7 +662,7 @@ "visible": false, "font": "Arial;13;0", "left": 80, - "top": -248, + "top": -264, "width": 10, "height": 10 }, @@ -678,7 +678,7 @@ "visible": false, "font": "Arial;13;0", "left": 80, - "top": -248, + "top": -264, "width": 10, "height": 10 } @@ -686,7 +686,7 @@ "font": "Arial;13;0", "containerChangeable": true, "left": 400, - "top": 176, + "top": 160, "width": 558.5517578125, "height": 191, "autoResize": true, @@ -727,8 +727,8 @@ }, "visible": false, "font": "Arial;13;0", - "left": 1070, - "top": 238, + "left": 1071, + "top": 232, "height": 13, "alpha": 1.5707963267948966, "distance": 15, @@ -748,8 +748,8 @@ }, "visible": null, "font": "Arial;13;0", - "left": 1070, - "top": 223, + "left": 1071, + "top": 217, "height": 13, "alpha": 1.5707963267948966, "distance": 30, @@ -770,7 +770,7 @@ "visible": false, "font": "Arial;13;0", "left": 1071, - "top": 267, + "top": 262, "height": 13, "alpha": -1.5707963267948966, "distance": 15, @@ -791,7 +791,7 @@ "visible": false, "font": "Arial;13;0", "left": 984, - "top": 241, + "top": 232, "height": 13, "alpha": 0.5235987755982988, "distance": 30, @@ -811,8 +811,8 @@ }, "visible": false, "font": "Arial;13;0", - "left": 986, - "top": 227, + "left": 987, + "top": 219, "height": 13, "alpha": 0.7853981633974483, "distance": 40, @@ -832,8 +832,8 @@ }, "visible": false, "font": "Arial;13;0", - "left": 981, - "top": 268, + "left": 980, + "top": 260, "height": 13, "alpha": -0.5235987755982988, "distance": 25, @@ -853,7 +853,7 @@ }, "font": "Arial;13;0", "left": 1115, - "top": 229, + "top": 225, "width": 48.07080078125, "height": 13, "alpha": -0.46743457487643214, @@ -874,8 +874,8 @@ }, "visible": false, "font": "Arial;13;0", - "left": 1153, - "top": 222, + "left": 1154, + "top": 218, "height": 13, "alpha": -0.7853981633974483, "distance": 40, @@ -894,7 +894,7 @@ }, "font": "Arial;13;0", "left": 1152, - "top": 268, + "top": 264, "width": 7.22998046875, "height": 13, "alpha": 0.5514587292381492, @@ -945,7 +945,7 @@ "$ref": "AAAAAAF3BtFqHc8CoK0=" }, "lineStyle": 1, - "points": "959:263;1183:256", + "points": "959:254;1183:253", "showVisibility": true, "nameLabel": { "$ref": "AAAAAAF3DTscxkfsTQo=" @@ -1305,7 +1305,7 @@ "visible": false, "font": "Arial;13;0", "left": 896, - "top": -192, + "top": -208, "height": 13 }, { @@ -1316,7 +1316,7 @@ }, "font": "Arial;13;1", "left": 1397, - "top": 495, + "top": 487, "width": 345.81396484375, "height": 13, "text": "EmploiDuTempsProxy" @@ -1330,7 +1330,7 @@ "visible": false, "font": "Arial;13;0", "left": 896, - "top": -192, + "top": -208, "width": 73.67724609375, "height": 13, "text": "(from Model)" @@ -1344,14 +1344,14 @@ "visible": false, "font": "Arial;13;0", "left": 896, - "top": -192, + "top": -208, "height": 13, "horizontalAlignment": 1 } ], "font": "Arial;13;0", "left": 1392, - "top": 488, + "top": 480, "width": 355.81396484375, "height": 25, "stereotypeLabel": { @@ -1388,7 +1388,7 @@ }, "font": "Arial;13;0", "left": 1397, - "top": 518, + "top": 510, "width": 345.81396484375, "height": 13, "text": "-singleton: EmploiDuTempsProxy", @@ -1397,7 +1397,7 @@ ], "font": "Arial;13;0", "left": 1392, - "top": 513, + "top": 505, "width": 355.81396484375, "height": 23 }, @@ -1422,7 +1422,7 @@ }, "font": "Arial;13;0", "left": 1397, - "top": 541, + "top": 533, "width": 345.81396484375, "height": 13, "text": "-EmploiDuTempsProxy()", @@ -1439,7 +1439,7 @@ }, "font": "Arial;13;0", "left": 1397, - "top": 556, + "top": 548, "width": 345.81396484375, "height": 13, "text": "+getInstance(): EmploiDuTempsProxy", @@ -1456,7 +1456,7 @@ }, "font": "Arial;13;0", "left": 1397, - "top": 571, + "top": 563, "width": 345.81396484375, "height": 13, "text": "+actualiser()", @@ -1473,7 +1473,7 @@ }, "font": "Arial;13;0", "left": 1397, - "top": 586, + "top": 578, "width": 345.81396484375, "height": 13, "text": "+getPlanningOf(date: LocalDate): Planning", @@ -1490,7 +1490,7 @@ }, "font": "Arial;13;0", "left": 1397, - "top": 601, + "top": 593, "width": 345.81396484375, "height": 13, "text": "+getPlanningOf(date: LocalDate, groupe: Groupe): Planning", @@ -1507,7 +1507,7 @@ }, "font": "Arial;13;0", "left": 1397, - "top": 616, + "top": 608, "width": 345.81396484375, "height": 13, "text": "+getPlanning(groupe: Groupe): Planning", @@ -1516,7 +1516,7 @@ ], "font": "Arial;13;0", "left": 1392, - "top": 536, + "top": 528, "width": 355.81396484375, "height": 98 }, @@ -1532,7 +1532,7 @@ "visible": false, "font": "Arial;13;0", "left": 448, - "top": -96, + "top": -104, "width": 10, "height": 10 }, @@ -1548,7 +1548,7 @@ "visible": false, "font": "Arial;13;0", "left": 448, - "top": -96, + "top": -104, "width": 10, "height": 10 } @@ -1556,7 +1556,7 @@ "font": "Arial;13;0", "containerChangeable": true, "left": 1392, - "top": 488, + "top": 480, "width": 355.81396484375, "height": 146, "autoResize": true, @@ -1658,7 +1658,7 @@ "$ref": "AAAAAAF3DT7GhU0hyZc=" }, "lineStyle": 1, - "points": "1569:634;1568:720;1328:720;1329.0833333333333:776", + "points": "1569:626;1568:720;1328:720;1329.0833333333333:776", "showVisibility": true, "nameLabel": { "$ref": "AAAAAAF3DUCFV1J1GXc=" @@ -1692,7 +1692,7 @@ "visible": false, "font": "Arial;13;0", "left": 1304, - "top": 564, + "top": 561, "height": 13, "alpha": 1.5707963267948966, "distance": 15, @@ -1713,7 +1713,7 @@ "visible": null, "font": "Arial;13;0", "left": 1304, - "top": 579, + "top": 576, "height": 13, "alpha": 1.5707963267948966, "distance": 30, @@ -1734,7 +1734,7 @@ "visible": false, "font": "Arial;13;0", "left": 1305, - "top": 535, + "top": 531, "height": 13, "alpha": -1.5707963267948966, "distance": 15, @@ -1754,8 +1754,8 @@ }, "visible": false, "font": "Arial;13;0", - "left": 1364, - "top": 565, + "left": 1365, + "top": 560, "height": 13, "alpha": 0.5235987755982988, "distance": 30, @@ -1776,7 +1776,7 @@ "visible": false, "font": "Arial;13;0", "left": 1362, - "top": 578, + "top": 574, "height": 13, "alpha": 0.7853981633974483, "distance": 40, @@ -1797,7 +1797,7 @@ "visible": false, "font": "Arial;13;0", "left": 1369, - "top": 538, + "top": 533, "height": 13, "alpha": -0.5235987755982988, "distance": 25, @@ -1817,7 +1817,7 @@ }, "font": "Arial;13;0", "left": 1232, - "top": 564, + "top": 560, "width": 143.05078125, "height": 13, "alpha": -0.17181522579126562, @@ -1838,8 +1838,8 @@ }, "visible": false, "font": "Arial;13;0", - "left": 1247, - "top": 577, + "left": 1248, + "top": 574, "height": 13, "alpha": -0.7853981633974483, "distance": 40, @@ -1858,7 +1858,7 @@ }, "font": "Arial;13;0", "left": 1238, - "top": 536, + "top": 533, "width": 7.22998046875, "height": 13, "alpha": 0.5235987755982988, @@ -1909,7 +1909,7 @@ "$ref": "AAAAAAF3DT7GhU0hyZc=" }, "lineStyle": 1, - "points": "1391:557;1220:555", + "points": "1391:552;1220:552", "showVisibility": true, "nameLabel": { "$ref": "AAAAAAF3DUC3aFL/gAk=" @@ -2231,7 +2231,7 @@ "visible": false, "font": "Arial;13;0", "left": 660, - "top": 540, + "top": 532, "height": 13, "alpha": 1.5707963267948966, "distance": 15, @@ -2252,7 +2252,7 @@ "visible": null, "font": "Arial;13;0", "left": 645, - "top": 540, + "top": 532, "height": 13, "alpha": 1.5707963267948966, "distance": 30, @@ -2273,7 +2273,7 @@ "visible": false, "font": "Arial;13;0", "left": 689, - "top": 541, + "top": 533, "height": 13, "alpha": -1.5707963267948966, "distance": 15, @@ -2355,8 +2355,8 @@ "$ref": "AAAAAAF3DYJbn2gpgTM=" }, "font": "Arial;13;0", - "left": 687, - "top": 397, + "left": 688, + "top": 380, "width": 39.380859375, "height": 13, "alpha": 0.7027596317365179, @@ -2378,7 +2378,7 @@ "visible": false, "font": "Arial;13;0", "left": 648, - "top": 389, + "top": 373, "height": 13, "alpha": -0.7853981633974483, "distance": 40, @@ -2397,7 +2397,7 @@ }, "font": "Arial;13;0", "left": 686, - "top": 382, + "top": 366, "width": 6.5, "height": 13, "alpha": 0.5235987755982988, @@ -2448,7 +2448,7 @@ "$ref": "AAAAAAF3DYIX12eTj4w=" }, "lineStyle": 1, - "points": "674:727;677:367", + "points": "674:727;677:351", "showVisibility": true, "nameLabel": { "$ref": "AAAAAAF3DYJboGgs9YE=" @@ -5408,8 +5408,8 @@ "$ref": "AAAAAAF3EcZcAc7ATz4=" }, "font": "Arial;13;0", - "left": 260, - "top": 271, + "left": 261, + "top": 265, "width": 65.37451171875, "height": 13, "alpha": 1.5707963267948966, @@ -5430,8 +5430,8 @@ "$ref": "AAAAAAF3EcZcAc7ATz4=" }, "font": "Arial;13;0", - "left": 273, - "top": 286, + "left": 274, + "top": 280, "width": 39.0380859375, "height": 13, "alpha": 1.5707963267948966, @@ -5453,8 +5453,8 @@ }, "visible": false, "font": "Arial;13;0", - "left": 293, - "top": 242, + "left": 292, + "top": 236, "height": 13, "alpha": -1.5707963267948966, "distance": 15, @@ -5472,7 +5472,7 @@ "$ref": "AAAAAAF3BtFqHc8CoK0=" }, "lineStyle": 1, - "points": "399:265;188:261", + "points": "399:257;188:258", "showVisibility": true, "nameLabel": { "$ref": "AAAAAAF3EcZcAs7DOgk=" @@ -5505,8 +5505,8 @@ }, "visible": false, "font": "Arial;13;0", - "left": 537, - "top": 407, + "left": 539, + "top": 399, "height": 13, "alpha": 1.5707963267948966, "distance": 15, @@ -5526,8 +5526,8 @@ }, "visible": null, "font": "Arial;13;0", - "left": 526, - "top": 397, + "left": 527, + "top": 390, "height": 13, "alpha": 1.5707963267948966, "distance": 30, @@ -5547,8 +5547,8 @@ }, "visible": false, "font": "Arial;13;0", - "left": 560, - "top": 426, + "left": 562, + "top": 418, "height": 13, "alpha": -1.5707963267948966, "distance": 15, @@ -5566,7 +5566,7 @@ "$ref": "AAAAAAF3EAgksCDarvI=" }, "lineStyle": 1, - "points": "502:479;597:367", + "points": "500:479;602:351", "showVisibility": true, "nameLabel": { "$ref": "AAAAAAF3Ece2UdGnMao=" @@ -5605,7 +5605,7 @@ "$ref": "AAAAAAF3DT7GhU0hyZc=" }, "lineStyle": 1, - "points": "1748:543;1816:537" + "points": "1748:539;1816:535" }, { "_type": "UMLNoteView", @@ -5615,7 +5615,7 @@ }, "font": "Arial;13;0", "left": 280, - "top": 136, + "top": 120, "width": 145, "height": 38, "text": "Compare heureDebut" @@ -5634,7 +5634,7 @@ "$ref": "AAAAAAF3EcZcAs7CKZI=" }, "lineStyle": 1, - "points": "293:263;341:174" + "points": "293:257;342:158" }, { "_type": "UMLNoteView", @@ -6042,7 +6042,8 @@ "_parent": { "$ref": "AAAAAAF3BtFqHc8AoKI=" }, - "name": "classe" + "name": "classe", + "type": "" } ], "operations": [ @@ -6796,7 +6797,8 @@ "_parent": { "$ref": "AAAAAAF3EDiSNTms2ZQ=" }, - "name": "groupe" + "name": "groupe", + "type": "" }, { "_type": "UMLParameter", @@ -6825,7 +6827,8 @@ "_parent": { "$ref": "AAAAAAF3EDkI9joluB4=" }, - "name": "groupe" + "name": "groupe", + "type": "" }, { "_type": "UMLParameter", @@ -6979,7 +6982,8 @@ "_parent": { "$ref": "AAAAAAF3EIEEflAw1Y8=" }, - "name": "other" + "name": "other", + "type": "" }, { "_type": "UMLParameter", From 3903cd4347405b473cb162c281bbe3473abed51d Mon Sep 17 00:00:00 2001 From: emerick-biron Date: Mon, 18 Jan 2021 11:22:41 +0100 Subject: [PATCH 003/111] squelette app --- src/main/java/edt/umontp/fr/Cours.java | 39 ++++++++++++++ src/main/java/edt/umontp/fr/Groupe.java | 4 ++ src/main/java/edt/umontp/fr/Planning.java | 65 +++++++++++++++++++++++ 3 files changed, 108 insertions(+) create mode 100644 src/main/java/edt/umontp/fr/Cours.java create mode 100644 src/main/java/edt/umontp/fr/Groupe.java create mode 100644 src/main/java/edt/umontp/fr/Planning.java diff --git a/src/main/java/edt/umontp/fr/Cours.java b/src/main/java/edt/umontp/fr/Cours.java new file mode 100644 index 0000000..ea02841 --- /dev/null +++ b/src/main/java/edt/umontp/fr/Cours.java @@ -0,0 +1,39 @@ +package edt.umontp.fr; + +import java.time.LocalDate; +import java.time.LocalTime; +import java.util.Objects; + +public class Cours { + private final LocalDate date; + private final String prof; + private final LocalTime heureDebut; + private final LocalTime heureFin; + private final String lieu; + private final int duree; + private final Groupe groupe; + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + Cours cours = (Cours) o; + return duree == cours.duree && date.equals(cours.date) && prof.equals(cours.prof) && heureDebut.equals(cours.heureDebut) && heureFin.equals(cours.heureFin) && lieu.equals(cours.lieu) && groupe == cours.groupe; + } + + @Override + public int hashCode() { + return Objects.hash(date, prof, heureDebut, heureFin, lieu, duree, groupe); + } + + public Cours(LocalDate date, String prof, LocalTime heureDebut, LocalTime heureFin, String lieu, int duree, + Groupe groupe) { + this.date = date; + this.prof = prof; + this.heureDebut = heureDebut; + this.heureFin = heureFin; + this.lieu = lieu; + this.duree = duree; + this.groupe = groupe; + } +} diff --git a/src/main/java/edt/umontp/fr/Groupe.java b/src/main/java/edt/umontp/fr/Groupe.java new file mode 100644 index 0000000..d46909b --- /dev/null +++ b/src/main/java/edt/umontp/fr/Groupe.java @@ -0,0 +1,4 @@ +package edt.umontp.fr; + +public enum Groupe { +} diff --git a/src/main/java/edt/umontp/fr/Planning.java b/src/main/java/edt/umontp/fr/Planning.java new file mode 100644 index 0000000..8d24726 --- /dev/null +++ b/src/main/java/edt/umontp/fr/Planning.java @@ -0,0 +1,65 @@ +package edt.umontp.fr; + +import java.time.LocalDate; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.Spliterator; +import java.util.function.Consumer; + +public class Planning implements Iterable { + private ArrayList cours; + + public Planning(ArrayList cours) { + this.cours = cours; + } + + //TODO a coder + @Override + public Iterator iterator() { + return null; + } + + //TODO a coder + @Override + public void forEach(Consumer action) { + + } + + //TODO a coder + @Override + public Spliterator spliterator() { + return null; + } + + //TODO a coder + public Planning getPlanningOf(LocalDate date) { + return null; + } + + //TODO a coder + public Planning getPlanningOf(LocalDate date, Groupe groupe) { + return null; + } + + //TODO a coder; + public Planning getPlanningOf(Groupe groupe) { + return null; + } +} + + + + + + + + + + + + + + + + + From 7c36b09f532c644a913dff22a1dad9e4bb2e28ac Mon Sep 17 00:00:00 2001 From: emerick-biron Date: Mon, 18 Jan 2021 11:28:59 +0100 Subject: [PATCH 004/111] squelette app --- src/main/java/edt/umontp/fr/Planifiable.java | 13 +++++++++++++ src/main/java/edt/umontp/fr/Planning.java | 7 +++++-- 2 files changed, 18 insertions(+), 2 deletions(-) create mode 100644 src/main/java/edt/umontp/fr/Planifiable.java diff --git a/src/main/java/edt/umontp/fr/Planifiable.java b/src/main/java/edt/umontp/fr/Planifiable.java new file mode 100644 index 0000000..271f20c --- /dev/null +++ b/src/main/java/edt/umontp/fr/Planifiable.java @@ -0,0 +1,13 @@ +package edt.umontp.fr; + +import java.time.LocalDate; +import java.util.Date; + +public interface Planifiable { + public Planning getPlanningOf(LocalDate date); + + public Planning getPlanningOf(LocalDate date, Groupe groupe); + + public Planning getPlanningOf(Groupe groupe); + +} diff --git a/src/main/java/edt/umontp/fr/Planning.java b/src/main/java/edt/umontp/fr/Planning.java index 8d24726..cda5f22 100644 --- a/src/main/java/edt/umontp/fr/Planning.java +++ b/src/main/java/edt/umontp/fr/Planning.java @@ -6,7 +6,7 @@ import java.util.Spliterator; import java.util.function.Consumer; -public class Planning implements Iterable { +public class Planning implements Iterable, Planifiable { private ArrayList cours; public Planning(ArrayList cours) { @@ -32,16 +32,19 @@ public Spliterator spliterator() { } //TODO a coder + @Override public Planning getPlanningOf(LocalDate date) { return null; } //TODO a coder + @Override public Planning getPlanningOf(LocalDate date, Groupe groupe) { return null; } - //TODO a coder; + //TODO a coder + @Override public Planning getPlanningOf(Groupe groupe) { return null; } From c139a9b7b951413fcb0cdfcdf2cd52bf779e10d6 Mon Sep 17 00:00:00 2001 From: emerick-biron Date: Mon, 18 Jan 2021 11:37:16 +0100 Subject: [PATCH 005/111] squelette app --- src/main/java/edt/umontp/fr/InterfaceEmploiDuTemps.java | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 src/main/java/edt/umontp/fr/InterfaceEmploiDuTemps.java diff --git a/src/main/java/edt/umontp/fr/InterfaceEmploiDuTemps.java b/src/main/java/edt/umontp/fr/InterfaceEmploiDuTemps.java new file mode 100644 index 0000000..93ee511 --- /dev/null +++ b/src/main/java/edt/umontp/fr/InterfaceEmploiDuTemps.java @@ -0,0 +1,7 @@ +package edt.umontp.fr; + +import java.time.LocalDate; + +public interface InterfaceEmploiDuTemps extends Planifiable{ + public void actualiser(); +} From f2157b90e52456c199d6d7c72e0b018e2726ac14 Mon Sep 17 00:00:00 2001 From: emerick-biron Date: Mon, 18 Jan 2021 11:44:16 +0100 Subject: [PATCH 006/111] :hammer: enum Groupe --- src/main/java/edt/umontp/fr/Groupe.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/edt/umontp/fr/Groupe.java b/src/main/java/edt/umontp/fr/Groupe.java index d46909b..f2b64f7 100644 --- a/src/main/java/edt/umontp/fr/Groupe.java +++ b/src/main/java/edt/umontp/fr/Groupe.java @@ -1,4 +1,5 @@ package edt.umontp.fr; public enum Groupe { + A1, S1, S2, S3, S4, S5, S6, A2, Q1, Q2, Q3, Q4, G1, G2, G3, G4 } From 247f17ca1c4ec16501f0a92c50efe031cc71bd3b Mon Sep 17 00:00:00 2001 From: MathieuSoysal Date: Mon, 18 Jan 2021 11:47:21 +0100 Subject: [PATCH 007/111] =?UTF-8?q?=E2=9E=95=20Ajout=20dependence=20ical4j?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pom.xml b/pom.xml index 240da1f..c0d95ae 100644 --- a/pom.xml +++ b/pom.xml @@ -25,6 +25,11 @@ 4.13.1 test + + org.mnode.ical4j + ical4j + 1.0.2 + From 08382954224edc00c605c622bbaed2d2a313f6b3 Mon Sep 17 00:00:00 2001 From: MathieuSoysal Date: Mon, 18 Jan 2021 11:48:32 +0100 Subject: [PATCH 008/111] =?UTF-8?q?=F0=9F=9A=A7=20Ajout=20premier=20code?= =?UTF-8?q?=20pour=20r=C3=A9cup=C3=A9ration=20du=20fichier=20ics?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/edt/umontp/fr/EmploiDuTemps.java | 30 +++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/src/main/java/edt/umontp/fr/EmploiDuTemps.java b/src/main/java/edt/umontp/fr/EmploiDuTemps.java index b5f1921..9a89d11 100644 --- a/src/main/java/edt/umontp/fr/EmploiDuTemps.java +++ b/src/main/java/edt/umontp/fr/EmploiDuTemps.java @@ -1,12 +1,38 @@ package edt.umontp.fr; import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.net.URI; + +import net.fortuna.ical4j.data.CalendarBuilder; +import net.fortuna.ical4j.data.ParserException; +import net.fortuna.ical4j.model.Calendar; public class EmploiDuTemps { - private final String LIEN_ICAL = ""; + private final String LIEN_ICAL = "https://proseconsult.umontpellier.fr/jsp/custom/modules/plannings/direct_cal.jsp?data=58c99062bab31d256bee14356aca3f2423c0f022cb9660eba051b2653be722c431b66c493702208e664667048bc04373dc5c094f7d1a811b903031bde802c7f59b21846d3c6254443d7b6e956d3145c6e0d5bac87b70fdd185b8b86771d71211a02411e8351020815cfb0dcc54c667187353dbcfc377b44753a4f433d4e51f753c2b0fc0eafdcbc1cbb6ef4e715ebea9d495758b595b12cb294e70e715876fbaa3c654023c76f43cd51442775ff171e0a5f21b50c55a5b52d94df3e7977af823a1e78ee86c6497b1cf8732d52143eeffacc27449fc13ec1f0b04d23e09712df15579474e1aa0cd65f50f33a1dd766301,1"; private final EmploiDuTemps singleton = null; - public File getIcs (String LIEN_ICAL){ + private Calendar getCalendarDepuisIcal() { + URI uri = new URI(LIEN_ICAL); + // FIXME corrige rla fonction de récupération de lien. + File file = new File(LIEN_ICAL); + Calendar calendar = null; + try (FileInputStream fileICS = new FileInputStream(file)) { + CalendarBuilder builder = new CalendarBuilder(); + calendar = builder.build(fileICS); + } catch (FileNotFoundException e) { + e.printStackTrace(); + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (ParserException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + return calendar; } + } From d735a0aedeca8470afad0f1c8ccbe2bc26498622 Mon Sep 17 00:00:00 2001 From: emerick-biron Date: Mon, 18 Jan 2021 11:59:20 +0100 Subject: [PATCH 009/111] :hammer: squelette app --- src/main/java/edt/umontp/fr/Planning.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/edt/umontp/fr/Planning.java b/src/main/java/edt/umontp/fr/Planning.java index cda5f22..443c483 100644 --- a/src/main/java/edt/umontp/fr/Planning.java +++ b/src/main/java/edt/umontp/fr/Planning.java @@ -6,7 +6,7 @@ import java.util.Spliterator; import java.util.function.Consumer; -public class Planning implements Iterable, Planifiable { +public class Planning implements Iterable, Planifiable { private ArrayList cours; public Planning(ArrayList cours) { @@ -15,7 +15,7 @@ public Planning(ArrayList cours) { //TODO a coder @Override - public Iterator iterator() { + public Iterator iterator() { return null; } @@ -27,7 +27,7 @@ public void forEach(Consumer action) { //TODO a coder @Override - public Spliterator spliterator() { + public Spliterator spliterator() { return null; } From 345e4a5c5cbd15659076651c7fbddf20afc392f8 Mon Sep 17 00:00:00 2001 From: emerick-biron Date: Mon, 18 Jan 2021 12:12:48 +0100 Subject: [PATCH 010/111] :hammer: Cours implements Comparable --- src/main/java/edt/umontp/fr/Cours.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/main/java/edt/umontp/fr/Cours.java b/src/main/java/edt/umontp/fr/Cours.java index ea02841..e2263d1 100644 --- a/src/main/java/edt/umontp/fr/Cours.java +++ b/src/main/java/edt/umontp/fr/Cours.java @@ -4,7 +4,7 @@ import java.time.LocalTime; import java.util.Objects; -public class Cours { +public class Cours implements Comparable{ private final LocalDate date; private final String prof; private final LocalTime heureDebut; @@ -36,4 +36,9 @@ public Cours(LocalDate date, String prof, LocalTime heureDebut, LocalTime heureF this.duree = duree; this.groupe = groupe; } + + @Override + public int compareTo(int o) { + return 0; + } } From dce656a25f17eb8e44e36676e965fb00fd94da62 Mon Sep 17 00:00:00 2001 From: emerick-biron Date: Mon, 18 Jan 2021 12:13:21 +0100 Subject: [PATCH 011/111] :hammer: Cours implements Comparable --- src/main/java/edt/umontp/fr/Cours.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/edt/umontp/fr/Cours.java b/src/main/java/edt/umontp/fr/Cours.java index e2263d1..19bbd30 100644 --- a/src/main/java/edt/umontp/fr/Cours.java +++ b/src/main/java/edt/umontp/fr/Cours.java @@ -4,7 +4,7 @@ import java.time.LocalTime; import java.util.Objects; -public class Cours implements Comparable{ +public class Cours implements Comparable{ private final LocalDate date; private final String prof; private final LocalTime heureDebut; @@ -38,7 +38,7 @@ public Cours(LocalDate date, String prof, LocalTime heureDebut, LocalTime heureF } @Override - public int compareTo(int o) { + public int compareTo(Integer o) { return 0; } } From 9d0f5e6e09bb31e39d3d346b004f16d585d219b4 Mon Sep 17 00:00:00 2001 From: MathieuSoysal Date: Mon, 18 Jan 2021 12:20:12 +0100 Subject: [PATCH 012/111] =?UTF-8?q?=E2=AC=86=EF=B8=8F=20Mise=20=C3=A0=20jo?= =?UTF-8?q?ur=20JUnit=204=20->=205?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/pom.xml b/pom.xml index c0d95ae..06f4769 100644 --- a/pom.xml +++ b/pom.xml @@ -18,11 +18,23 @@ 11 + + + + org.junit + junit-bom + 5.5.2 + pom + import + + + + - junit - junit - 4.13.1 + org.junit.jupiter + junit-jupiter + 5.4.0-M1 test From 74864818957c227b6eb3ed03ae407fdf43482bbb Mon Sep 17 00:00:00 2001 From: MathieuSoysal Date: Mon, 18 Jan 2021 12:20:39 +0100 Subject: [PATCH 013/111] =?UTF-8?q?=F0=9F=9A=A7=20Ajout=20des=20class=20de?= =?UTF-8?q?=20test=20minimum?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/edt/umontp/fr/EmploiDuTemps.java | 26 +++++++++++++------ src/test/java/edt/umontp/fr/AppTest.java | 4 +-- .../java/edt/umontp/fr/EmploiDuTempsTest.java | 15 +++++++++++ 3 files changed, 35 insertions(+), 10 deletions(-) create mode 100644 src/test/java/edt/umontp/fr/EmploiDuTempsTest.java diff --git a/src/main/java/edt/umontp/fr/EmploiDuTemps.java b/src/main/java/edt/umontp/fr/EmploiDuTemps.java index 9a89d11..fedbf57 100644 --- a/src/main/java/edt/umontp/fr/EmploiDuTemps.java +++ b/src/main/java/edt/umontp/fr/EmploiDuTemps.java @@ -5,6 +5,7 @@ import java.io.FileNotFoundException; import java.io.IOException; import java.net.URI; +import java.net.URISyntaxException; import net.fortuna.ical4j.data.CalendarBuilder; import net.fortuna.ical4j.data.ParserException; @@ -14,25 +15,34 @@ public class EmploiDuTemps { private final String LIEN_ICAL = "https://proseconsult.umontpellier.fr/jsp/custom/modules/plannings/direct_cal.jsp?data=58c99062bab31d256bee14356aca3f2423c0f022cb9660eba051b2653be722c431b66c493702208e664667048bc04373dc5c094f7d1a811b903031bde802c7f59b21846d3c6254443d7b6e956d3145c6e0d5bac87b70fdd185b8b86771d71211a02411e8351020815cfb0dcc54c667187353dbcfc377b44753a4f433d4e51f753c2b0fc0eafdcbc1cbb6ef4e715ebea9d495758b595b12cb294e70e715876fbaa3c654023c76f43cd51442775ff171e0a5f21b50c55a5b52d94df3e7977af823a1e78ee86c6497b1cf8732d52143eeffacc27449fc13ec1f0b04d23e09712df15579474e1aa0cd65f50f33a1dd766301,1"; private final EmploiDuTemps singleton = null; - private Calendar getCalendarDepuisIcal() { - URI uri = new URI(LIEN_ICAL); - // FIXME corrige rla fonction de récupération de lien. - File file = new File(LIEN_ICAL); + private Calendar convertieFichierIcsEnCalendar(File fichierIcs){ Calendar calendar = null; - try (FileInputStream fileICS = new FileInputStream(file)) { + try (FileInputStream fileICS = new FileInputStream(fichierIcs)) { CalendarBuilder builder = new CalendarBuilder(); calendar = builder.build(fileICS); } catch (FileNotFoundException e) { - e.printStackTrace(); } catch (IOException e) { - // TODO Auto-generated catch block e.printStackTrace(); } catch (ParserException e) { - // TODO Auto-generated catch block e.printStackTrace(); } return calendar; } + private File getFichierIcsDepuisLienIcal() { + File fichierIcs = null; + try { + fichierIcs = new File(new URI(LIEN_ICAL)); + } catch (URISyntaxException e) { + e.printStackTrace(); + } + return fichierIcs; + } + + public void actualiser() { + File fichierIcs = getFichierIcsDepuisLienIcal(); + Calendar calendar = convertieFichierIcsEnCalendar(fichierIcs); + } + } diff --git a/src/test/java/edt/umontp/fr/AppTest.java b/src/test/java/edt/umontp/fr/AppTest.java index 1712b1a..497a762 100644 --- a/src/test/java/edt/umontp/fr/AppTest.java +++ b/src/test/java/edt/umontp/fr/AppTest.java @@ -1,8 +1,8 @@ package edt.umontp.fr; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertTrue; -import org.junit.Test; +import org.junit.jupiter.api.Test; /** * Unit test for simple App. diff --git a/src/test/java/edt/umontp/fr/EmploiDuTempsTest.java b/src/test/java/edt/umontp/fr/EmploiDuTempsTest.java new file mode 100644 index 0000000..e0cc095 --- /dev/null +++ b/src/test/java/edt/umontp/fr/EmploiDuTempsTest.java @@ -0,0 +1,15 @@ +package edt.umontp.fr; + +import static org.junit.jupiter.api.Assertions.assertAll; + +import org.junit.jupiter.api.Test; + +public class EmploiDuTempsTest { + + + @Test + void test_actualiser_verifierRetourneAucuneErreur(){ + EmploiDuTemps emploiDuTemps = new EmploiDuTemps(); + assertAll(() -> emploiDuTemps.actualiser()); + } +} From 53fef519487faadaa17d7b48a15ba9e4fa9e27bb Mon Sep 17 00:00:00 2001 From: MathieuSoysal Date: Mon, 18 Jan 2021 12:56:03 +0100 Subject: [PATCH 014/111] =?UTF-8?q?=E2=9C=94=20validation=20test?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/edt/umontp/fr/EmploiDuTemps.java | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/main/java/edt/umontp/fr/EmploiDuTemps.java b/src/main/java/edt/umontp/fr/EmploiDuTemps.java index fedbf57..d44bbd3 100644 --- a/src/main/java/edt/umontp/fr/EmploiDuTemps.java +++ b/src/main/java/edt/umontp/fr/EmploiDuTemps.java @@ -3,9 +3,15 @@ import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; +import java.io.FileOutputStream; import java.io.IOException; +import java.io.InputStream; import java.net.URI; import java.net.URISyntaxException; +import java.net.URL; +import java.net.URLConnection; +import java.nio.file.Files; +import java.nio.file.Paths; import net.fortuna.ical4j.data.CalendarBuilder; import net.fortuna.ical4j.data.ParserException; @@ -33,8 +39,12 @@ private Calendar convertieFichierIcsEnCalendar(File fichierIcs){ private File getFichierIcsDepuisLienIcal() { File fichierIcs = null; try { - fichierIcs = new File(new URI(LIEN_ICAL)); - } catch (URISyntaxException e) { + fichierIcs = File.createTempFile("temp", null); + URL url = new URL(LIEN_ICAL); + InputStream in = url.openStream(); + Files.copy(in, Paths.get(fichierIcs.getName())); + } catch (IOException e) { + // TODO Auto-generated catch block e.printStackTrace(); } return fichierIcs; From 65e1cd1a469bfc8400fa5ef6526476c15dd309d8 Mon Sep 17 00:00:00 2001 From: MathieuSoysal Date: Mon, 18 Jan 2021 13:07:34 +0100 Subject: [PATCH 015/111] =?UTF-8?q?=E2=9C=94=20Validation=20de=20tous=20le?= =?UTF-8?q?s=20test=20sans=20erreurs?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/edt/umontp/fr/EmploiDuTemps.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/main/java/edt/umontp/fr/EmploiDuTemps.java b/src/main/java/edt/umontp/fr/EmploiDuTemps.java index d44bbd3..ec81cf2 100644 --- a/src/main/java/edt/umontp/fr/EmploiDuTemps.java +++ b/src/main/java/edt/umontp/fr/EmploiDuTemps.java @@ -21,7 +21,7 @@ public class EmploiDuTemps { private final String LIEN_ICAL = "https://proseconsult.umontpellier.fr/jsp/custom/modules/plannings/direct_cal.jsp?data=58c99062bab31d256bee14356aca3f2423c0f022cb9660eba051b2653be722c431b66c493702208e664667048bc04373dc5c094f7d1a811b903031bde802c7f59b21846d3c6254443d7b6e956d3145c6e0d5bac87b70fdd185b8b86771d71211a02411e8351020815cfb0dcc54c667187353dbcfc377b44753a4f433d4e51f753c2b0fc0eafdcbc1cbb6ef4e715ebea9d495758b595b12cb294e70e715876fbaa3c654023c76f43cd51442775ff171e0a5f21b50c55a5b52d94df3e7977af823a1e78ee86c6497b1cf8732d52143eeffacc27449fc13ec1f0b04d23e09712df15579474e1aa0cd65f50f33a1dd766301,1"; private final EmploiDuTemps singleton = null; - private Calendar convertieFichierIcsEnCalendar(File fichierIcs){ + private Calendar convertieFichierIcsEnCalendar(File fichierIcs) { Calendar calendar = null; try (FileInputStream fileICS = new FileInputStream(fichierIcs)) { CalendarBuilder builder = new CalendarBuilder(); @@ -36,10 +36,13 @@ private Calendar convertieFichierIcsEnCalendar(File fichierIcs){ return calendar; } - private File getFichierIcsDepuisLienIcal() { - File fichierIcs = null; + private File getFichierIcsDepuisLienIcal() { + File fichierIcs = new File("fichier.ics"); + if (fichierIcs.isFile()) { + fichierIcs.delete(); + } try { - fichierIcs = File.createTempFile("temp", null); + // fichierIcs = File.createTempFile("temp", ".ics"); URL url = new URL(LIEN_ICAL); InputStream in = url.openStream(); Files.copy(in, Paths.get(fichierIcs.getName())); From 0659e1f747183c9234b20430a424d9c595787feb Mon Sep 17 00:00:00 2001 From: emerick-biron Date: Mon, 18 Jan 2021 13:58:51 +0100 Subject: [PATCH 016/111] =?UTF-8?q?=F0=9F=99=88=20maj=20gitignore?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index f836b6b..689dcab 100644 --- a/.gitignore +++ b/.gitignore @@ -119,3 +119,5 @@ local.properties nbproject/private/ build/ + +fichier.ics \ No newline at end of file From ec70c3ae1b57c0fa5d4755efc1c367b17a6772d3 Mon Sep 17 00:00:00 2001 From: emerick-biron Date: Mon, 18 Jan 2021 14:01:53 +0100 Subject: [PATCH 017/111] :hammer: ajout intitule --- src/main/java/edt/umontp/fr/Cours.java | 30 ++++++++++++++------------ 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/src/main/java/edt/umontp/fr/Cours.java b/src/main/java/edt/umontp/fr/Cours.java index 19bbd30..d2d50d9 100644 --- a/src/main/java/edt/umontp/fr/Cours.java +++ b/src/main/java/edt/umontp/fr/Cours.java @@ -4,7 +4,7 @@ import java.time.LocalTime; import java.util.Objects; -public class Cours implements Comparable{ +public class Cours implements Comparable { private final LocalDate date; private final String prof; private final LocalTime heureDebut; @@ -12,29 +12,31 @@ public class Cours implements Comparable{ private final String lieu; private final int duree; private final Groupe groupe; + private final String intitule; + + public Cours(LocalDate date, String prof, LocalTime heureDebut, LocalTime heureFin, String lieu, int duree, + Groupe groupe, String intitule) { + this.date = date; + this.prof = prof; + this.heureDebut = heureDebut; + this.heureFin = heureFin; + this.lieu = lieu; + this.duree = duree; + this.groupe = groupe; + this.intitule = intitule; + } @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; Cours cours = (Cours) o; - return duree == cours.duree && date.equals(cours.date) && prof.equals(cours.prof) && heureDebut.equals(cours.heureDebut) && heureFin.equals(cours.heureFin) && lieu.equals(cours.lieu) && groupe == cours.groupe; + return duree == cours.duree && date.equals(cours.date) && prof.equals(cours.prof) && heureDebut.equals(cours.heureDebut) && heureFin.equals(cours.heureFin) && lieu.equals(cours.lieu) && groupe == cours.groupe && intitule.equals(cours.intitule); } @Override public int hashCode() { - return Objects.hash(date, prof, heureDebut, heureFin, lieu, duree, groupe); - } - - public Cours(LocalDate date, String prof, LocalTime heureDebut, LocalTime heureFin, String lieu, int duree, - Groupe groupe) { - this.date = date; - this.prof = prof; - this.heureDebut = heureDebut; - this.heureFin = heureFin; - this.lieu = lieu; - this.duree = duree; - this.groupe = groupe; + return Objects.hash(date, prof, heureDebut, heureFin, lieu, duree, groupe, intitule); } @Override From 947baefc3036cae57f150baf517d4168a3e5d316 Mon Sep 17 00:00:00 2001 From: emerick-biron Date: Mon, 18 Jan 2021 15:15:20 +0100 Subject: [PATCH 018/111] :hammer: getInfoFromDesc --- src/main/java/edt/umontp/fr/Cours.java | 12 +++++++++++- src/main/java/edt/umontp/fr/Test.java | 3 ++- src/test/java/edt/umontp/fr/CoursTest.java | 21 +++++++++++++++++++++ 3 files changed, 34 insertions(+), 2 deletions(-) create mode 100644 src/test/java/edt/umontp/fr/CoursTest.java diff --git a/src/main/java/edt/umontp/fr/Cours.java b/src/main/java/edt/umontp/fr/Cours.java index 19bbd30..0e9032c 100644 --- a/src/main/java/edt/umontp/fr/Cours.java +++ b/src/main/java/edt/umontp/fr/Cours.java @@ -4,7 +4,7 @@ import java.time.LocalTime; import java.util.Objects; -public class Cours implements Comparable{ +public class Cours implements Comparable { private final LocalDate date; private final String prof; private final LocalTime heureDebut; @@ -13,6 +13,16 @@ public class Cours implements Comparable{ private final int duree; private final Groupe groupe; + public static Groupe getGroupeFromDesc(String desc) { + Groupe res = null; + for (Groupe g : Groupe.values()) { + if (desc.contains(g.name())) { + res = g; + } + } + return res; + } + @Override public boolean equals(Object o) { if (this == o) return true; diff --git a/src/main/java/edt/umontp/fr/Test.java b/src/main/java/edt/umontp/fr/Test.java index 385a2ef..b0f3087 100644 --- a/src/main/java/edt/umontp/fr/Test.java +++ b/src/main/java/edt/umontp/fr/Test.java @@ -2,6 +2,7 @@ public class Test { public static void main(String[] args) { - + System.out.println(Cours.getGroupeFromDesc("\n\n-Semestre-1\nGOUAICH ABDELKADER\nLAGUILLAUMIE FABIE " + + "N\nPOUPET VICTOR\nROSENFELD MATTHIEU\nA1valider\n(Exporté le:18 / 01 / 2 021 10:51)\n ")); } } diff --git a/src/test/java/edt/umontp/fr/CoursTest.java b/src/test/java/edt/umontp/fr/CoursTest.java new file mode 100644 index 0000000..ee025e7 --- /dev/null +++ b/src/test/java/edt/umontp/fr/CoursTest.java @@ -0,0 +1,21 @@ +package edt.umontp.fr; + +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.*; + +class CoursTest { + + @Test + void Test_getGroupeFromDesc_A1Seul_A1() { + String desc = "\n\nA1\nGOUAICH ABDELKADER\nLAGUILLAUMIE FABIE " + "N\nPOUPET VICTOR\nROSENFELD " + + "MATTHIEU\nA valider\n(Exporté le:18 / 01 / 2 021 10:51)\n"; + assertEquals(Groupe.A1, Cours.getGroupeFromDesc(desc)); + } + + void Test_getGroupeFromDesc_A1NonSeul_A1() { + String desc = "\n\nA1-Semestre-1\nGOUAICH ABDELKADER\nLAGUILLAUMIE FABIE N\nPOUPET " + + "VICTOR\nROSENFELD MATTHIEU\nA valider\n(Exporté le:18/01/2 021 10:51)\n"; + assertEquals(Groupe.A1, Cours.getGroupeFromDesc(desc)); + } +} \ No newline at end of file From 0c1d1a1525238f91becb6f951106830388a219d0 Mon Sep 17 00:00:00 2001 From: MathieuSoysal Date: Mon, 18 Jan 2021 15:16:56 +0100 Subject: [PATCH 019/111] =?UTF-8?q?=F0=9F=9A=A7=20Ajout=20constructeur=20C?= =?UTF-8?q?ours=20(non=20finis)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/edt/umontp/fr/Cours.java | 57 ++++++++++++++++++++------ 1 file changed, 45 insertions(+), 12 deletions(-) diff --git a/src/main/java/edt/umontp/fr/Cours.java b/src/main/java/edt/umontp/fr/Cours.java index d2d50d9..b5fba8a 100644 --- a/src/main/java/edt/umontp/fr/Cours.java +++ b/src/main/java/edt/umontp/fr/Cours.java @@ -1,21 +1,27 @@ package edt.umontp.fr; +import java.text.ParseException; import java.time.LocalDate; import java.time.LocalTime; import java.util.Objects; +import net.fortuna.ical4j.data.ParserException; +import net.fortuna.ical4j.model.Component; +import net.fortuna.ical4j.model.DateTime; +import net.fortuna.ical4j.model.Property; + public class Cours implements Comparable { - private final LocalDate date; - private final String prof; - private final LocalTime heureDebut; - private final LocalTime heureFin; - private final String lieu; - private final int duree; - private final Groupe groupe; - private final String intitule; + private LocalDate date; + private String prof; + private LocalTime heureDebut; + private LocalTime heureFin; + private String lieu; + private int duree; + private Groupe groupe; + private String intitule; public Cours(LocalDate date, String prof, LocalTime heureDebut, LocalTime heureFin, String lieu, int duree, - Groupe groupe, String intitule) { + Groupe groupe, String intitule) { this.date = date; this.prof = prof; this.heureDebut = heureDebut; @@ -26,12 +32,39 @@ public Cours(LocalDate date, String prof, LocalTime heureDebut, LocalTime heureF this.intitule = intitule; } + public Cours(Component vEvent) { + Property summary = vEvent.getProperty(Property.SUMMARY); + Property description = vEvent.getProperty(Property.DESCRIPTION); + Property dtStart = vEvent.getProperty(Property.DTSTART); + Property dtEnd = vEvent.getProperty(Property.DTEND); + Property location = vEvent.getProperty(Property.LOCATION); + + DateTime dateDebut = null; + DateTime dateFin = null; + try { + dateDebut = new DateTime(dtStart.getValue()); + dateFin = new DateTime(dtEnd.getValue()); + } catch (ParseException e) { + e.printStackTrace(); + } + date = LocalDate.ofInstant(dateDebut.toInstant(), dateDebut.getTimeZone().toZoneId()); + heureDebut = LocalTime.ofInstant(dateDebut.toInstant(), dateDebut.getTimeZone().toZoneId()); + heureFin = LocalTime.ofInstant(dateFin.toInstant(), dateFin.getTimeZone().toZoneId()); + lieu = location.getValue(); + intitule = summary.getValue(); + // TODO spliter la description pour initialiser les autres attributs + } + @Override public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; Cours cours = (Cours) o; - return duree == cours.duree && date.equals(cours.date) && prof.equals(cours.prof) && heureDebut.equals(cours.heureDebut) && heureFin.equals(cours.heureFin) && lieu.equals(cours.lieu) && groupe == cours.groupe && intitule.equals(cours.intitule); + return duree == cours.duree && date.equals(cours.date) && prof.equals(cours.prof) + && heureDebut.equals(cours.heureDebut) && heureFin.equals(cours.heureFin) && lieu.equals(cours.lieu) + && groupe == cours.groupe && intitule.equals(cours.intitule); } @Override From a10ba9efe3a1e83f68a262917f04110724b0ca98 Mon Sep 17 00:00:00 2001 From: MathieuSoysal Date: Mon, 18 Jan 2021 15:20:46 +0100 Subject: [PATCH 020/111] =?UTF-8?q?=F0=9F=9A=A7=20Premi=C3=A8re=20version?= =?UTF-8?q?=20actualiser?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/edt/umontp/fr/EmploiDuTemps.java | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/main/java/edt/umontp/fr/EmploiDuTemps.java b/src/main/java/edt/umontp/fr/EmploiDuTemps.java index ec81cf2..0d33388 100644 --- a/src/main/java/edt/umontp/fr/EmploiDuTemps.java +++ b/src/main/java/edt/umontp/fr/EmploiDuTemps.java @@ -12,14 +12,22 @@ import java.net.URLConnection; import java.nio.file.Files; import java.nio.file.Paths; +import java.text.ParseException; +import java.time.LocalDate; +import java.time.LocalTime; +import java.util.ArrayList; import net.fortuna.ical4j.data.CalendarBuilder; import net.fortuna.ical4j.data.ParserException; import net.fortuna.ical4j.model.Calendar; +import net.fortuna.ical4j.model.Component; +import net.fortuna.ical4j.model.DateTime; +import net.fortuna.ical4j.model.Property; public class EmploiDuTemps { private final String LIEN_ICAL = "https://proseconsult.umontpellier.fr/jsp/custom/modules/plannings/direct_cal.jsp?data=58c99062bab31d256bee14356aca3f2423c0f022cb9660eba051b2653be722c431b66c493702208e664667048bc04373dc5c094f7d1a811b903031bde802c7f59b21846d3c6254443d7b6e956d3145c6e0d5bac87b70fdd185b8b86771d71211a02411e8351020815cfb0dcc54c667187353dbcfc377b44753a4f433d4e51f753c2b0fc0eafdcbc1cbb6ef4e715ebea9d495758b595b12cb294e70e715876fbaa3c654023c76f43cd51442775ff171e0a5f21b50c55a5b52d94df3e7977af823a1e78ee86c6497b1cf8732d52143eeffacc27449fc13ec1f0b04d23e09712df15579474e1aa0cd65f50f33a1dd766301,1"; private final EmploiDuTemps singleton = null; + private Planning planningEmploisDutemps; private Calendar convertieFichierIcsEnCalendar(File fichierIcs) { Calendar calendar = null; @@ -42,12 +50,10 @@ private File getFichierIcsDepuisLienIcal() { fichierIcs.delete(); } try { - // fichierIcs = File.createTempFile("temp", ".ics"); URL url = new URL(LIEN_ICAL); InputStream in = url.openStream(); Files.copy(in, Paths.get(fichierIcs.getName())); } catch (IOException e) { - // TODO Auto-generated catch block e.printStackTrace(); } return fichierIcs; @@ -56,6 +62,11 @@ private File getFichierIcsDepuisLienIcal() { public void actualiser() { File fichierIcs = getFichierIcsDepuisLienIcal(); Calendar calendar = convertieFichierIcsEnCalendar(fichierIcs); + ArrayList coursList = new ArrayList<>(); + for (Object vEvent : calendar.getComponents(Component.VEVENT)) { + coursList.add(new Cours((Component) vEvent)); + } + planningEmploisDutemps = new Planning(coursList); } } From 2aac79030fcb3b80a7be67ad397d93cda805c2c6 Mon Sep 17 00:00:00 2001 From: MathieuSoysal Date: Mon, 18 Jan 2021 15:26:43 +0100 Subject: [PATCH 021/111] =?UTF-8?q?=F0=9F=9A=A8=20Fixation=20erreur=20:=20?= =?UTF-8?q?mvn=20install?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/edt/umontp/fr/EmploiDuTemps.java | 9 +++++---- src/main/java/edt/umontp/fr/Planning.java | 3 +-- src/test/java/edt/umontp/fr/CoursTest.java | 1 + 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/main/java/edt/umontp/fr/EmploiDuTemps.java b/src/main/java/edt/umontp/fr/EmploiDuTemps.java index 0d33388..4a42cb9 100644 --- a/src/main/java/edt/umontp/fr/EmploiDuTemps.java +++ b/src/main/java/edt/umontp/fr/EmploiDuTemps.java @@ -63,10 +63,11 @@ public void actualiser() { File fichierIcs = getFichierIcsDepuisLienIcal(); Calendar calendar = convertieFichierIcsEnCalendar(fichierIcs); ArrayList coursList = new ArrayList<>(); - for (Object vEvent : calendar.getComponents(Component.VEVENT)) { - coursList.add(new Cours((Component) vEvent)); - } - planningEmploisDutemps = new Planning(coursList); + // TODO en attente de finalisation du constructeur de Cours + // for (Object vEvent : calendar.getComponents(Component.VEVENT)) { + // coursList.add(new Cours((Component) vEvent)); + // } + // planningEmploisDutemps = new Planning(coursList); } } diff --git a/src/main/java/edt/umontp/fr/Planning.java b/src/main/java/edt/umontp/fr/Planning.java index 443c483..eaaab09 100644 --- a/src/main/java/edt/umontp/fr/Planning.java +++ b/src/main/java/edt/umontp/fr/Planning.java @@ -19,10 +19,9 @@ public Iterator iterator() { return null; } - //TODO a coder @Override public void forEach(Consumer action) { - + //TODO a coder } //TODO a coder diff --git a/src/test/java/edt/umontp/fr/CoursTest.java b/src/test/java/edt/umontp/fr/CoursTest.java index ee025e7..a52659c 100644 --- a/src/test/java/edt/umontp/fr/CoursTest.java +++ b/src/test/java/edt/umontp/fr/CoursTest.java @@ -13,6 +13,7 @@ void Test_getGroupeFromDesc_A1Seul_A1() { assertEquals(Groupe.A1, Cours.getGroupeFromDesc(desc)); } + @Test void Test_getGroupeFromDesc_A1NonSeul_A1() { String desc = "\n\nA1-Semestre-1\nGOUAICH ABDELKADER\nLAGUILLAUMIE FABIE N\nPOUPET " + "VICTOR\nROSENFELD MATTHIEU\nA valider\n(Exporté le:18/01/2 021 10:51)\n"; From 23785d2603d12028017c7631a5d07996a91056a0 Mon Sep 17 00:00:00 2001 From: emerick-biron Date: Mon, 18 Jan 2021 15:31:24 +0100 Subject: [PATCH 022/111] :construction: maj first constructor --- src/main/java/edt/umontp/fr/Cours.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/edt/umontp/fr/Cours.java b/src/main/java/edt/umontp/fr/Cours.java index 13d0c1a..1c90208 100644 --- a/src/main/java/edt/umontp/fr/Cours.java +++ b/src/main/java/edt/umontp/fr/Cours.java @@ -12,7 +12,7 @@ public class Cours implements Comparable { private LocalDate date; - private String prof; + private String[] prof; private LocalTime heureDebut; private LocalTime heureFin; private String lieu; @@ -20,8 +20,8 @@ public class Cours implements Comparable { private Groupe groupe; private String intitule; - public Cours(LocalDate date, String prof, LocalTime heureDebut, LocalTime heureFin, String lieu, int duree, - Groupe groupe, String intitule) { + public Cours(LocalDate date, String[] prof, LocalTime heureDebut, LocalTime heureFin, String lieu, int duree, + Groupe groupe, String intitule) { this.date = date; this.prof = prof; this.heureDebut = heureDebut; From 45bcd8479a97450972fbdee78e889b66c11635a6 Mon Sep 17 00:00:00 2001 From: MathieuSoysal Date: Mon, 18 Jan 2021 15:33:36 +0100 Subject: [PATCH 023/111] =?UTF-8?q?=F0=9F=94=A8=20implementation=20d'Itera?= =?UTF-8?q?tor=20dans=20Planning?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/edt/umontp/fr/Planning.java | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/main/java/edt/umontp/fr/Planning.java b/src/main/java/edt/umontp/fr/Planning.java index eaaab09..769d49e 100644 --- a/src/main/java/edt/umontp/fr/Planning.java +++ b/src/main/java/edt/umontp/fr/Planning.java @@ -2,32 +2,35 @@ import java.time.LocalDate; import java.util.ArrayList; +import java.util.Collection; import java.util.Iterator; +import java.util.LinkedList; +import java.util.Queue; import java.util.Spliterator; import java.util.function.Consumer; public class Planning implements Iterable, Planifiable { - private ArrayList cours; + private Queue cours; - public Planning(ArrayList cours) { - this.cours = cours; + public Planning(Collection cours) { + this.cours = new LinkedList<>(cours); } //TODO a coder @Override public Iterator iterator() { - return null; + return cours.iterator(); } @Override public void forEach(Consumer action) { - //TODO a coder + cours.forEach(action); } //TODO a coder @Override public Spliterator spliterator() { - return null; + return cours.spliterator(); } //TODO a coder From afa3ebd429fc99b32faf4cbd49c1ddae9bd4a12a Mon Sep 17 00:00:00 2001 From: MathieuSoysal Date: Mon, 18 Jan 2021 15:36:43 +0100 Subject: [PATCH 024/111] =?UTF-8?q?=F0=9F=8E=A8=20Petite=20mise=20=C3=A0?= =?UTF-8?q?=20jour=20CoursTest?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/test/java/edt/umontp/fr/CoursTest.java | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/test/java/edt/umontp/fr/CoursTest.java b/src/test/java/edt/umontp/fr/CoursTest.java index a52659c..f3ca816 100644 --- a/src/test/java/edt/umontp/fr/CoursTest.java +++ b/src/test/java/edt/umontp/fr/CoursTest.java @@ -8,15 +8,13 @@ class CoursTest { @Test void Test_getGroupeFromDesc_A1Seul_A1() { - String desc = "\n\nA1\nGOUAICH ABDELKADER\nLAGUILLAUMIE FABIE " + "N\nPOUPET VICTOR\nROSENFELD " + - "MATTHIEU\nA valider\n(Exporté le:18 / 01 / 2 021 10:51)\n"; + String desc = "\n\nA1\nGOUAICH ABDELKADER\nLAGUILLAUMIE FABIEN\nPOUPET VICTOR\nROSENFELD MATTHIEU\nA valider\n(Exporté le:18 / 01 / 2 021 10:51)\n"; assertEquals(Groupe.A1, Cours.getGroupeFromDesc(desc)); } @Test void Test_getGroupeFromDesc_A1NonSeul_A1() { - String desc = "\n\nA1-Semestre-1\nGOUAICH ABDELKADER\nLAGUILLAUMIE FABIE N\nPOUPET " + - "VICTOR\nROSENFELD MATTHIEU\nA valider\n(Exporté le:18/01/2 021 10:51)\n"; + String desc = "\n\nA1-Semestre-1\nGOUAICH ABDELKADER\nLAGUILLAUMIE FABIEN\nPOUPET VICTOR\nROSENFELD MATTHIEU\nA valider\n(Exporté le:18/01/2 021 10:51)\n"; assertEquals(Groupe.A1, Cours.getGroupeFromDesc(desc)); } } \ No newline at end of file From 0bc9967df468d3918e96edd29fd28c3f372e3cb8 Mon Sep 17 00:00:00 2001 From: emerick-biron Date: Mon, 18 Jan 2021 15:40:46 +0100 Subject: [PATCH 025/111] :construction: maj Cours --- src/main/java/edt/umontp/fr/Cours.java | 10 ++++++++++ src/test/java/edt/umontp/fr/CoursTest.java | 5 +++++ 2 files changed, 15 insertions(+) diff --git a/src/main/java/edt/umontp/fr/Cours.java b/src/main/java/edt/umontp/fr/Cours.java index 1c90208..57404aa 100644 --- a/src/main/java/edt/umontp/fr/Cours.java +++ b/src/main/java/edt/umontp/fr/Cours.java @@ -4,6 +4,7 @@ import java.time.LocalDate; import java.time.LocalTime; import java.util.Objects; +import java.util.Scanner; import net.fortuna.ical4j.data.ParserException; import net.fortuna.ical4j.model.Component; @@ -65,6 +66,15 @@ public static Groupe getGroupeFromDesc(String desc) { return res; } + public static String[] getProfFromDdesc(String desc){ + Scanner scanner = new Scanner(desc); + while (scanner.hasNextLine()) { + String line = scanner.nextLine(); + + } + scanner.close(); + } + @Override public boolean equals(Object o) { if (this == o) diff --git a/src/test/java/edt/umontp/fr/CoursTest.java b/src/test/java/edt/umontp/fr/CoursTest.java index a52659c..ac8ef8e 100644 --- a/src/test/java/edt/umontp/fr/CoursTest.java +++ b/src/test/java/edt/umontp/fr/CoursTest.java @@ -19,4 +19,9 @@ void Test_getGroupeFromDesc_A1NonSeul_A1() { "VICTOR\nROSENFELD MATTHIEU\nA valider\n(Exporté le:18/01/2 021 10:51)\n"; assertEquals(Groupe.A1, Cours.getGroupeFromDesc(desc)); } + + @Test + void Test_getProfFromDdesc_Desc_NomsDesProfs() { + assertTrue(true); + } } \ No newline at end of file From 61a28502c44053c4f12d553fb9cee096d684c9e8 Mon Sep 17 00:00:00 2001 From: emerick-biron Date: Mon, 18 Jan 2021 15:41:25 +0100 Subject: [PATCH 026/111] :construction: maj Cours --- src/test/java/edt/umontp/fr/CoursTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/java/edt/umontp/fr/CoursTest.java b/src/test/java/edt/umontp/fr/CoursTest.java index 17b1426..2131559 100644 --- a/src/test/java/edt/umontp/fr/CoursTest.java +++ b/src/test/java/edt/umontp/fr/CoursTest.java @@ -21,5 +21,5 @@ void Test_getGroupeFromDesc_A1NonSeul_A1() { @Test void Test_getProfFromDdesc_Desc_NomsDesProfs() { assertTrue(true); - } + }a } \ No newline at end of file From 5af91e94956cb3c98e6b51c740268a999be55d06 Mon Sep 17 00:00:00 2001 From: emerick-biron Date: Mon, 18 Jan 2021 15:42:12 +0100 Subject: [PATCH 027/111] :construction: maj Cours --- src/test/java/edt/umontp/fr/CoursTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/java/edt/umontp/fr/CoursTest.java b/src/test/java/edt/umontp/fr/CoursTest.java index 2131559..17b1426 100644 --- a/src/test/java/edt/umontp/fr/CoursTest.java +++ b/src/test/java/edt/umontp/fr/CoursTest.java @@ -21,5 +21,5 @@ void Test_getGroupeFromDesc_A1NonSeul_A1() { @Test void Test_getProfFromDdesc_Desc_NomsDesProfs() { assertTrue(true); - }a + } } \ No newline at end of file From dbc924c2f6d3c508eb4671c5f14d38caa2d9f4e1 Mon Sep 17 00:00:00 2001 From: emerick-biron Date: Mon, 18 Jan 2021 15:59:48 +0100 Subject: [PATCH 028/111] :construction: getProfFromDesc --- src/main/java/edt/umontp/fr/Cours.java | 21 ++++++++++----------- src/main/java/edt/umontp/fr/Test.java | 5 +++-- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/main/java/edt/umontp/fr/Cours.java b/src/main/java/edt/umontp/fr/Cours.java index 57404aa..842a17e 100644 --- a/src/main/java/edt/umontp/fr/Cours.java +++ b/src/main/java/edt/umontp/fr/Cours.java @@ -3,8 +3,7 @@ import java.text.ParseException; import java.time.LocalDate; import java.time.LocalTime; -import java.util.Objects; -import java.util.Scanner; +import java.util.*; import net.fortuna.ical4j.data.ParserException; import net.fortuna.ical4j.model.Component; @@ -66,25 +65,25 @@ public static Groupe getGroupeFromDesc(String desc) { return res; } - public static String[] getProfFromDdesc(String desc){ + public static String[] getProfFromDesc(String desc) { + ArrayList res = new ArrayList(); Scanner scanner = new Scanner(desc); while (scanner.hasNextLine()) { String line = scanner.nextLine(); - + if (line.equals(line.toUpperCase(Locale.ROOT)) && line.contains(" ")) { + res.add(line); + } } scanner.close(); + return res.toArray(new String[0]); } @Override public boolean equals(Object o) { - if (this == o) - return true; - if (o == null || getClass() != o.getClass()) - return false; + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; Cours cours = (Cours) o; - return duree == cours.duree && date.equals(cours.date) && prof.equals(cours.prof) - && heureDebut.equals(cours.heureDebut) && heureFin.equals(cours.heureFin) && lieu.equals(cours.lieu) - && groupe == cours.groupe && intitule.equals(cours.intitule); + return duree == cours.duree && date.equals(cours.date) && prof.equals(cours.prof) && heureDebut.equals(cours.heureDebut) && heureFin.equals(cours.heureFin) && lieu.equals(cours.lieu) && groupe == cours.groupe && intitule.equals(cours.intitule); } @Override diff --git a/src/main/java/edt/umontp/fr/Test.java b/src/main/java/edt/umontp/fr/Test.java index b0f3087..c599ca9 100644 --- a/src/main/java/edt/umontp/fr/Test.java +++ b/src/main/java/edt/umontp/fr/Test.java @@ -1,8 +1,9 @@ package edt.umontp.fr; +import java.util.Arrays; + public class Test { public static void main(String[] args) { - System.out.println(Cours.getGroupeFromDesc("\n\n-Semestre-1\nGOUAICH ABDELKADER\nLAGUILLAUMIE FABIE " + - "N\nPOUPET VICTOR\nROSENFELD MATTHIEU\nA1valider\n(Exporté le:18 / 01 / 2 021 10:51)\n ")); + System.out.println(Arrays.toString(Cours.getProfFromDesc("\n\nA1-Semestre-1\nGOU A_ICH ABDELKADER\nLAGUILLAUMIE FABIEN\nPOUPET VICTOR\nROSENFELD MATTHIEU\nA valider\n(Exporté le:18/01/2 021 10:51)\n"))); } } From 36920b5d2cae3bc8758dcd414943ae4fc1b14a24 Mon Sep 17 00:00:00 2001 From: MathieuSoysal Date: Mon, 18 Jan 2021 16:13:54 +0100 Subject: [PATCH 029/111] =?UTF-8?q?=F0=9F=9A=A7=20Premi=C3=A8re=20version?= =?UTF-8?q?=20getProfFromDesc?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/edt/umontp/fr/Cours.java | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/main/java/edt/umontp/fr/Cours.java b/src/main/java/edt/umontp/fr/Cours.java index 842a17e..adc8ed9 100644 --- a/src/main/java/edt/umontp/fr/Cours.java +++ b/src/main/java/edt/umontp/fr/Cours.java @@ -4,6 +4,8 @@ import java.time.LocalDate; import java.time.LocalTime; import java.util.*; +import java.util.regex.Matcher; +import java.util.regex.Pattern; import net.fortuna.ical4j.data.ParserException; import net.fortuna.ical4j.model.Component; @@ -67,17 +69,18 @@ public static Groupe getGroupeFromDesc(String desc) { public static String[] getProfFromDesc(String desc) { ArrayList res = new ArrayList(); - Scanner scanner = new Scanner(desc); - while (scanner.hasNextLine()) { - String line = scanner.nextLine(); - if (line.equals(line.toUpperCase(Locale.ROOT)) && line.contains(" ")) { - res.add(line); - } + String regex = "(?<=\n)[- A-Z]* [- A-Z]*(?=\n)"; + Matcher m = Pattern.compile(regex).matcher(desc); + final List matches = new ArrayList<>(); + while (m.find()) { + matches.add(m.group(0)); } - scanner.close(); + + return res.toArray(new String[0]); } + @Override public boolean equals(Object o) { if (this == o) return true; From 473951b7720823f7e29c9aa0abcd9e4913b5c03b Mon Sep 17 00:00:00 2001 From: MathieuSoysal Date: Mon, 18 Jan 2021 16:17:35 +0100 Subject: [PATCH 030/111] =?UTF-8?q?=F0=9F=94=A8=20Mise=20=C3=A0=20jour=20g?= =?UTF-8?q?etProfFromDesc?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/edt/umontp/fr/Cours.java | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/main/java/edt/umontp/fr/Cours.java b/src/main/java/edt/umontp/fr/Cours.java index adc8ed9..7dfbd0e 100644 --- a/src/main/java/edt/umontp/fr/Cours.java +++ b/src/main/java/edt/umontp/fr/Cours.java @@ -75,9 +75,7 @@ public static String[] getProfFromDesc(String desc) { while (m.find()) { matches.add(m.group(0)); } - - - return res.toArray(new String[0]); + return matches.toArray(new String[matches.size()]); } From 04d8a6b4f0fe523c258a1b01084fc7df57e79907 Mon Sep 17 00:00:00 2001 From: MathieuSoysal Date: Mon, 18 Jan 2021 16:18:06 +0100 Subject: [PATCH 031/111] =?UTF-8?q?=F0=9F=94=A8=20Correction=20regex?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/edt/umontp/fr/Cours.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/edt/umontp/fr/Cours.java b/src/main/java/edt/umontp/fr/Cours.java index 7dfbd0e..e2b9755 100644 --- a/src/main/java/edt/umontp/fr/Cours.java +++ b/src/main/java/edt/umontp/fr/Cours.java @@ -69,7 +69,7 @@ public static Groupe getGroupeFromDesc(String desc) { public static String[] getProfFromDesc(String desc) { ArrayList res = new ArrayList(); - String regex = "(?<=\n)[- A-Z]* [- A-Z]*(?=\n)"; + String regex = "(?<=\\n)[- A-Z]* [- A-Z]*(?=\\n)"; Matcher m = Pattern.compile(regex).matcher(desc); final List matches = new ArrayList<>(); while (m.find()) { From b6fe1ac1da604bdb57f88e9ed5acd6a105f7e121 Mon Sep 17 00:00:00 2001 From: emerick-biron Date: Mon, 18 Jan 2021 16:26:46 +0100 Subject: [PATCH 032/111] :hammer: maj getProfFromDesc --- src/main/java/edt/umontp/fr/Test.java | 4 +++- src/test/java/edt/umontp/fr/CoursTest.java | 13 ++++++++++--- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/src/main/java/edt/umontp/fr/Test.java b/src/main/java/edt/umontp/fr/Test.java index c599ca9..b91e753 100644 --- a/src/main/java/edt/umontp/fr/Test.java +++ b/src/main/java/edt/umontp/fr/Test.java @@ -4,6 +4,8 @@ public class Test { public static void main(String[] args) { - System.out.println(Arrays.toString(Cours.getProfFromDesc("\n\nA1-Semestre-1\nGOU A_ICH ABDELKADER\nLAGUILLAUMIE FABIEN\nPOUPET VICTOR\nROSENFELD MATTHIEU\nA valider\n(Exporté le:18/01/2 021 10:51)\n"))); + System.out.println(Arrays.toString(Cours.getProfFromDesc("\n\nA1-Semestre-1\nGOU A_ICH " + + "ABDELKADER\nLAGUILLAUMIE FABIEN\nPOUPET VICTOR\nROSENFELD MATTHIEU\nA valider\n(Exporté " + + "le:18/01/2 021 10:51)\n"))); } } diff --git a/src/test/java/edt/umontp/fr/CoursTest.java b/src/test/java/edt/umontp/fr/CoursTest.java index 17b1426..ff74751 100644 --- a/src/test/java/edt/umontp/fr/CoursTest.java +++ b/src/test/java/edt/umontp/fr/CoursTest.java @@ -2,24 +2,31 @@ import org.junit.jupiter.api.Test; +import java.util.Arrays; + import static org.junit.jupiter.api.Assertions.*; class CoursTest { @Test void Test_getGroupeFromDesc_A1Seul_A1() { - String desc = "\n\nA1\nGOUAICH ABDELKADER\nLAGUILLAUMIE FABIEN\nPOUPET VICTOR\nROSENFELD MATTHIEU\nA valider\n(Exporté le:18 / 01 / 2 021 10:51)\n"; + String desc = "\n\nA1\nGOUAICH ABDELKADER\nLAGUILLAUMIE FABIEN\nPOUPET VICTOR\nROSENFELD MATTHIEU\nA " + + "valider\n(Exporté le:18 / 01 / 2 021 10:51)\n"; assertEquals(Groupe.A1, Cours.getGroupeFromDesc(desc)); } @Test void Test_getGroupeFromDesc_A1NonSeul_A1() { - String desc = "\n\nA1-Semestre-1\nGOUAICH ABDELKADER\nLAGUILLAUMIE FABIEN\nPOUPET VICTOR\nROSENFELD MATTHIEU\nA valider\n(Exporté le:18/01/2 021 10:51)\n"; + String desc = "\n\nA1-Semestre-1\nGOUAICH ABDELKADER\nLAGUILLAUMIE FABIEN\nPOUPET VICTOR\nROSENFELD " + + "MATTHIEU\nA valider\n(Exporté le:18/01/2 021 10:51)\n"; assertEquals(Groupe.A1, Cours.getGroupeFromDesc(desc)); } @Test void Test_getProfFromDdesc_Desc_NomsDesProfs() { - assertTrue(true); + String desc = "\n\nA2-Semestre-3\nBELMECHERI NASSIM\nHAETTEL THOMAS\nLA XUAN HOANG\nCHIROUZE ANNE\nA " + + "valider\n(Exporté le:18/01/2021 10:51)\n"; + String[] expected = {"BELMECHERI NASSIM", "HAETTEL THOMAS", "LA XUAN HOANG", "CHIROUZE ANNE"}; + assertEquals(Arrays.toString(expected), Arrays.toString(Cours.getProfFromDesc(desc))); } } \ No newline at end of file From fe65c1b5dc26b766931cae1ec9030272c224628b Mon Sep 17 00:00:00 2001 From: MathieuSoysal Date: Mon, 18 Jan 2021 16:51:08 +0100 Subject: [PATCH 033/111] =?UTF-8?q?=F0=9F=8E=A8=20Mise=20en=20forme=20des?= =?UTF-8?q?=20tests?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 2 ++ src/main/java/edt/umontp/fr/Test.java | 11 ----------- src/test/java/edt/umontp/fr/AppTest.java | 8 +++----- src/test/java/edt/umontp/fr/CoursTest.java | 13 ++++++------- src/test/java/edt/umontp/fr/EmploiDuTempsTest.java | 5 ++--- 5 files changed, 13 insertions(+), 26 deletions(-) delete mode 100644 src/main/java/edt/umontp/fr/Test.java diff --git a/.gitignore b/.gitignore index 689dcab..38e9997 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,8 @@ # Compiled class file *.class +Test.java + #VSCode .project .classpath diff --git a/src/main/java/edt/umontp/fr/Test.java b/src/main/java/edt/umontp/fr/Test.java deleted file mode 100644 index b91e753..0000000 --- a/src/main/java/edt/umontp/fr/Test.java +++ /dev/null @@ -1,11 +0,0 @@ -package edt.umontp.fr; - -import java.util.Arrays; - -public class Test { - public static void main(String[] args) { - System.out.println(Arrays.toString(Cours.getProfFromDesc("\n\nA1-Semestre-1\nGOU A_ICH " + - "ABDELKADER\nLAGUILLAUMIE FABIEN\nPOUPET VICTOR\nROSENFELD MATTHIEU\nA valider\n(Exporté " + - "le:18/01/2 021 10:51)\n"))); - } -} diff --git a/src/test/java/edt/umontp/fr/AppTest.java b/src/test/java/edt/umontp/fr/AppTest.java index 497a762..2f26bee 100644 --- a/src/test/java/edt/umontp/fr/AppTest.java +++ b/src/test/java/edt/umontp/fr/AppTest.java @@ -7,14 +7,12 @@ /** * Unit test for simple App. */ -public class AppTest -{ +class AppTest { /** * Rigorous Test :-) */ @Test - public void shouldAnswerWithTrue() - { - assertTrue( true ); + void shouldAnswerWithTrue() { + assertTrue(true); } } diff --git a/src/test/java/edt/umontp/fr/CoursTest.java b/src/test/java/edt/umontp/fr/CoursTest.java index ff74751..95b788e 100644 --- a/src/test/java/edt/umontp/fr/CoursTest.java +++ b/src/test/java/edt/umontp/fr/CoursTest.java @@ -10,23 +10,22 @@ class CoursTest { @Test void Test_getGroupeFromDesc_A1Seul_A1() { - String desc = "\n\nA1\nGOUAICH ABDELKADER\nLAGUILLAUMIE FABIEN\nPOUPET VICTOR\nROSENFELD MATTHIEU\nA " + - "valider\n(Exporté le:18 / 01 / 2 021 10:51)\n"; + String desc = "\n\nA1\nGOUAICH ABDELKADER\nLAGUILLAUMIE FABIEN\nPOUPET VICTOR\nROSENFELD MATTHIEU\nA " + + "valider\n(Exporté le:18 / 01 / 2 021 10:51)\n"; assertEquals(Groupe.A1, Cours.getGroupeFromDesc(desc)); } @Test void Test_getGroupeFromDesc_A1NonSeul_A1() { - String desc = "\n\nA1-Semestre-1\nGOUAICH ABDELKADER\nLAGUILLAUMIE FABIEN\nPOUPET VICTOR\nROSENFELD " + - "MATTHIEU\nA valider\n(Exporté le:18/01/2 021 10:51)\n"; + String desc = "\n\nA1-Semestre-1\nGOUAICH ABDELKADER\nLAGUILLAUMIE FABIEN\nPOUPET VICTOR\nROSENFELD " + + "MATTHIEU\nA valider\n(Exporté le:18/01/2 021 10:51)\n"; assertEquals(Groupe.A1, Cours.getGroupeFromDesc(desc)); } @Test void Test_getProfFromDdesc_Desc_NomsDesProfs() { - String desc = "\n\nA2-Semestre-3\nBELMECHERI NASSIM\nHAETTEL THOMAS\nLA XUAN HOANG\nCHIROUZE ANNE\nA " - + "valider\n(Exporté le:18/01/2021 10:51)\n"; - String[] expected = {"BELMECHERI NASSIM", "HAETTEL THOMAS", "LA XUAN HOANG", "CHIROUZE ANNE"}; + String desc = "\n\nA2-Semestre-3\nBELMECHERI NASSIM\nHAETTEL THOMAS\nLA XUAN HOANG\nCHIROUZE ANNE\nA valider\n(Exporté le:18/01/2021 10:51)\n"; + String[] expected = { "BELMECHERI NASSIM", "HAETTEL THOMAS", "LA XUAN HOANG", "CHIROUZE ANNE" }; assertEquals(Arrays.toString(expected), Arrays.toString(Cours.getProfFromDesc(desc))); } } \ No newline at end of file diff --git a/src/test/java/edt/umontp/fr/EmploiDuTempsTest.java b/src/test/java/edt/umontp/fr/EmploiDuTempsTest.java index e0cc095..48266c7 100644 --- a/src/test/java/edt/umontp/fr/EmploiDuTempsTest.java +++ b/src/test/java/edt/umontp/fr/EmploiDuTempsTest.java @@ -4,11 +4,10 @@ import org.junit.jupiter.api.Test; -public class EmploiDuTempsTest { - +class EmploiDuTempsTest { @Test - void test_actualiser_verifierRetourneAucuneErreur(){ + void test_actualiser_verifierRetourneAucuneErreur() { EmploiDuTemps emploiDuTemps = new EmploiDuTemps(); assertAll(() -> emploiDuTemps.actualiser()); } From 584ebbd44daab6468cc730b9f1f708edf324d399 Mon Sep 17 00:00:00 2001 From: emerick-biron Date: Mon, 18 Jan 2021 17:02:40 +0100 Subject: [PATCH 034/111] :hammer: constructeur Cours --- src/main/java/edt/umontp/fr/Cours.java | 7 ++++++- src/main/java/edt/umontp/fr/Test.java | 14 ++++++++++---- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/src/main/java/edt/umontp/fr/Cours.java b/src/main/java/edt/umontp/fr/Cours.java index e2b9755..6662da8 100644 --- a/src/main/java/edt/umontp/fr/Cours.java +++ b/src/main/java/edt/umontp/fr/Cours.java @@ -1,8 +1,10 @@ package edt.umontp.fr; import java.text.ParseException; +import java.time.Duration; import java.time.LocalDate; import java.time.LocalTime; +import java.time.Period; import java.util.*; import java.util.regex.Matcher; import java.util.regex.Pattern; @@ -54,7 +56,10 @@ public Cours(Component vEvent) { heureFin = LocalTime.ofInstant(dateFin.toInstant(), dateFin.getTimeZone().toZoneId()); lieu = location.getValue(); intitule = summary.getValue(); - // TODO spliter la description pour initialiser les autres attributs + prof = getProfFromDesc(description.getValue()); + groupe = getGroupeFromDesc(description.getValue()); + Duration duration = Duration.between(heureDebut, heureFin); + duree = (int) duration.toMinutes(); } public static Groupe getGroupeFromDesc(String desc) { diff --git a/src/main/java/edt/umontp/fr/Test.java b/src/main/java/edt/umontp/fr/Test.java index b91e753..5b64647 100644 --- a/src/main/java/edt/umontp/fr/Test.java +++ b/src/main/java/edt/umontp/fr/Test.java @@ -1,11 +1,17 @@ package edt.umontp.fr; +import net.fortuna.ical4j.model.DateTime; + +import java.text.ParseException; +import java.time.Duration; +import java.time.LocalTime; import java.util.Arrays; public class Test { - public static void main(String[] args) { - System.out.println(Arrays.toString(Cours.getProfFromDesc("\n\nA1-Semestre-1\nGOU A_ICH " + - "ABDELKADER\nLAGUILLAUMIE FABIEN\nPOUPET VICTOR\nROSENFELD MATTHIEU\nA valider\n(Exporté " + - "le:18/01/2 021 10:51)\n"))); + public static void main(String[] args) throws ParseException { + LocalTime a = LocalTime.of(10,0); + LocalTime b = LocalTime.of(12, 30); + Duration duration = Duration.between(a, b); + System.out.println((int) (duration.toMinutes())); } } From aa26fb1c25968bf6139cea29e8c1e2feef1bcb2c Mon Sep 17 00:00:00 2001 From: MathieuSoysal Date: Mon, 18 Jan 2021 17:08:26 +0100 Subject: [PATCH 035/111] =?UTF-8?q?=F0=9F=9A=A7=20Ajout=20Class=20Groupe?= =?UTF-8?q?=20sans=20Tests?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/edt/umontp/fr/Groupe.java | 53 ++++++++++++++++++++- src/test/java/edt/umontp/fr/GroupeTest.java | 5 ++ 2 files changed, 57 insertions(+), 1 deletion(-) create mode 100644 src/test/java/edt/umontp/fr/GroupeTest.java diff --git a/src/main/java/edt/umontp/fr/Groupe.java b/src/main/java/edt/umontp/fr/Groupe.java index f2b64f7..311e874 100644 --- a/src/main/java/edt/umontp/fr/Groupe.java +++ b/src/main/java/edt/umontp/fr/Groupe.java @@ -1,5 +1,56 @@ package edt.umontp.fr; public enum Groupe { - A1, S1, S2, S3, S4, S5, S6, A2, Q1, Q2, Q3, Q4, G1, G2, G3, G4 + A1("A1"), // première année dep info + S1("S1", A1), // + S2("S2", A1), // + S3("S3", A1), // + S4("S4", A1), // + S5("S5", A1), // + S6("S6", A1), // + A2("A2"), // deuxième année dep info + Q1("Q1", A2), // + Q2("Q2", A2), // + Q3("Q3", A2), // + Q4("Q4", A2), // + G1("G1", A2), // + G2("G2", A2), // + G3("G3", A2), // + G4("G4", A2); + + private String intitule; + private Groupe groupeParent; + + /** + * @param intitule + */ + private Groupe(String intitule) { + this.intitule = intitule; + groupeParent = null; + } + + /** + * @param intitule + * @param groupeParent + */ + private Groupe(String intitule, Groupe groupeParent) { + this.intitule = intitule; + this.groupeParent = groupeParent; + } + + /** + * @return the intitule + */ + public String getIntitule() { + return intitule; + } + + private boolean possedeGroupeParent() { + return groupeParent != null; + } + + public boolean contient(Groupe autreGroupe) { + return autreGroupe == this || (possedeGroupeParent() && groupeParent.contient(autreGroupe)); + } + } diff --git a/src/test/java/edt/umontp/fr/GroupeTest.java b/src/test/java/edt/umontp/fr/GroupeTest.java new file mode 100644 index 0000000..703f78c --- /dev/null +++ b/src/test/java/edt/umontp/fr/GroupeTest.java @@ -0,0 +1,5 @@ +package edt.umontp.fr; + +public class GroupeTest { + +} From f8745bf153367c8b4ffb4ddb64bbe0708e3f4809 Mon Sep 17 00:00:00 2001 From: emerick-biron Date: Mon, 18 Jan 2021 17:10:05 +0100 Subject: [PATCH 036/111] :hammer: test Groupe --- src/test/java/edt/umontp/fr/GroupeTest.java | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/src/test/java/edt/umontp/fr/GroupeTest.java b/src/test/java/edt/umontp/fr/GroupeTest.java index 703f78c..b83a0af 100644 --- a/src/test/java/edt/umontp/fr/GroupeTest.java +++ b/src/test/java/edt/umontp/fr/GroupeTest.java @@ -1,5 +1,22 @@ package edt.umontp.fr; +import org.junit.jupiter.api.Test; + public class GroupeTest { - + + @Test + void Test_getIntitule() { + } + + @Test + void contient() { + } + + @Test + void values() { + } + + @Test + void valueOf() { + } } From bbb80400242a464d7f0d1812c145582bceedb806 Mon Sep 17 00:00:00 2001 From: emerick-biron Date: Mon, 18 Jan 2021 17:11:26 +0100 Subject: [PATCH 037/111] :hammer: Test -> test --- src/test/java/edt/umontp/fr/CoursTest.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/test/java/edt/umontp/fr/CoursTest.java b/src/test/java/edt/umontp/fr/CoursTest.java index 95b788e..0dfa46d 100644 --- a/src/test/java/edt/umontp/fr/CoursTest.java +++ b/src/test/java/edt/umontp/fr/CoursTest.java @@ -9,21 +9,21 @@ class CoursTest { @Test - void Test_getGroupeFromDesc_A1Seul_A1() { + void test_getGroupeFromDesc_A1Seul_A1() { String desc = "\n\nA1\nGOUAICH ABDELKADER\nLAGUILLAUMIE FABIEN\nPOUPET VICTOR\nROSENFELD MATTHIEU\nA " + "valider\n(Exporté le:18 / 01 / 2 021 10:51)\n"; assertEquals(Groupe.A1, Cours.getGroupeFromDesc(desc)); } @Test - void Test_getGroupeFromDesc_A1NonSeul_A1() { + void test_getGroupeFromDesc_A1NonSeul_A1() { String desc = "\n\nA1-Semestre-1\nGOUAICH ABDELKADER\nLAGUILLAUMIE FABIEN\nPOUPET VICTOR\nROSENFELD " + "MATTHIEU\nA valider\n(Exporté le:18/01/2 021 10:51)\n"; assertEquals(Groupe.A1, Cours.getGroupeFromDesc(desc)); } @Test - void Test_getProfFromDdesc_Desc_NomsDesProfs() { + void test_getProfFromDdesc_Desc_NomsDesProfs() { String desc = "\n\nA2-Semestre-3\nBELMECHERI NASSIM\nHAETTEL THOMAS\nLA XUAN HOANG\nCHIROUZE ANNE\nA valider\n(Exporté le:18/01/2021 10:51)\n"; String[] expected = { "BELMECHERI NASSIM", "HAETTEL THOMAS", "LA XUAN HOANG", "CHIROUZE ANNE" }; assertEquals(Arrays.toString(expected), Arrays.toString(Cours.getProfFromDesc(desc))); From 08b6c9e69cd4ec8382cb580a80e553328a90bb9d Mon Sep 17 00:00:00 2001 From: emerick-biron Date: Mon, 18 Jan 2021 17:11:38 +0100 Subject: [PATCH 038/111] :hammer: Test -> test --- src/test/java/edt/umontp/fr/GroupeTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/java/edt/umontp/fr/GroupeTest.java b/src/test/java/edt/umontp/fr/GroupeTest.java index b83a0af..f940494 100644 --- a/src/test/java/edt/umontp/fr/GroupeTest.java +++ b/src/test/java/edt/umontp/fr/GroupeTest.java @@ -5,7 +5,7 @@ public class GroupeTest { @Test - void Test_getIntitule() { + void test_getIntitule() { } @Test From 845be6201d627a5b6c8be7805bcef9c884e9e8dd Mon Sep 17 00:00:00 2001 From: emerick-biron Date: Mon, 18 Jan 2021 17:16:31 +0100 Subject: [PATCH 039/111] :hammer: maj tests Groupe --- src/test/java/edt/umontp/fr/GroupeTest.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/test/java/edt/umontp/fr/GroupeTest.java b/src/test/java/edt/umontp/fr/GroupeTest.java index f940494..053d67a 100644 --- a/src/test/java/edt/umontp/fr/GroupeTest.java +++ b/src/test/java/edt/umontp/fr/GroupeTest.java @@ -2,10 +2,13 @@ import org.junit.jupiter.api.Test; +import static org.junit.jupiter.api.Assertions.*; + public class GroupeTest { @Test void test_getIntitule() { + assertEquals("A1",Groupe.A1.getIntitule()); } @Test From fb0c40d3800eb2e234aab797260ffacb9bd1ae22 Mon Sep 17 00:00:00 2001 From: MathieuSoysal Date: Mon, 18 Jan 2021 17:45:39 +0100 Subject: [PATCH 040/111] =?UTF-8?q?=E2=9C=94=20Ajout=20test=20estContenuDa?= =?UTF-8?q?ns?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/edt/umontp/fr/Groupe.java | 4 ++-- src/test/java/edt/umontp/fr/GroupeTest.java | 24 ++++++++++++++++++--- 2 files changed, 23 insertions(+), 5 deletions(-) diff --git a/src/main/java/edt/umontp/fr/Groupe.java b/src/main/java/edt/umontp/fr/Groupe.java index 311e874..729c50d 100644 --- a/src/main/java/edt/umontp/fr/Groupe.java +++ b/src/main/java/edt/umontp/fr/Groupe.java @@ -49,8 +49,8 @@ private boolean possedeGroupeParent() { return groupeParent != null; } - public boolean contient(Groupe autreGroupe) { - return autreGroupe == this || (possedeGroupeParent() && groupeParent.contient(autreGroupe)); + public boolean estContenuDans(Groupe autreGroupe) { + return autreGroupe == this || (possedeGroupeParent() && groupeParent.estContenuDans(autreGroupe)); } } diff --git a/src/test/java/edt/umontp/fr/GroupeTest.java b/src/test/java/edt/umontp/fr/GroupeTest.java index b83a0af..8ed7a4c 100644 --- a/src/test/java/edt/umontp/fr/GroupeTest.java +++ b/src/test/java/edt/umontp/fr/GroupeTest.java @@ -1,15 +1,33 @@ package edt.umontp.fr; +import static org.junit.jupiter.api.Assertions.assertEquals; + +import java.util.stream.Stream; + import org.junit.jupiter.api.Test; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.Arguments; +import org.junit.jupiter.params.provider.MethodSource; -public class GroupeTest { +class GroupeTest { @Test void Test_getIntitule() { } - @Test - void contient() { + @ParameterizedTest(name = "Le groupe {0} doit retourner {2} lorsqu'il verifie s'il est contenu dans {1}") + @MethodSource("genererArgumentsPourtestestContenuDans") + void test_estContenuDans(Groupe g1, Groupe g2, boolean result) { + assertEquals(result, g1.estContenuDans(g2)); + } + + private static Stream genererArgumentsPourtestestContenuDans() { + return Stream.of(// + Arguments.of(Groupe.S1, Groupe.S3, false), // + Arguments.of(Groupe.S1, Groupe.A1, true), // + Arguments.of(Groupe.S1, Groupe.S1, true), // + Arguments.of(Groupe.A2, Groupe.A1, false), // + Arguments.of(Groupe.A1, Groupe.S3, false)); } @Test From f56947e431ac82b5ef9597da146c74b4e0dc34cf Mon Sep 17 00:00:00 2001 From: MathieuSoysal Date: Mon, 18 Jan 2021 19:21:50 +0100 Subject: [PATCH 041/111] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20Refactorisation=20?= =?UTF-8?q?de=20getGroupeDepuisTexte?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/edt/umontp/fr/Cours.java | 25 ++++++++------------- src/main/java/edt/umontp/fr/Groupe.java | 21 +++++++++++++++++ src/test/java/edt/umontp/fr/CoursTest.java | 12 ---------- src/test/java/edt/umontp/fr/GroupeTest.java | 24 +++++++++++++++++--- 4 files changed, 51 insertions(+), 31 deletions(-) diff --git a/src/main/java/edt/umontp/fr/Cours.java b/src/main/java/edt/umontp/fr/Cours.java index 6662da8..e21111d 100644 --- a/src/main/java/edt/umontp/fr/Cours.java +++ b/src/main/java/edt/umontp/fr/Cours.java @@ -25,7 +25,7 @@ public class Cours implements Comparable { private String intitule; public Cours(LocalDate date, String[] prof, LocalTime heureDebut, LocalTime heureFin, String lieu, int duree, - Groupe groupe, String intitule) { + Groupe groupe, String intitule) { this.date = date; this.prof = prof; this.heureDebut = heureDebut; @@ -57,21 +57,11 @@ public Cours(Component vEvent) { lieu = location.getValue(); intitule = summary.getValue(); prof = getProfFromDesc(description.getValue()); - groupe = getGroupeFromDesc(description.getValue()); + groupe = Groupe.getGroupeDepuisTexte(description.getValue()); Duration duration = Duration.between(heureDebut, heureFin); duree = (int) duration.toMinutes(); } - public static Groupe getGroupeFromDesc(String desc) { - Groupe res = null; - for (Groupe g : Groupe.values()) { - if (desc.contains(g.name())) { - res = g; - } - } - return res; - } - public static String[] getProfFromDesc(String desc) { ArrayList res = new ArrayList(); String regex = "(?<=\\n)[- A-Z]* [- A-Z]*(?=\\n)"; @@ -83,13 +73,16 @@ public static String[] getProfFromDesc(String desc) { return matches.toArray(new String[matches.size()]); } - @Override public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; Cours cours = (Cours) o; - return duree == cours.duree && date.equals(cours.date) && prof.equals(cours.prof) && heureDebut.equals(cours.heureDebut) && heureFin.equals(cours.heureFin) && lieu.equals(cours.lieu) && groupe == cours.groupe && intitule.equals(cours.intitule); + return duree == cours.duree && date.equals(cours.date) && prof.equals(cours.prof) + && heureDebut.equals(cours.heureDebut) && heureFin.equals(cours.heureFin) && lieu.equals(cours.lieu) + && groupe == cours.groupe && intitule.equals(cours.intitule); } @Override diff --git a/src/main/java/edt/umontp/fr/Groupe.java b/src/main/java/edt/umontp/fr/Groupe.java index 729c50d..05faf36 100644 --- a/src/main/java/edt/umontp/fr/Groupe.java +++ b/src/main/java/edt/umontp/fr/Groupe.java @@ -1,6 +1,10 @@ package edt.umontp.fr; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + public enum Groupe { + NULL("sans groupe"), // Gérer les exceptions A1("A1"), // première année dep info S1("S1", A1), // S2("S2", A1), // @@ -18,6 +22,15 @@ public enum Groupe { G3("G3", A2), // G4("G4", A2); + private static final String REGEX; + static { + Groupe[] groupes = values(); + String[] strings = new String[groupes.length]; + for (int i = 0; i < strings.length; i++) + strings[i] = groupes[i].getIntitule(); + REGEX = String.format("(%s)", String.join("|", strings)); + } + private String intitule; private Groupe groupeParent; @@ -45,6 +58,14 @@ public String getIntitule() { return intitule; } + public static Groupe getGroupeDepuisTexte(String texte) { + final Matcher m = Pattern.compile(REGEX).matcher(texte); + if (m.find()) + return valueOf(m.group(0)); + else + return Groupe.NULL; + } + private boolean possedeGroupeParent() { return groupeParent != null; } diff --git a/src/test/java/edt/umontp/fr/CoursTest.java b/src/test/java/edt/umontp/fr/CoursTest.java index 0dfa46d..cbc843b 100644 --- a/src/test/java/edt/umontp/fr/CoursTest.java +++ b/src/test/java/edt/umontp/fr/CoursTest.java @@ -8,19 +8,7 @@ class CoursTest { - @Test - void test_getGroupeFromDesc_A1Seul_A1() { - String desc = "\n\nA1\nGOUAICH ABDELKADER\nLAGUILLAUMIE FABIEN\nPOUPET VICTOR\nROSENFELD MATTHIEU\nA " - + "valider\n(Exporté le:18 / 01 / 2 021 10:51)\n"; - assertEquals(Groupe.A1, Cours.getGroupeFromDesc(desc)); - } - @Test - void test_getGroupeFromDesc_A1NonSeul_A1() { - String desc = "\n\nA1-Semestre-1\nGOUAICH ABDELKADER\nLAGUILLAUMIE FABIEN\nPOUPET VICTOR\nROSENFELD " - + "MATTHIEU\nA valider\n(Exporté le:18/01/2 021 10:51)\n"; - assertEquals(Groupe.A1, Cours.getGroupeFromDesc(desc)); - } @Test void test_getProfFromDdesc_Desc_NomsDesProfs() { diff --git a/src/test/java/edt/umontp/fr/GroupeTest.java b/src/test/java/edt/umontp/fr/GroupeTest.java index af9a46d..63c8895 100644 --- a/src/test/java/edt/umontp/fr/GroupeTest.java +++ b/src/test/java/edt/umontp/fr/GroupeTest.java @@ -15,7 +15,7 @@ class GroupeTest { @Test void test_getIntitule() { - assertEquals("A1",Groupe.A1.getIntitule()); + assertEquals("A1", Groupe.A1.getIntitule()); } @ParameterizedTest(name = "Le groupe {0} doit retourner {2} lorsqu'il verifie s'il est contenu dans {1}") @@ -34,10 +34,28 @@ private static Stream genererArgumentsPourtestestContenuDans() { } @Test - void values() { + void valueOf() { + assertEquals(Groupe.A1, Groupe.valueOf("A1")); } @Test - void valueOf() { + void test_getGroupeDepuisTexte_A1Seul_A1() { + String desc = "\n\nA1\nGOUAICH ABDELKADER\nLAGUILLAUMIE FABIEN\nPOUPET VICTOR\nROSENFELD MATTHIEU\nA " + + "valider\n(Exporté le:18 / 01 / 2 021 10:51)\n"; + assertEquals(Groupe.A1, Groupe.getGroupeDepuisTexte(desc)); + } + + @Test + void test_getGroupeDepuisTexte_A1NonSeul_A1() { + String desc = "\n\nA1-Semestre-1\nGOUAICH ABDELKADER\nLAGUILLAUMIE FABIEN\nPOUPET VICTOR\nROSENFELD " + + "MATTHIEU\nA valider\n(Exporté le:18/01/2 021 10:51)\n"; + assertEquals(Groupe.A1, Groupe.getGroupeDepuisTexte(desc)); + } + + @Test + void test_getGroupeDepuisTexte_aucunGroupe_GroupeNULL() { + String desc = "\n\nSemestre-1\nGOUAICH ABDELKADER\nLAGUILLAUMIE FABIEN\nPOUPET VICTOR\nROSENFELD " + + "MATTHIEU\nA valider\n(Exporté le:18/01/2 021 10:51)\n"; + assertEquals(Groupe.NULL, Groupe.getGroupeDepuisTexte(desc)); } } From 7457a4bc556334593ed5482a47ddb3e2c2de3cbe Mon Sep 17 00:00:00 2001 From: MathieuSoysal Date: Mon, 18 Jan 2021 22:48:38 +0100 Subject: [PATCH 042/111] =?UTF-8?q?=E2=9C=94=20Ajout=20test=20getPlanningO?= =?UTF-8?q?f=20date?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/edt/umontp/fr/Cours.java | 67 +++++++++++++++++-- src/test/java/edt/umontp/fr/PlanningTest.java | 40 +++++++++++ 2 files changed, 102 insertions(+), 5 deletions(-) create mode 100644 src/test/java/edt/umontp/fr/PlanningTest.java diff --git a/src/main/java/edt/umontp/fr/Cours.java b/src/main/java/edt/umontp/fr/Cours.java index e21111d..27a9903 100644 --- a/src/main/java/edt/umontp/fr/Cours.java +++ b/src/main/java/edt/umontp/fr/Cours.java @@ -14,7 +14,7 @@ import net.fortuna.ical4j.model.DateTime; import net.fortuna.ical4j.model.Property; -public class Cours implements Comparable { +public class Cours implements Comparable { private LocalDate date; private String[] prof; private LocalTime heureDebut; @@ -24,8 +24,8 @@ public class Cours implements Comparable { private Groupe groupe; private String intitule; - public Cours(LocalDate date, String[] prof, LocalTime heureDebut, LocalTime heureFin, String lieu, int duree, - Groupe groupe, String intitule) { + public Cours(LocalDate date, String[] prof, LocalTime heureDebut, LocalTime heureFin, String lieu, Groupe groupe, + String intitule) { this.date = date; this.prof = prof; this.heureDebut = heureDebut; @@ -91,7 +91,64 @@ public int hashCode() { } @Override - public int compareTo(Integer o) { - return 0; + public int compareTo(Cours o) { + int compareDate = date.compareTo(o.date); + return compareDate != 0 ? compareDate : heureDebut.compareTo(o.heureDebut); + } + + /** + * @return the date + */ + public LocalDate getDate() { + return date; + } + + /** + * @return the prof + */ + public String[] getProf() { + return prof; + } + + /** + * @return the heureDebut + */ + public LocalTime getHeureDebut() { + return heureDebut; + } + + /** + * @return the heureFin + */ + public LocalTime getHeureFin() { + return heureFin; + } + + /** + * @return the lieu + */ + public String getLieu() { + return lieu; + } + + /** + * @return the duree + */ + public int getDuree() { + return duree; + } + + /** + * @return the groupe + */ + public Groupe getGroupe() { + return groupe; + } + + /** + * @return the intitule + */ + public String getIntitule() { + return intitule; } } diff --git a/src/test/java/edt/umontp/fr/PlanningTest.java b/src/test/java/edt/umontp/fr/PlanningTest.java new file mode 100644 index 0000000..d5df24e --- /dev/null +++ b/src/test/java/edt/umontp/fr/PlanningTest.java @@ -0,0 +1,40 @@ +package edt.umontp.fr; + +import static org.junit.jupiter.api.Assertions.assertTrue; + +import java.time.LocalDate; +import java.time.LocalTime; +import java.util.ArrayList; + +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + +public class PlanningTest { + + private Planning planning; + + private Cours cours1 = new Cours(LocalDate.of(2021, 1, 20), new String[] { "prof" }, LocalTime.of(13, 30), + LocalTime.of(14, 30), "K133", Groupe.S1, "Compta1"); + private Cours cours2 = new Cours(LocalDate.of(2021, 1, 21), new String[] { "prof" }, LocalTime.of(14, 30), + LocalTime.of(15, 30), "K133", Groupe.S3, "Compta2"); + private Cours cours3 = new Cours(LocalDate.of(2021, 1, 21), new String[] { "prof" }, LocalTime.of(14, 30), + LocalTime.of(14, 30), "K133", Groupe.S2, "Compta3"); + private Cours cours4 = new Cours(LocalDate.of(2021, 1, 22), new String[] { "prof" }, LocalTime.of(11, 30), + LocalTime.of(12, 30), "K133", Groupe.S1, "Compta4"); + + @BeforeEach + void initPlanning() { + ArrayList cours = new ArrayList<>(); + cours.add(cours1); + cours.add(cours2); + cours.add(cours3); + cours.add(cours4); + planning = new Planning(cours); + } + + @Test + void test_getPlanningOf_date() { + assertTrue(cours4.compareTo(planning.getPlanningOf(cours4.getDate()).iterator().next()) == 0); + } + +} From 173a8804fdf5cd69570e0f2a3119fdc3fcc5a90e Mon Sep 17 00:00:00 2001 From: MathieuSoysal Date: Mon, 18 Jan 2021 22:50:11 +0100 Subject: [PATCH 043/111] =?UTF-8?q?=E2=9C=94=20Validation=20test=20getPlan?= =?UTF-8?q?ningOfDate?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/edt/umontp/fr/Planning.java | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/src/main/java/edt/umontp/fr/Planning.java b/src/main/java/edt/umontp/fr/Planning.java index 769d49e..ff84cd9 100644 --- a/src/main/java/edt/umontp/fr/Planning.java +++ b/src/main/java/edt/umontp/fr/Planning.java @@ -6,14 +6,19 @@ import java.util.Iterator; import java.util.LinkedList; import java.util.Queue; +import java.util.SortedSet; import java.util.Spliterator; import java.util.function.Consumer; +import java.util.stream.Collectors; + +import edu.emory.mathcs.backport.java.util.Collections; +import edu.emory.mathcs.backport.java.util.TreeSet; public class Planning implements Iterable, Planifiable { - private Queue cours; + private SortedSet cours; public Planning(Collection cours) { - this.cours = new LinkedList<>(cours); + this.cours = new TreeSet(cours); } //TODO a coder @@ -36,10 +41,18 @@ public Spliterator spliterator() { //TODO a coder @Override public Planning getPlanningOf(LocalDate date) { - return null; + ArrayList result = new ArrayList<>(); + LocalDate lastDate = ((Cours) Collections.max(cours)).getDate(); + if (!lastDate.isBefore(date)) { + Queue coursTrie = new LinkedList<>(cours); + while (coursTrie.peek().getDate().isBefore(date)) + coursTrie.poll(); + while (!coursTrie.isEmpty() && coursTrie.peek().getDate().isEqual(date)) + result.add(coursTrie.poll()); + } + return new Planning(result); } - //TODO a coder @Override public Planning getPlanningOf(LocalDate date, Groupe groupe) { return null; From 9ce63ff9c05a8027cbc70d57ddddb8fb8ea1c2af Mon Sep 17 00:00:00 2001 From: MathieuSoysal Date: Mon, 18 Jan 2021 22:57:39 +0100 Subject: [PATCH 044/111] =?UTF-8?q?=E2=9C=94=20ajout=20test=20getPlanningO?= =?UTF-8?q?f=20groupe?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/test/java/edt/umontp/fr/PlanningTest.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/test/java/edt/umontp/fr/PlanningTest.java b/src/test/java/edt/umontp/fr/PlanningTest.java index d5df24e..f96440a 100644 --- a/src/test/java/edt/umontp/fr/PlanningTest.java +++ b/src/test/java/edt/umontp/fr/PlanningTest.java @@ -34,7 +34,12 @@ void initPlanning() { @Test void test_getPlanningOf_date() { - assertTrue(cours4.compareTo(planning.getPlanningOf(cours4.getDate()).iterator().next()) == 0); + assertEquals(cours4, planning.getPlanningOf(cours4.getDate()).iterator().next()); + } + + @Test + void test_getPlanningOf_groupe(){ + assertEquals(cours2, planning.getPlanningOf(Groupe.S3).iterator().next()); } } From bb39ce8d065f9e2bd8e97004d2722886abfa0660 Mon Sep 17 00:00:00 2001 From: MathieuSoysal Date: Mon, 18 Jan 2021 22:58:44 +0100 Subject: [PATCH 045/111] =?UTF-8?q?=F0=9F=94=A8=20Validation=20test=20getP?= =?UTF-8?q?lanningOf=20groupe?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/edt/umontp/fr/Planning.java | 23 +------------------ src/test/java/edt/umontp/fr/PlanningTest.java | 4 ++-- 2 files changed, 3 insertions(+), 24 deletions(-) diff --git a/src/main/java/edt/umontp/fr/Planning.java b/src/main/java/edt/umontp/fr/Planning.java index ff84cd9..c1f94a9 100644 --- a/src/main/java/edt/umontp/fr/Planning.java +++ b/src/main/java/edt/umontp/fr/Planning.java @@ -21,7 +21,6 @@ public Planning(Collection cours) { this.cours = new TreeSet(cours); } - //TODO a coder @Override public Iterator iterator() { return cours.iterator(); @@ -32,13 +31,11 @@ public void forEach(Consumer action) { cours.forEach(action); } - //TODO a coder @Override public Spliterator spliterator() { return cours.spliterator(); } - //TODO a coder @Override public Planning getPlanningOf(LocalDate date) { ArrayList result = new ArrayList<>(); @@ -58,26 +55,8 @@ public Planning getPlanningOf(LocalDate date, Groupe groupe) { return null; } - //TODO a coder @Override public Planning getPlanningOf(Groupe groupe) { - return null; + return new Planning(cours.stream().filter(x -> x.getGroupe() == groupe).collect(Collectors.toList())); } } - - - - - - - - - - - - - - - - - diff --git a/src/test/java/edt/umontp/fr/PlanningTest.java b/src/test/java/edt/umontp/fr/PlanningTest.java index f96440a..945d32a 100644 --- a/src/test/java/edt/umontp/fr/PlanningTest.java +++ b/src/test/java/edt/umontp/fr/PlanningTest.java @@ -1,6 +1,6 @@ package edt.umontp.fr; -import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; import java.time.LocalDate; import java.time.LocalTime; @@ -9,7 +9,7 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -public class PlanningTest { +class PlanningTest { private Planning planning; From 9c1af8111a4bf773548915848c2e282b338fef9b Mon Sep 17 00:00:00 2001 From: MathieuSoysal Date: Mon, 18 Jan 2021 22:59:13 +0100 Subject: [PATCH 046/111] =?UTF-8?q?=E2=99=BB=20principe=20YAGNI=20interfac?= =?UTF-8?q?e?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/edt/umontp/fr/InterfaceEmploiDuTemps.java | 2 +- src/main/java/edt/umontp/fr/Planifiable.java | 2 +- src/main/java/edt/umontp/fr/Test.java | 0 3 files changed, 2 insertions(+), 2 deletions(-) delete mode 100644 src/main/java/edt/umontp/fr/Test.java diff --git a/src/main/java/edt/umontp/fr/InterfaceEmploiDuTemps.java b/src/main/java/edt/umontp/fr/InterfaceEmploiDuTemps.java index 93ee511..c826ea5 100644 --- a/src/main/java/edt/umontp/fr/InterfaceEmploiDuTemps.java +++ b/src/main/java/edt/umontp/fr/InterfaceEmploiDuTemps.java @@ -2,6 +2,6 @@ import java.time.LocalDate; -public interface InterfaceEmploiDuTemps extends Planifiable{ +interface InterfaceEmploiDuTemps extends Planifiable{ public void actualiser(); } diff --git a/src/main/java/edt/umontp/fr/Planifiable.java b/src/main/java/edt/umontp/fr/Planifiable.java index 271f20c..71a135e 100644 --- a/src/main/java/edt/umontp/fr/Planifiable.java +++ b/src/main/java/edt/umontp/fr/Planifiable.java @@ -3,7 +3,7 @@ import java.time.LocalDate; import java.util.Date; -public interface Planifiable { +interface Planifiable { public Planning getPlanningOf(LocalDate date); public Planning getPlanningOf(LocalDate date, Groupe groupe); diff --git a/src/main/java/edt/umontp/fr/Test.java b/src/main/java/edt/umontp/fr/Test.java deleted file mode 100644 index e69de29..0000000 From 6f3cb82bfcadad28c8c22c0be386a8d51f1a2006 Mon Sep 17 00:00:00 2001 From: MathieuSoysal Date: Mon, 18 Jan 2021 23:05:03 +0100 Subject: [PATCH 047/111] =?UTF-8?q?=E2=9C=94=20Ajout=20test=20non-valid?= =?UTF-8?q?=C3=A9=20getPlanningOf=20date=20groupe?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/test/java/edt/umontp/fr/PlanningTest.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/test/java/edt/umontp/fr/PlanningTest.java b/src/test/java/edt/umontp/fr/PlanningTest.java index 945d32a..bdcb12e 100644 --- a/src/test/java/edt/umontp/fr/PlanningTest.java +++ b/src/test/java/edt/umontp/fr/PlanningTest.java @@ -1,6 +1,7 @@ package edt.umontp.fr; import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotEquals; import java.time.LocalDate; import java.time.LocalTime; @@ -17,7 +18,7 @@ class PlanningTest { LocalTime.of(14, 30), "K133", Groupe.S1, "Compta1"); private Cours cours2 = new Cours(LocalDate.of(2021, 1, 21), new String[] { "prof" }, LocalTime.of(14, 30), LocalTime.of(15, 30), "K133", Groupe.S3, "Compta2"); - private Cours cours3 = new Cours(LocalDate.of(2021, 1, 21), new String[] { "prof" }, LocalTime.of(14, 30), + private Cours cours3 = new Cours(LocalDate.of(2021, 1, 21), new String[] { "prof" }, LocalTime.of(13, 30), LocalTime.of(14, 30), "K133", Groupe.S2, "Compta3"); private Cours cours4 = new Cours(LocalDate.of(2021, 1, 22), new String[] { "prof" }, LocalTime.of(11, 30), LocalTime.of(12, 30), "K133", Groupe.S1, "Compta4"); @@ -38,8 +39,14 @@ void test_getPlanningOf_date() { } @Test - void test_getPlanningOf_groupe(){ + void test_getPlanningOf_groupe() { assertEquals(cours2, planning.getPlanningOf(Groupe.S3).iterator().next()); } + @Test + void test_getPlanningOf_date_and_groupe() { + assertNotEquals(cours2, planning.getPlanningOf(cours2.getDate()).iterator().next()); + assertEquals(cours2, planning.getPlanningOf(cours2.getDate(), cours2.getGroupe()).iterator().next()); + } + } From c5be52310908105b1733658ed64977c922055e3c Mon Sep 17 00:00:00 2001 From: MathieuSoysal Date: Mon, 18 Jan 2021 23:06:18 +0100 Subject: [PATCH 048/111] =?UTF-8?q?=F0=9F=94=A8=20Validation=20test=20getP?= =?UTF-8?q?lanningOf=20date=20groupe?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/edt/umontp/fr/Planning.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/edt/umontp/fr/Planning.java b/src/main/java/edt/umontp/fr/Planning.java index c1f94a9..02dac9a 100644 --- a/src/main/java/edt/umontp/fr/Planning.java +++ b/src/main/java/edt/umontp/fr/Planning.java @@ -52,7 +52,7 @@ public Planning getPlanningOf(LocalDate date) { @Override public Planning getPlanningOf(LocalDate date, Groupe groupe) { - return null; + return getPlanningOf(date).getPlanningOf(groupe); } @Override From b778fb9805fcbdfa818af4e2cb11c1101b9c160a Mon Sep 17 00:00:00 2001 From: MathieuSoysal Date: Tue, 19 Jan 2021 00:25:56 +0100 Subject: [PATCH 049/111] =?UTF-8?q?=E2=9C=94=20Ajout=20test=20non-valid?= =?UTF-8?q?=C3=A9=20Cours=20constructeur?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/test/java/edt/umontp/fr/CoursTest.java | 90 +++++++++++++++++++++- 1 file changed, 88 insertions(+), 2 deletions(-) diff --git a/src/test/java/edt/umontp/fr/CoursTest.java b/src/test/java/edt/umontp/fr/CoursTest.java index cbc843b..5fd61b7 100644 --- a/src/test/java/edt/umontp/fr/CoursTest.java +++ b/src/test/java/edt/umontp/fr/CoursTest.java @@ -1,14 +1,100 @@ package edt.umontp.fr; -import org.junit.jupiter.api.Test; +import static org.junit.jupiter.api.Assertions.assertAll; +import static org.junit.jupiter.api.Assertions.assertEquals; +import java.text.ParseException; +import java.time.LocalDate; +import java.time.LocalTime; import java.util.Arrays; -import static org.junit.jupiter.api.Assertions.*; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Nested; +import org.junit.jupiter.api.Test; + +import net.fortuna.ical4j.model.Component; +import net.fortuna.ical4j.model.DateTime; +import net.fortuna.ical4j.model.component.VEvent; +import net.fortuna.ical4j.model.property.Description; +import net.fortuna.ical4j.model.property.Location; class CoursTest { + @Nested + class contructeur_test { + private Component component; + + @BeforeEach + void init_component() { + DateTime startTime, endTime; + try { + startTime = new DateTime("20171127T150000"); + endTime = new DateTime("20171127T160000"); + } catch (ParseException pe) { + // yyyymmddTHHmmss is the correct format, but to make the compiler happy... + startTime = new DateTime(); + endTime = startTime; + } + component = new VEvent(startTime, endTime, "intitule"); + component.getProperties().add(new Description( + "\n\nA2-Semestre-3\nBELMECHERI NASSIM\nHAETTEL THOMAS\nLA XUAN HOANG\nCHIROUZE ANNE\nA valider\n(Exporté le:18/01/2021 10:51)\n")); + component.getProperties().add(new Location("K133")); + } + + @Test + void test_constructeur_VEvent() { + assertAll(() -> new Cours(component)); + } + + @Test + void test_constructeur_VEvent_dateBon() { + Cours cours = new Cours(component); + assertEquals(LocalDate.of(2017, 11, 27), cours.getDate()); + } + + @Test + void test_constructeur_VEvent_heureDebut_Bon() { + Cours cours = new Cours(component); + assertEquals(LocalTime.of(15, 00), cours.getHeureDebut()); + } + @Test + void test_constructeur_VEvent_heureFin_Bon() { + Cours cours = new Cours(component); + assertEquals(LocalTime.of(16, 00), cours.getHeureFin()); + } + + @Test + void test_constructeur_VEvent_duree_Bon() { + Cours cours = new Cours(component); + assertEquals(60, cours.getDuree()); + } + + @Test + void test_constructeur_VEvent_groupe_Bon() { + Cours cours = new Cours(component); + assertEquals(Groupe.A2, cours.getGroupe()); + } + + @Test + void test_constructeur_VEvent_profs_Bon() { + String[] expected = { "BELMECHERI NASSIM", "HAETTEL THOMAS", "LA XUAN HOANG", "CHIROUZE ANNE" }; + Cours cours = new Cours(component); + assertEquals(Arrays.toString(expected), Arrays.toString(cours.getProf())); + } + + @Test + void test_constructeur_VEvent_lieu_Bon() { + Cours cours = new Cours(component); + assertEquals("K133", cours.getLieu()); + } + + @Test + void test_constructeur_VEvent_intitule_Bon() { + Cours cours = new Cours(component); + assertEquals("intitule", cours.getIntitule()); + } + } @Test void test_getProfFromDdesc_Desc_NomsDesProfs() { From f7ab156e8a5022f4b8df837c56825d831a7fc131 Mon Sep 17 00:00:00 2001 From: MathieuSoysal Date: Tue, 19 Jan 2021 00:26:15 +0100 Subject: [PATCH 050/111] =?UTF-8?q?=F0=9F=94=A8=20Validation=20de=20tous?= =?UTF-8?q?=20les=20tests=20!!=20:D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/edt/umontp/fr/Cours.java | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/src/main/java/edt/umontp/fr/Cours.java b/src/main/java/edt/umontp/fr/Cours.java index 27a9903..5eada7f 100644 --- a/src/main/java/edt/umontp/fr/Cours.java +++ b/src/main/java/edt/umontp/fr/Cours.java @@ -4,17 +4,19 @@ import java.time.Duration; import java.time.LocalDate; import java.time.LocalTime; -import java.time.Period; -import java.util.*; +import java.time.ZoneId; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; import java.util.regex.Matcher; import java.util.regex.Pattern; -import net.fortuna.ical4j.data.ParserException; import net.fortuna.ical4j.model.Component; import net.fortuna.ical4j.model.DateTime; import net.fortuna.ical4j.model.Property; public class Cours implements Comparable { + private final ZoneId ZONE_ID = ZoneId.of("Europe/Paris"); private LocalDate date; private String[] prof; private LocalTime heureDebut; @@ -51,19 +53,18 @@ public Cours(Component vEvent) { } catch (ParseException e) { e.printStackTrace(); } - date = LocalDate.ofInstant(dateDebut.toInstant(), dateDebut.getTimeZone().toZoneId()); - heureDebut = LocalTime.ofInstant(dateDebut.toInstant(), dateDebut.getTimeZone().toZoneId()); - heureFin = LocalTime.ofInstant(dateFin.toInstant(), dateFin.getTimeZone().toZoneId()); + + date = LocalDate.ofInstant(dateDebut.toInstant(), ZONE_ID); + heureDebut = LocalTime.ofInstant(dateDebut.toInstant(), ZONE_ID); + heureFin = LocalTime.ofInstant(dateFin.toInstant(), ZONE_ID); lieu = location.getValue(); intitule = summary.getValue(); prof = getProfFromDesc(description.getValue()); groupe = Groupe.getGroupeDepuisTexte(description.getValue()); - Duration duration = Duration.between(heureDebut, heureFin); - duree = (int) duration.toMinutes(); + duree = (int) Duration.between(heureDebut, heureFin).toMinutes(); } public static String[] getProfFromDesc(String desc) { - ArrayList res = new ArrayList(); String regex = "(?<=\\n)[- A-Z]* [- A-Z]*(?=\\n)"; Matcher m = Pattern.compile(regex).matcher(desc); final List matches = new ArrayList<>(); From d400bf959336d24458cbfa462d85cab9b9b25292 Mon Sep 17 00:00:00 2001 From: MathieuSoysal Date: Tue, 19 Jan 2021 00:42:38 +0100 Subject: [PATCH 051/111] =?UTF-8?q?=E2=9C=85=20Ajout=20test=20valid=C3=A9?= =?UTF-8?q?=20CoursTest?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/test/java/edt/umontp/fr/CoursTest.java | 33 ++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/src/test/java/edt/umontp/fr/CoursTest.java b/src/test/java/edt/umontp/fr/CoursTest.java index 5fd61b7..08677c9 100644 --- a/src/test/java/edt/umontp/fr/CoursTest.java +++ b/src/test/java/edt/umontp/fr/CoursTest.java @@ -7,10 +7,14 @@ import java.time.LocalDate; import java.time.LocalTime; import java.util.Arrays; +import java.util.stream.Stream; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Nested; import org.junit.jupiter.api.Test; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.Arguments; +import org.junit.jupiter.params.provider.MethodSource; import net.fortuna.ical4j.model.Component; import net.fortuna.ical4j.model.DateTime; @@ -102,4 +106,33 @@ void test_getProfFromDdesc_Desc_NomsDesProfs() { String[] expected = { "BELMECHERI NASSIM", "HAETTEL THOMAS", "LA XUAN HOANG", "CHIROUZE ANNE" }; assertEquals(Arrays.toString(expected), Arrays.toString(Cours.getProfFromDesc(desc))); } + + @ParameterizedTest(name = "Lorsque l'on compare le cours {0} au cours {1} les résultat doit être {2} ") + @MethodSource("genererArgumentsPourtestCompareTo_avecDate") + void testCompareTo_avecDate(Cours cours1, Cours cours2, int excepted) { + + assertEquals(excepted, cours1.compareTo(cours2)); + } + + private static Stream genererArgumentsPourtestCompareTo_avecDate() { + return Stream.of(// + Arguments.of( + new Cours(LocalDate.of(2021, 1, 20), new String[] { "prof" }, LocalTime.of(13, 30), + LocalTime.of(14, 30), "K133", Groupe.S1, "Compta1"), + new Cours(LocalDate.of(2021, 1, 20), new String[] { "prof" }, LocalTime.of(13, 30), + LocalTime.of(14, 30), "K133", Groupe.S1, "Compta1"), + 0), // + Arguments.of( + new Cours(LocalDate.of(2021, 1, 19), new String[] { "prof" }, LocalTime.of(13, 30), + LocalTime.of(14, 30), "K133", Groupe.S1, "Compta1"), + new Cours(LocalDate.of(2021, 1, 20), new String[] { "prof" }, LocalTime.of(13, 30), + LocalTime.of(14, 30), "K133", Groupe.S1, "Compta1"), + -1), // + Arguments.of( + new Cours(LocalDate.of(2021, 1, 21), new String[] { "prof" }, LocalTime.of(13, 30), + LocalTime.of(14, 30), "K133", Groupe.S1, "Compta1"), + new Cours(LocalDate.of(2021, 1, 20), new String[] { "prof" }, LocalTime.of(13, 30), + LocalTime.of(14, 30), "K133", Groupe.S1, "Compta1"), + 1)); + } } \ No newline at end of file From 8cef509cc496cc78cab288c8ba64ee451802905e Mon Sep 17 00:00:00 2001 From: MathieuSoysal Date: Tue, 19 Jan 2021 00:43:12 +0100 Subject: [PATCH 052/111] =?UTF-8?q?=E2=9C=85=20Ajout=20test=20non-valid?= =?UTF-8?q?=C3=A9=20CoursTest=20compare=20heure?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/test/java/edt/umontp/fr/CoursTest.java | 28 ++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/src/test/java/edt/umontp/fr/CoursTest.java b/src/test/java/edt/umontp/fr/CoursTest.java index 08677c9..3594980 100644 --- a/src/test/java/edt/umontp/fr/CoursTest.java +++ b/src/test/java/edt/umontp/fr/CoursTest.java @@ -135,4 +135,32 @@ private static Stream genererArgumentsPourtestCompareTo_avecDate() { LocalTime.of(14, 30), "K133", Groupe.S1, "Compta1"), 1)); } + + @ParameterizedTest(name = "Lorsque l'on compare le cours {0} au cours {1} les résultat doit être {2} ") + @MethodSource("genererArgumentsPourtestCompareTo_avecHeure") + void testCompareTo_avecHeure(Cours cours1, Cours cours2, int excepted) { + assertEquals(excepted, cours1.compareTo(cours2)); + } + + private static Stream genererArgumentsPourtestCompareTo_avecHeure() { + return Stream.of(// + Arguments.of( + new Cours(LocalDate.of(2021, 1, 20), new String[] { "prof" }, LocalTime.of(13, 30), + LocalTime.of(14, 30), "K133", Groupe.S1, "Compta1"), + new Cours(LocalDate.of(2021, 1, 20), new String[] { "prof" }, LocalTime.of(13, 30), + LocalTime.of(14, 30), "K133", Groupe.S1, "Compta1"), + 0), // + Arguments.of( + new Cours(LocalDate.of(2021, 1, 20), new String[] { "prof" }, LocalTime.of(13, 30), + LocalTime.of(13, 30), "K133", Groupe.S1, "Compta1"), + new Cours(LocalDate.of(2021, 1, 20), new String[] { "prof" }, LocalTime.of(13, 30), + LocalTime.of(14, 30), "K133", Groupe.S1, "Compta1"), + -1), // + Arguments.of( + new Cours(LocalDate.of(2021, 1, 21), new String[] { "prof" }, LocalTime.of(13, 30), + LocalTime.of(15, 30), "K133", Groupe.S1, "Compta1"), + new Cours(LocalDate.of(2021, 1, 20), new String[] { "prof" }, LocalTime.of(13, 30), + LocalTime.of(14, 30), "K133", Groupe.S1, "Compta1"), + 1)); + } } \ No newline at end of file From 57beee5f1751707333fde43c0a237a245c23519d Mon Sep 17 00:00:00 2001 From: MathieuSoysal Date: Tue, 19 Jan 2021 00:50:44 +0100 Subject: [PATCH 053/111] =?UTF-8?q?=E2=9C=85=20Validation=20de=20tous=20le?= =?UTF-8?q?s=20tests=20Cours?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/edt/umontp/fr/Cours.java | 90 +++++++++++++++++----- src/test/java/edt/umontp/fr/CoursTest.java | 14 +++- 2 files changed, 85 insertions(+), 19 deletions(-) diff --git a/src/main/java/edt/umontp/fr/Cours.java b/src/main/java/edt/umontp/fr/Cours.java index 5eada7f..5f7c6d2 100644 --- a/src/main/java/edt/umontp/fr/Cours.java +++ b/src/main/java/edt/umontp/fr/Cours.java @@ -6,6 +6,7 @@ import java.time.LocalTime; import java.time.ZoneId; import java.util.ArrayList; +import java.util.Arrays; import java.util.List; import java.util.Objects; import java.util.regex.Matcher; @@ -53,7 +54,7 @@ public Cours(Component vEvent) { } catch (ParseException e) { e.printStackTrace(); } - + date = LocalDate.ofInstant(dateDebut.toInstant(), ZONE_ID); heureDebut = LocalTime.ofInstant(dateDebut.toInstant(), ZONE_ID); heureFin = LocalTime.ofInstant(dateFin.toInstant(), ZONE_ID); @@ -74,23 +75,6 @@ public static String[] getProfFromDesc(String desc) { return matches.toArray(new String[matches.size()]); } - @Override - public boolean equals(Object o) { - if (this == o) - return true; - if (o == null || getClass() != o.getClass()) - return false; - Cours cours = (Cours) o; - return duree == cours.duree && date.equals(cours.date) && prof.equals(cours.prof) - && heureDebut.equals(cours.heureDebut) && heureFin.equals(cours.heureFin) && lieu.equals(cours.lieu) - && groupe == cours.groupe && intitule.equals(cours.intitule); - } - - @Override - public int hashCode() { - return Objects.hash(date, prof, heureDebut, heureFin, lieu, duree, groupe, intitule); - } - @Override public int compareTo(Cours o) { int compareDate = date.compareTo(o.date); @@ -152,4 +136,74 @@ public Groupe getGroupe() { public String getIntitule() { return intitule; } + + /* + * (non-Javadoc) + * + * @see java.lang.Object#hashCode() + */ + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((date == null) ? 0 : date.hashCode()); + result = prime * result + duree; + result = prime * result + ((groupe == null) ? 0 : groupe.hashCode()); + result = prime * result + ((heureDebut == null) ? 0 : heureDebut.hashCode()); + result = prime * result + ((heureFin == null) ? 0 : heureFin.hashCode()); + result = prime * result + ((intitule == null) ? 0 : intitule.hashCode()); + result = prime * result + ((lieu == null) ? 0 : lieu.hashCode()); + result = prime * result + Arrays.hashCode(prof); + return result; + } + + /* + * (non-Javadoc) + * + * @see java.lang.Object#equals(java.lang.Object) + */ + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + Cours other = (Cours) obj; + if (date == null) { + if (other.date != null) + return false; + } else if (!date.equals(other.date)) + return false; + if (duree != other.duree) + return false; + if (groupe != other.groupe) + return false; + if (heureDebut == null) { + if (other.heureDebut != null) + return false; + } else if (!heureDebut.equals(other.heureDebut)) + return false; + if (heureFin == null) { + if (other.heureFin != null) + return false; + } else if (!heureFin.equals(other.heureFin)) + return false; + if (intitule == null) { + if (other.intitule != null) + return false; + } else if (!intitule.equals(other.intitule)) + return false; + if (lieu == null) { + if (other.lieu != null) + return false; + } else if (!lieu.equals(other.lieu)) + return false; + if (!Arrays.equals(prof, other.prof)) + return false; + return true; + } } diff --git a/src/test/java/edt/umontp/fr/CoursTest.java b/src/test/java/edt/umontp/fr/CoursTest.java index 3594980..30e85a1 100644 --- a/src/test/java/edt/umontp/fr/CoursTest.java +++ b/src/test/java/edt/umontp/fr/CoursTest.java @@ -151,13 +151,25 @@ private static Stream genererArgumentsPourtestCompareTo_avecHeure() { LocalTime.of(14, 30), "K133", Groupe.S1, "Compta1"), 0), // Arguments.of( + new Cours(LocalDate.of(2021, 1, 20), new String[] { "prof" }, LocalTime.of(12, 30), + LocalTime.of(13, 30), "K133", Groupe.S1, "Compta1"), new Cours(LocalDate.of(2021, 1, 20), new String[] { "prof" }, LocalTime.of(13, 30), + LocalTime.of(14, 30), "K133", Groupe.S1, "Compta1"), + -1), // + Arguments.of( + new Cours(LocalDate.of(2021, 1, 20), new String[] { "prof" }, LocalTime.of(13, 29), LocalTime.of(13, 30), "K133", Groupe.S1, "Compta1"), new Cours(LocalDate.of(2021, 1, 20), new String[] { "prof" }, LocalTime.of(13, 30), LocalTime.of(14, 30), "K133", Groupe.S1, "Compta1"), -1), // Arguments.of( - new Cours(LocalDate.of(2021, 1, 21), new String[] { "prof" }, LocalTime.of(13, 30), + new Cours(LocalDate.of(2021, 1, 20), new String[] { "prof" }, LocalTime.of(13, 31), + LocalTime.of(13, 30), "K133", Groupe.S1, "Compta1"), + new Cours(LocalDate.of(2021, 1, 20), new String[] { "prof" }, LocalTime.of(13, 30), + LocalTime.of(14, 30), "K133", Groupe.S1, "Compta1"), + 1), // + Arguments.of( + new Cours(LocalDate.of(2021, 1, 21), new String[] { "prof" }, LocalTime.of(14, 30), LocalTime.of(15, 30), "K133", Groupe.S1, "Compta1"), new Cours(LocalDate.of(2021, 1, 20), new String[] { "prof" }, LocalTime.of(13, 30), LocalTime.of(14, 30), "K133", Groupe.S1, "Compta1"), From e65fa9e69dc356dca321d0bd2b09f0a3a8034b9b Mon Sep 17 00:00:00 2001 From: MathieuSoysal Date: Tue, 19 Jan 2021 00:53:42 +0100 Subject: [PATCH 054/111] =?UTF-8?q?=F0=9F=8E=A8=20Mise=20en=20forme=20g?= =?UTF-8?q?=C3=A9n=C3=A9ral?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/edt/umontp/fr/Cours.java | 2 +- .../java/edt/umontp/fr/EmploiDuTemps.java | 12 +- .../edt/umontp/fr/InterfaceEmploiDuTemps.java | 4 +- src/main/java/edt/umontp/fr/Planifiable.java | 1 - src/test/java/edt/umontp/fr/CoursTest.java | 285 +++++++++--------- src/test/java/edt/umontp/fr/GroupeTest.java | 2 - 6 files changed, 150 insertions(+), 156 deletions(-) diff --git a/src/main/java/edt/umontp/fr/Cours.java b/src/main/java/edt/umontp/fr/Cours.java index 5f7c6d2..fae8922 100644 --- a/src/main/java/edt/umontp/fr/Cours.java +++ b/src/main/java/edt/umontp/fr/Cours.java @@ -34,9 +34,9 @@ public Cours(LocalDate date, String[] prof, LocalTime heureDebut, LocalTime heur this.heureDebut = heureDebut; this.heureFin = heureFin; this.lieu = lieu; - this.duree = duree; this.groupe = groupe; this.intitule = intitule; + duree = (int) Duration.between(heureDebut, heureFin).toMinutes(); } public Cours(Component vEvent) { diff --git a/src/main/java/edt/umontp/fr/EmploiDuTemps.java b/src/main/java/edt/umontp/fr/EmploiDuTemps.java index 4a42cb9..87a8127 100644 --- a/src/main/java/edt/umontp/fr/EmploiDuTemps.java +++ b/src/main/java/edt/umontp/fr/EmploiDuTemps.java @@ -3,26 +3,16 @@ import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; -import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; -import java.net.URI; -import java.net.URISyntaxException; import java.net.URL; -import java.net.URLConnection; import java.nio.file.Files; import java.nio.file.Paths; -import java.text.ParseException; -import java.time.LocalDate; -import java.time.LocalTime; import java.util.ArrayList; import net.fortuna.ical4j.data.CalendarBuilder; import net.fortuna.ical4j.data.ParserException; import net.fortuna.ical4j.model.Calendar; -import net.fortuna.ical4j.model.Component; -import net.fortuna.ical4j.model.DateTime; -import net.fortuna.ical4j.model.Property; public class EmploiDuTemps { private final String LIEN_ICAL = "https://proseconsult.umontpellier.fr/jsp/custom/modules/plannings/direct_cal.jsp?data=58c99062bab31d256bee14356aca3f2423c0f022cb9660eba051b2653be722c431b66c493702208e664667048bc04373dc5c094f7d1a811b903031bde802c7f59b21846d3c6254443d7b6e956d3145c6e0d5bac87b70fdd185b8b86771d71211a02411e8351020815cfb0dcc54c667187353dbcfc377b44753a4f433d4e51f753c2b0fc0eafdcbc1cbb6ef4e715ebea9d495758b595b12cb294e70e715876fbaa3c654023c76f43cd51442775ff171e0a5f21b50c55a5b52d94df3e7977af823a1e78ee86c6497b1cf8732d52143eeffacc27449fc13ec1f0b04d23e09712df15579474e1aa0cd65f50f33a1dd766301,1"; @@ -65,7 +55,7 @@ public void actualiser() { ArrayList coursList = new ArrayList<>(); // TODO en attente de finalisation du constructeur de Cours // for (Object vEvent : calendar.getComponents(Component.VEVENT)) { - // coursList.add(new Cours((Component) vEvent)); + // coursList.add(new Cours((Component) vEvent)); // } // planningEmploisDutemps = new Planning(coursList); } diff --git a/src/main/java/edt/umontp/fr/InterfaceEmploiDuTemps.java b/src/main/java/edt/umontp/fr/InterfaceEmploiDuTemps.java index c826ea5..3f36f8b 100644 --- a/src/main/java/edt/umontp/fr/InterfaceEmploiDuTemps.java +++ b/src/main/java/edt/umontp/fr/InterfaceEmploiDuTemps.java @@ -1,7 +1,5 @@ package edt.umontp.fr; -import java.time.LocalDate; - -interface InterfaceEmploiDuTemps extends Planifiable{ +interface InterfaceEmploiDuTemps extends Planifiable { public void actualiser(); } diff --git a/src/main/java/edt/umontp/fr/Planifiable.java b/src/main/java/edt/umontp/fr/Planifiable.java index 71a135e..15fe713 100644 --- a/src/main/java/edt/umontp/fr/Planifiable.java +++ b/src/main/java/edt/umontp/fr/Planifiable.java @@ -1,7 +1,6 @@ package edt.umontp.fr; import java.time.LocalDate; -import java.util.Date; interface Planifiable { public Planning getPlanningOf(LocalDate date); diff --git a/src/test/java/edt/umontp/fr/CoursTest.java b/src/test/java/edt/umontp/fr/CoursTest.java index 30e85a1..4af7cb3 100644 --- a/src/test/java/edt/umontp/fr/CoursTest.java +++ b/src/test/java/edt/umontp/fr/CoursTest.java @@ -24,155 +24,164 @@ class CoursTest { - @Nested - class contructeur_test { - private Component component; - - @BeforeEach - void init_component() { - DateTime startTime, endTime; - try { - startTime = new DateTime("20171127T150000"); - endTime = new DateTime("20171127T160000"); - } catch (ParseException pe) { - // yyyymmddTHHmmss is the correct format, but to make the compiler happy... - startTime = new DateTime(); - endTime = startTime; - } - component = new VEvent(startTime, endTime, "intitule"); - component.getProperties().add(new Description( - "\n\nA2-Semestre-3\nBELMECHERI NASSIM\nHAETTEL THOMAS\nLA XUAN HOANG\nCHIROUZE ANNE\nA valider\n(Exporté le:18/01/2021 10:51)\n")); - component.getProperties().add(new Location("K133")); + @Nested + class contructeur_test { + private Component component; + + @BeforeEach + void init_component() { + DateTime startTime, endTime; + try { + startTime = new DateTime("20171127T150000"); + endTime = new DateTime("20171127T160000"); + } catch (ParseException pe) { + // yyyymmddTHHmmss is the correct format, but to make the compiler happy... + startTime = new DateTime(); + endTime = startTime; + } + component = new VEvent(startTime, endTime, "intitule"); + component.getProperties().add(new Description( + "\n\nA2-Semestre-3\nBELMECHERI NASSIM\nHAETTEL THOMAS\nLA XUAN HOANG\nCHIROUZE ANNE\nA valider\n(Exporté le:18/01/2021 10:51)\n")); + component.getProperties().add(new Location("K133")); + } + + @Test + void test_constructeur_VEvent() { + assertAll(() -> new Cours(component)); + } + + @Test + void test_constructeur_VEvent_dateBon() { + Cours cours = new Cours(component); + assertEquals(LocalDate.of(2017, 11, 27), cours.getDate()); + } + + @Test + void test_constructeur_VEvent_heureDebut_Bon() { + Cours cours = new Cours(component); + assertEquals(LocalTime.of(15, 00), cours.getHeureDebut()); + } + + @Test + void test_constructeur_VEvent_heureFin_Bon() { + Cours cours = new Cours(component); + assertEquals(LocalTime.of(16, 00), cours.getHeureFin()); + } + + @Test + void test_constructeur_VEvent_duree_Bon() { + Cours cours = new Cours(component); + assertEquals(60, cours.getDuree()); + } + + @Test + void test_constructeur_VEvent_groupe_Bon() { + Cours cours = new Cours(component); + assertEquals(Groupe.A2, cours.getGroupe()); + } + + @Test + void test_constructeur_VEvent_profs_Bon() { + String[] expected = { "BELMECHERI NASSIM", "HAETTEL THOMAS", "LA XUAN HOANG", + "CHIROUZE ANNE" }; + Cours cours = new Cours(component); + assertEquals(Arrays.toString(expected), Arrays.toString(cours.getProf())); + } + + @Test + void test_constructeur_VEvent_lieu_Bon() { + Cours cours = new Cours(component); + assertEquals("K133", cours.getLieu()); + } + + @Test + void test_constructeur_VEvent_intitule_Bon() { + Cours cours = new Cours(component); + assertEquals("intitule", cours.getIntitule()); + } } @Test - void test_constructeur_VEvent() { - assertAll(() -> new Cours(component)); + void test_getProfFromDdesc_Desc_NomsDesProfs() { + String desc = "\n\nA2-Semestre-3\nBELMECHERI NASSIM\nHAETTEL THOMAS\nLA XUAN HOANG\nCHIROUZE ANNE\nA valider\n(Exporté le:18/01/2021 10:51)\n"; + String[] expected = { "BELMECHERI NASSIM", "HAETTEL THOMAS", "LA XUAN HOANG", "CHIROUZE ANNE" }; + assertEquals(Arrays.toString(expected), Arrays.toString(Cours.getProfFromDesc(desc))); } - @Test - void test_constructeur_VEvent_dateBon() { - Cours cours = new Cours(component); - assertEquals(LocalDate.of(2017, 11, 27), cours.getDate()); - } - - @Test - void test_constructeur_VEvent_heureDebut_Bon() { - Cours cours = new Cours(component); - assertEquals(LocalTime.of(15, 00), cours.getHeureDebut()); - } + @ParameterizedTest(name = "Lorsque l'on compare le cours {0} au cours {1} les résultat doit être {2} ") + @MethodSource("genererArgumentsPourtestCompareTo_avecDate") + void testCompareTo_avecDate(Cours cours1, Cours cours2, int excepted) { - @Test - void test_constructeur_VEvent_heureFin_Bon() { - Cours cours = new Cours(component); - assertEquals(LocalTime.of(16, 00), cours.getHeureFin()); + assertEquals(excepted, cours1.compareTo(cours2)); } - @Test - void test_constructeur_VEvent_duree_Bon() { - Cours cours = new Cours(component); - assertEquals(60, cours.getDuree()); + private static Stream genererArgumentsPourtestCompareTo_avecDate() { + return Stream.of(// + Arguments.of(new Cours(LocalDate.of(2021, 1, 20), new String[] { "prof" }, + LocalTime.of(13, 30), LocalTime.of(14, 30), "K133", Groupe.S1, + "Compta1"), + new Cours(LocalDate.of(2021, 1, 20), new String[] { "prof" }, + LocalTime.of(13, 30), LocalTime.of(14, 30), "K133", + Groupe.S1, "Compta1"), + 0), // + Arguments.of(new Cours(LocalDate.of(2021, 1, 19), new String[] { "prof" }, + LocalTime.of(13, 30), LocalTime.of(14, 30), "K133", Groupe.S1, + "Compta1"), + new Cours(LocalDate.of(2021, 1, 20), new String[] { "prof" }, + LocalTime.of(13, 30), LocalTime.of(14, 30), "K133", + Groupe.S1, "Compta1"), + -1), // + Arguments.of(new Cours(LocalDate.of(2021, 1, 21), new String[] { "prof" }, + LocalTime.of(13, 30), LocalTime.of(14, 30), "K133", Groupe.S1, + "Compta1"), + new Cours(LocalDate.of(2021, 1, 20), new String[] { "prof" }, + LocalTime.of(13, 30), LocalTime.of(14, 30), "K133", + Groupe.S1, "Compta1"), + 1)); } - @Test - void test_constructeur_VEvent_groupe_Bon() { - Cours cours = new Cours(component); - assertEquals(Groupe.A2, cours.getGroupe()); + @ParameterizedTest(name = "Lorsque l'on compare le cours {0} au cours {1} les résultat doit être {2} ") + @MethodSource("genererArgumentsPourtestCompareTo_avecHeure") + void testCompareTo_avecHeure(Cours cours1, Cours cours2, int excepted) { + assertEquals(excepted, cours1.compareTo(cours2)); } - @Test - void test_constructeur_VEvent_profs_Bon() { - String[] expected = { "BELMECHERI NASSIM", "HAETTEL THOMAS", "LA XUAN HOANG", "CHIROUZE ANNE" }; - Cours cours = new Cours(component); - assertEquals(Arrays.toString(expected), Arrays.toString(cours.getProf())); - } - - @Test - void test_constructeur_VEvent_lieu_Bon() { - Cours cours = new Cours(component); - assertEquals("K133", cours.getLieu()); - } - - @Test - void test_constructeur_VEvent_intitule_Bon() { - Cours cours = new Cours(component); - assertEquals("intitule", cours.getIntitule()); + private static Stream genererArgumentsPourtestCompareTo_avecHeure() { + return Stream.of(// + Arguments.of(new Cours(LocalDate.of(2021, 1, 20), new String[] { "prof" }, + LocalTime.of(13, 30), LocalTime.of(14, 30), "K133", Groupe.S1, + "Compta1"), + new Cours(LocalDate.of(2021, 1, 20), new String[] { "prof" }, + LocalTime.of(13, 30), LocalTime.of(14, 30), "K133", + Groupe.S1, "Compta1"), + 0), // + Arguments.of(new Cours(LocalDate.of(2021, 1, 20), new String[] { "prof" }, + LocalTime.of(12, 30), LocalTime.of(13, 30), "K133", Groupe.S1, + "Compta1"), + new Cours(LocalDate.of(2021, 1, 20), new String[] { "prof" }, + LocalTime.of(13, 30), LocalTime.of(14, 30), "K133", + Groupe.S1, "Compta1"), + -1), // + Arguments.of(new Cours(LocalDate.of(2021, 1, 20), new String[] { "prof" }, + LocalTime.of(13, 29), LocalTime.of(13, 30), "K133", Groupe.S1, + "Compta1"), + new Cours(LocalDate.of(2021, 1, 20), new String[] { "prof" }, + LocalTime.of(13, 30), LocalTime.of(14, 30), "K133", + Groupe.S1, "Compta1"), + -1), // + Arguments.of(new Cours(LocalDate.of(2021, 1, 20), new String[] { "prof" }, + LocalTime.of(13, 31), LocalTime.of(13, 30), "K133", Groupe.S1, + "Compta1"), + new Cours(LocalDate.of(2021, 1, 20), new String[] { "prof" }, + LocalTime.of(13, 30), LocalTime.of(14, 30), "K133", + Groupe.S1, "Compta1"), + 1), // + Arguments.of(new Cours(LocalDate.of(2021, 1, 21), new String[] { "prof" }, + LocalTime.of(14, 30), LocalTime.of(15, 30), "K133", Groupe.S1, + "Compta1"), + new Cours(LocalDate.of(2021, 1, 20), new String[] { "prof" }, + LocalTime.of(13, 30), LocalTime.of(14, 30), "K133", + Groupe.S1, "Compta1"), + 1)); } - } - - @Test - void test_getProfFromDdesc_Desc_NomsDesProfs() { - String desc = "\n\nA2-Semestre-3\nBELMECHERI NASSIM\nHAETTEL THOMAS\nLA XUAN HOANG\nCHIROUZE ANNE\nA valider\n(Exporté le:18/01/2021 10:51)\n"; - String[] expected = { "BELMECHERI NASSIM", "HAETTEL THOMAS", "LA XUAN HOANG", "CHIROUZE ANNE" }; - assertEquals(Arrays.toString(expected), Arrays.toString(Cours.getProfFromDesc(desc))); - } - - @ParameterizedTest(name = "Lorsque l'on compare le cours {0} au cours {1} les résultat doit être {2} ") - @MethodSource("genererArgumentsPourtestCompareTo_avecDate") - void testCompareTo_avecDate(Cours cours1, Cours cours2, int excepted) { - - assertEquals(excepted, cours1.compareTo(cours2)); - } - - private static Stream genererArgumentsPourtestCompareTo_avecDate() { - return Stream.of(// - Arguments.of( - new Cours(LocalDate.of(2021, 1, 20), new String[] { "prof" }, LocalTime.of(13, 30), - LocalTime.of(14, 30), "K133", Groupe.S1, "Compta1"), - new Cours(LocalDate.of(2021, 1, 20), new String[] { "prof" }, LocalTime.of(13, 30), - LocalTime.of(14, 30), "K133", Groupe.S1, "Compta1"), - 0), // - Arguments.of( - new Cours(LocalDate.of(2021, 1, 19), new String[] { "prof" }, LocalTime.of(13, 30), - LocalTime.of(14, 30), "K133", Groupe.S1, "Compta1"), - new Cours(LocalDate.of(2021, 1, 20), new String[] { "prof" }, LocalTime.of(13, 30), - LocalTime.of(14, 30), "K133", Groupe.S1, "Compta1"), - -1), // - Arguments.of( - new Cours(LocalDate.of(2021, 1, 21), new String[] { "prof" }, LocalTime.of(13, 30), - LocalTime.of(14, 30), "K133", Groupe.S1, "Compta1"), - new Cours(LocalDate.of(2021, 1, 20), new String[] { "prof" }, LocalTime.of(13, 30), - LocalTime.of(14, 30), "K133", Groupe.S1, "Compta1"), - 1)); - } - - @ParameterizedTest(name = "Lorsque l'on compare le cours {0} au cours {1} les résultat doit être {2} ") - @MethodSource("genererArgumentsPourtestCompareTo_avecHeure") - void testCompareTo_avecHeure(Cours cours1, Cours cours2, int excepted) { - assertEquals(excepted, cours1.compareTo(cours2)); - } - - private static Stream genererArgumentsPourtestCompareTo_avecHeure() { - return Stream.of(// - Arguments.of( - new Cours(LocalDate.of(2021, 1, 20), new String[] { "prof" }, LocalTime.of(13, 30), - LocalTime.of(14, 30), "K133", Groupe.S1, "Compta1"), - new Cours(LocalDate.of(2021, 1, 20), new String[] { "prof" }, LocalTime.of(13, 30), - LocalTime.of(14, 30), "K133", Groupe.S1, "Compta1"), - 0), // - Arguments.of( - new Cours(LocalDate.of(2021, 1, 20), new String[] { "prof" }, LocalTime.of(12, 30), - LocalTime.of(13, 30), "K133", Groupe.S1, "Compta1"), - new Cours(LocalDate.of(2021, 1, 20), new String[] { "prof" }, LocalTime.of(13, 30), - LocalTime.of(14, 30), "K133", Groupe.S1, "Compta1"), - -1), // - Arguments.of( - new Cours(LocalDate.of(2021, 1, 20), new String[] { "prof" }, LocalTime.of(13, 29), - LocalTime.of(13, 30), "K133", Groupe.S1, "Compta1"), - new Cours(LocalDate.of(2021, 1, 20), new String[] { "prof" }, LocalTime.of(13, 30), - LocalTime.of(14, 30), "K133", Groupe.S1, "Compta1"), - -1), // - Arguments.of( - new Cours(LocalDate.of(2021, 1, 20), new String[] { "prof" }, LocalTime.of(13, 31), - LocalTime.of(13, 30), "K133", Groupe.S1, "Compta1"), - new Cours(LocalDate.of(2021, 1, 20), new String[] { "prof" }, LocalTime.of(13, 30), - LocalTime.of(14, 30), "K133", Groupe.S1, "Compta1"), - 1), // - Arguments.of( - new Cours(LocalDate.of(2021, 1, 21), new String[] { "prof" }, LocalTime.of(14, 30), - LocalTime.of(15, 30), "K133", Groupe.S1, "Compta1"), - new Cours(LocalDate.of(2021, 1, 20), new String[] { "prof" }, LocalTime.of(13, 30), - LocalTime.of(14, 30), "K133", Groupe.S1, "Compta1"), - 1)); - } } \ No newline at end of file diff --git a/src/test/java/edt/umontp/fr/GroupeTest.java b/src/test/java/edt/umontp/fr/GroupeTest.java index 63c8895..1ce03be 100644 --- a/src/test/java/edt/umontp/fr/GroupeTest.java +++ b/src/test/java/edt/umontp/fr/GroupeTest.java @@ -9,8 +9,6 @@ import org.junit.jupiter.params.provider.Arguments; import org.junit.jupiter.params.provider.MethodSource; -import static org.junit.jupiter.api.Assertions.*; - class GroupeTest { @Test From 520a3266f905ed4754a9c2a4aca0705e04472d64 Mon Sep 17 00:00:00 2001 From: MathieuSoysal Date: Tue, 19 Jan 2021 00:56:20 +0100 Subject: [PATCH 055/111] =?UTF-8?q?=F0=9F=94=A8=20Ajout=20m=C3=A9thode=20a?= =?UTF-8?q?ctualiser?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/edt/umontp/fr/EmploiDuTemps.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/main/java/edt/umontp/fr/EmploiDuTemps.java b/src/main/java/edt/umontp/fr/EmploiDuTemps.java index 87a8127..499c15e 100644 --- a/src/main/java/edt/umontp/fr/EmploiDuTemps.java +++ b/src/main/java/edt/umontp/fr/EmploiDuTemps.java @@ -13,10 +13,11 @@ import net.fortuna.ical4j.data.CalendarBuilder; import net.fortuna.ical4j.data.ParserException; import net.fortuna.ical4j.model.Calendar; +import net.fortuna.ical4j.model.Component; public class EmploiDuTemps { private final String LIEN_ICAL = "https://proseconsult.umontpellier.fr/jsp/custom/modules/plannings/direct_cal.jsp?data=58c99062bab31d256bee14356aca3f2423c0f022cb9660eba051b2653be722c431b66c493702208e664667048bc04373dc5c094f7d1a811b903031bde802c7f59b21846d3c6254443d7b6e956d3145c6e0d5bac87b70fdd185b8b86771d71211a02411e8351020815cfb0dcc54c667187353dbcfc377b44753a4f433d4e51f753c2b0fc0eafdcbc1cbb6ef4e715ebea9d495758b595b12cb294e70e715876fbaa3c654023c76f43cd51442775ff171e0a5f21b50c55a5b52d94df3e7977af823a1e78ee86c6497b1cf8732d52143eeffacc27449fc13ec1f0b04d23e09712df15579474e1aa0cd65f50f33a1dd766301,1"; - private final EmploiDuTemps singleton = null; + private EmploiDuTemps singleton = null; private Planning planningEmploisDutemps; private Calendar convertieFichierIcsEnCalendar(File fichierIcs) { @@ -53,11 +54,10 @@ public void actualiser() { File fichierIcs = getFichierIcsDepuisLienIcal(); Calendar calendar = convertieFichierIcsEnCalendar(fichierIcs); ArrayList coursList = new ArrayList<>(); - // TODO en attente de finalisation du constructeur de Cours - // for (Object vEvent : calendar.getComponents(Component.VEVENT)) { - // coursList.add(new Cours((Component) vEvent)); - // } - // planningEmploisDutemps = new Planning(coursList); + for (Object vEvent : calendar.getComponents(Component.VEVENT)) { + coursList.add(new Cours((Component) vEvent)); + } + planningEmploisDutemps = new Planning(coursList); } } From e06afe351cb9cb27216189ea5ec122279f2fa0c1 Mon Sep 17 00:00:00 2001 From: MathieuSoysal Date: Tue, 19 Jan 2021 01:26:16 +0100 Subject: [PATCH 056/111] =?UTF-8?q?=F0=9F=94=A8=20AJout=20m=C3=A9thode=20g?= =?UTF-8?q?etInstance=20EmploisDuTemps?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/edt/umontp/fr/Cours.java | 1 - .../java/edt/umontp/fr/EmploiDuTemps.java | 19 ++++++++++++++++++- .../java/edt/umontp/fr/EmploiDuTempsTest.java | 2 +- 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/src/main/java/edt/umontp/fr/Cours.java b/src/main/java/edt/umontp/fr/Cours.java index fae8922..22960ae 100644 --- a/src/main/java/edt/umontp/fr/Cours.java +++ b/src/main/java/edt/umontp/fr/Cours.java @@ -8,7 +8,6 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.List; -import java.util.Objects; import java.util.regex.Matcher; import java.util.regex.Pattern; diff --git a/src/main/java/edt/umontp/fr/EmploiDuTemps.java b/src/main/java/edt/umontp/fr/EmploiDuTemps.java index 499c15e..e266af4 100644 --- a/src/main/java/edt/umontp/fr/EmploiDuTemps.java +++ b/src/main/java/edt/umontp/fr/EmploiDuTemps.java @@ -17,9 +17,26 @@ public class EmploiDuTemps { private final String LIEN_ICAL = "https://proseconsult.umontpellier.fr/jsp/custom/modules/plannings/direct_cal.jsp?data=58c99062bab31d256bee14356aca3f2423c0f022cb9660eba051b2653be722c431b66c493702208e664667048bc04373dc5c094f7d1a811b903031bde802c7f59b21846d3c6254443d7b6e956d3145c6e0d5bac87b70fdd185b8b86771d71211a02411e8351020815cfb0dcc54c667187353dbcfc377b44753a4f433d4e51f753c2b0fc0eafdcbc1cbb6ef4e715ebea9d495758b595b12cb294e70e715876fbaa3c654023c76f43cd51442775ff171e0a5f21b50c55a5b52d94df3e7977af823a1e78ee86c6497b1cf8732d52143eeffacc27449fc13ec1f0b04d23e09712df15579474e1aa0cd65f50f33a1dd766301,1"; - private EmploiDuTemps singleton = null; + private static EmploiDuTemps singleton = null; private Planning planningEmploisDutemps; + private EmploiDuTemps() { + actualiser(); + } + + public static EmploiDuTemps getInstance() { + EmploiDuTemps localInstance = singleton; + if (localInstance == null) { + synchronized (EmploiDuTemps.class) { + localInstance = singleton; + if (localInstance == null) { + localInstance = new EmploiDuTemps(); + } + } + } + return localInstance; + } + private Calendar convertieFichierIcsEnCalendar(File fichierIcs) { Calendar calendar = null; try (FileInputStream fileICS = new FileInputStream(fichierIcs)) { diff --git a/src/test/java/edt/umontp/fr/EmploiDuTempsTest.java b/src/test/java/edt/umontp/fr/EmploiDuTempsTest.java index 48266c7..23e8f44 100644 --- a/src/test/java/edt/umontp/fr/EmploiDuTempsTest.java +++ b/src/test/java/edt/umontp/fr/EmploiDuTempsTest.java @@ -8,7 +8,7 @@ class EmploiDuTempsTest { @Test void test_actualiser_verifierRetourneAucuneErreur() { - EmploiDuTemps emploiDuTemps = new EmploiDuTemps(); + EmploiDuTemps emploiDuTemps = EmploiDuTemps.getInstance(); assertAll(() -> emploiDuTemps.actualiser()); } } From cdbd47e592bca9583702db28bb52ee1bef687fb5 Mon Sep 17 00:00:00 2001 From: MathieuSoysal Date: Tue, 19 Jan 2021 01:31:33 +0100 Subject: [PATCH 057/111] =?UTF-8?q?=F0=9F=8E=A8=20implentation=20de=20l'in?= =?UTF-8?q?terfaceEmploiDuTemps?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/edt/umontp/fr/EmploiDuTemps.java | 22 ++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/src/main/java/edt/umontp/fr/EmploiDuTemps.java b/src/main/java/edt/umontp/fr/EmploiDuTemps.java index e266af4..194e6a9 100644 --- a/src/main/java/edt/umontp/fr/EmploiDuTemps.java +++ b/src/main/java/edt/umontp/fr/EmploiDuTemps.java @@ -8,6 +8,7 @@ import java.net.URL; import java.nio.file.Files; import java.nio.file.Paths; +import java.time.LocalDate; import java.util.ArrayList; import net.fortuna.ical4j.data.CalendarBuilder; @@ -15,10 +16,10 @@ import net.fortuna.ical4j.model.Calendar; import net.fortuna.ical4j.model.Component; -public class EmploiDuTemps { +public class EmploiDuTemps implements InterfaceEmploiDuTemps { private final String LIEN_ICAL = "https://proseconsult.umontpellier.fr/jsp/custom/modules/plannings/direct_cal.jsp?data=58c99062bab31d256bee14356aca3f2423c0f022cb9660eba051b2653be722c431b66c493702208e664667048bc04373dc5c094f7d1a811b903031bde802c7f59b21846d3c6254443d7b6e956d3145c6e0d5bac87b70fdd185b8b86771d71211a02411e8351020815cfb0dcc54c667187353dbcfc377b44753a4f433d4e51f753c2b0fc0eafdcbc1cbb6ef4e715ebea9d495758b595b12cb294e70e715876fbaa3c654023c76f43cd51442775ff171e0a5f21b50c55a5b52d94df3e7977af823a1e78ee86c6497b1cf8732d52143eeffacc27449fc13ec1f0b04d23e09712df15579474e1aa0cd65f50f33a1dd766301,1"; private static EmploiDuTemps singleton = null; - private Planning planningEmploisDutemps; + private Planning planningEmploisDuTemps; private EmploiDuTemps() { actualiser(); @@ -67,6 +68,7 @@ private File getFichierIcsDepuisLienIcal() { return fichierIcs; } + @Override public void actualiser() { File fichierIcs = getFichierIcsDepuisLienIcal(); Calendar calendar = convertieFichierIcsEnCalendar(fichierIcs); @@ -74,7 +76,21 @@ public void actualiser() { for (Object vEvent : calendar.getComponents(Component.VEVENT)) { coursList.add(new Cours((Component) vEvent)); } - planningEmploisDutemps = new Planning(coursList); + planningEmploisDuTemps = new Planning(coursList); } + @Override + public Planning getPlanningOf(LocalDate date) { + return planningEmploisDuTemps.getPlanningOf(date); + } + + @Override + public Planning getPlanningOf(LocalDate date, Groupe groupe) { + return planningEmploisDuTemps.getPlanningOf(date, groupe); + } + + @Override + public Planning getPlanningOf(Groupe groupe) { + return planningEmploisDuTemps.getPlanningOf(groupe); + } } From efbd71dd3fafd4220690477f17efea0752b6d781 Mon Sep 17 00:00:00 2001 From: MathieuSoysal Date: Tue, 19 Jan 2021 02:03:22 +0100 Subject: [PATCH 058/111] =?UTF-8?q?=E2=9A=A1=EF=B8=8F=20Ajout=20EmploiDuTe?= =?UTF-8?q?mpsProxy?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../edt/umontp/fr/EmploiDuTempsProxy.java | 95 +++++++++++++++++++ 1 file changed, 95 insertions(+) create mode 100644 src/main/java/edt/umontp/fr/EmploiDuTempsProxy.java diff --git a/src/main/java/edt/umontp/fr/EmploiDuTempsProxy.java b/src/main/java/edt/umontp/fr/EmploiDuTempsProxy.java new file mode 100644 index 0000000..a72d28c --- /dev/null +++ b/src/main/java/edt/umontp/fr/EmploiDuTempsProxy.java @@ -0,0 +1,95 @@ +package edt.umontp.fr; + +import java.time.LocalDate; +import java.util.EnumMap; +import java.util.HashMap; + +// FIXME à tester ! + +public class EmploiDuTempsProxy implements InterfaceEmploiDuTemps { + private static EmploiDuTempsProxy singleton = null; + private EmploiDuTemps emploiDuTemps; + private EnumMap cacheGroupe; + private HashMap cacheDate; + private HashMap, Planning> cacheDateGroupe; + + private EmploiDuTempsProxy() { + emploiDuTemps = EmploiDuTemps.getInstance(); + actualiser(); + } + + public static EmploiDuTempsProxy getInstance() { + EmploiDuTempsProxy localInstance = singleton; + if (localInstance == null) { + synchronized (EmploiDuTempsProxy.class) { + localInstance = singleton; + if (localInstance == null) { + localInstance = new EmploiDuTempsProxy(); + } + } + } + return localInstance; + } + + @Override + public Planning getPlanningOf(LocalDate date) { + return cacheDate.computeIfAbsent(date, k -> emploiDuTemps.getPlanningOf(k)); + } + + @Override + public Planning getPlanningOf(LocalDate date, Groupe groupe) { + MultiKey multiKey = new MultiKey<>(date, groupe); + return cacheDateGroupe.computeIfAbsent(multiKey, k -> emploiDuTemps.getPlanningOf(k.key1, k.key2)); + } + + @Override + public Planning getPlanningOf(Groupe groupe) { + return cacheGroupe.computeIfAbsent(groupe, k -> emploiDuTemps.getPlanningOf(k)); + } + + @Override + public void actualiser() { + cacheDate = new HashMap<>(); + cacheGroupe = new EnumMap<>(Groupe.class); + cacheDateGroupe = new HashMap<>(); + } + + class MultiKey { + private K1 key1; + private K2 key2; + + public MultiKey(K1 key1, K2 key2) { + this.key1 = key1; + this.key2 = key2; + } + + @Override + public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + + MultiKey key = (MultiKey) o; + + if (key1 != null ? !key1.equals(key.key1) : key.key1 != null) + return false; + if (key2 != null ? !key2.equals(key.key2) : key.key2 != null) + return false; + + return true; + } + + @Override + public int hashCode() { + int result = key1 != null ? key1.hashCode() : 0; + result = 31 * result + (key2 != null ? key2.hashCode() : 0); + return result; + } + + @Override + public String toString() { + return "[" + key1 + ", " + key2 + "]"; + } + } +} From fd3bc95b82a4e89638b761758a12d7aa0845b7e4 Mon Sep 17 00:00:00 2001 From: MathieuSoysal Date: Tue, 19 Jan 2021 10:49:50 +0100 Subject: [PATCH 059/111] =?UTF-8?q?=E2=9A=A1=20Optimisation=20EmploiDuTemp?= =?UTF-8?q?sProxy?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/edt/umontp/fr/EmploiDuTempsProxy.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/edt/umontp/fr/EmploiDuTempsProxy.java b/src/main/java/edt/umontp/fr/EmploiDuTempsProxy.java index a72d28c..1788d65 100644 --- a/src/main/java/edt/umontp/fr/EmploiDuTempsProxy.java +++ b/src/main/java/edt/umontp/fr/EmploiDuTempsProxy.java @@ -39,7 +39,7 @@ public Planning getPlanningOf(LocalDate date) { @Override public Planning getPlanningOf(LocalDate date, Groupe groupe) { MultiKey multiKey = new MultiKey<>(date, groupe); - return cacheDateGroupe.computeIfAbsent(multiKey, k -> emploiDuTemps.getPlanningOf(k.key1, k.key2)); + return cacheDateGroupe.computeIfAbsent(multiKey, k -> getPlanningOf(k.key1).getPlanningOf(k.key2)); } @Override From a5817ff976070d0b45abc821994f058771391238 Mon Sep 17 00:00:00 2001 From: MathieuSoysal Date: Tue, 19 Jan 2021 11:08:41 +0100 Subject: [PATCH 060/111] =?UTF-8?q?=E2=9C=85=20Ajout=20test=20non-valid?= =?UTF-8?q?=C3=A9=20PlanningTest?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/test/java/edt/umontp/fr/PlanningTest.java | 27 +++++++++++++------ 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/src/test/java/edt/umontp/fr/PlanningTest.java b/src/test/java/edt/umontp/fr/PlanningTest.java index bdcb12e..b93216d 100644 --- a/src/test/java/edt/umontp/fr/PlanningTest.java +++ b/src/test/java/edt/umontp/fr/PlanningTest.java @@ -2,6 +2,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNotEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.time.LocalDate; import java.time.LocalTime; @@ -14,6 +15,8 @@ class PlanningTest { private Planning planning; + private ArrayList coursEnsemble; + private Cours cours1 = new Cours(LocalDate.of(2021, 1, 20), new String[] { "prof" }, LocalTime.of(13, 30), LocalTime.of(14, 30), "K133", Groupe.S1, "Compta1"); private Cours cours2 = new Cours(LocalDate.of(2021, 1, 21), new String[] { "prof" }, LocalTime.of(14, 30), @@ -25,12 +28,12 @@ class PlanningTest { @BeforeEach void initPlanning() { - ArrayList cours = new ArrayList<>(); - cours.add(cours1); - cours.add(cours2); - cours.add(cours3); - cours.add(cours4); - planning = new Planning(cours); + coursEnsemble = new ArrayList<>(); + coursEnsemble.add(cours1); + coursEnsemble.add(cours2); + coursEnsemble.add(cours3); + coursEnsemble.add(cours4); + planning = new Planning(coursEnsemble); } @Test @@ -39,8 +42,16 @@ void test_getPlanningOf_date() { } @Test - void test_getPlanningOf_groupe() { - assertEquals(cours2, planning.getPlanningOf(Groupe.S3).iterator().next()); + void test_getPlanningOf_groupe_simpleGroupe() { + Planning planningA1 = planning.getPlanningOf(Groupe.S3); + assertEquals(cours2, planningA1.iterator().next()); + } + + @Test + void test_getPlanningOf_groupe_groupeCompose() { + Planning planningA1 = planning.getPlanningOf(Groupe.A1); + for (Cours cours : planningA1) + assertTrue(coursEnsemble.contains(cours)); } @Test From ac96fdb3b1e23a87141f126f8e37563d7a5971b9 Mon Sep 17 00:00:00 2001 From: MathieuSoysal Date: Tue, 19 Jan 2021 11:09:09 +0100 Subject: [PATCH 061/111] =?UTF-8?q?=F0=9F=94=A8=20Validation=20de=20tous?= =?UTF-8?q?=20les=20test=20Planning?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/edt/umontp/fr/Planning.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/edt/umontp/fr/Planning.java b/src/main/java/edt/umontp/fr/Planning.java index 02dac9a..0be0b05 100644 --- a/src/main/java/edt/umontp/fr/Planning.java +++ b/src/main/java/edt/umontp/fr/Planning.java @@ -57,6 +57,7 @@ public Planning getPlanningOf(LocalDate date, Groupe groupe) { @Override public Planning getPlanningOf(Groupe groupe) { - return new Planning(cours.stream().filter(x -> x.getGroupe() == groupe).collect(Collectors.toList())); + return new Planning( + cours.stream().filter(x -> x.getGroupe().estContenuDans(groupe)).collect(Collectors.toList())); } } From 6f5b4fc9a98600bd7c44d17c6568f1f4e3225652 Mon Sep 17 00:00:00 2001 From: MathieuSoysal Date: Tue, 19 Jan 2021 11:11:55 +0100 Subject: [PATCH 062/111] =?UTF-8?q?=E2=9C=85=20Ajout=20test=20valid=C3=A9?= =?UTF-8?q?=20PlanningTest?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/test/java/edt/umontp/fr/PlanningTest.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/test/java/edt/umontp/fr/PlanningTest.java b/src/test/java/edt/umontp/fr/PlanningTest.java index b93216d..00c7e19 100644 --- a/src/test/java/edt/umontp/fr/PlanningTest.java +++ b/src/test/java/edt/umontp/fr/PlanningTest.java @@ -1,6 +1,7 @@ package edt.umontp.fr; import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertNotEquals; import static org.junit.jupiter.api.Assertions.assertTrue; @@ -54,6 +55,12 @@ void test_getPlanningOf_groupe_groupeCompose() { assertTrue(coursEnsemble.contains(cours)); } + @Test + void test_getPlanningOf_groupe_groupeComposeVide() { + Planning planningA2 = planning.getPlanningOf(Groupe.A2); + assertFalse(planningA2.iterator().hasNext()); + } + @Test void test_getPlanningOf_date_and_groupe() { assertNotEquals(cours2, planning.getPlanningOf(cours2.getDate()).iterator().next()); From bfbbd4c74ea19b9b822ae8603025196cbbe92b6b Mon Sep 17 00:00:00 2001 From: MathieuSoysal Date: Tue, 19 Jan 2021 11:14:32 +0100 Subject: [PATCH 063/111] =?UTF-8?q?=F0=9F=90=9B=20Correction=20EmploiDuTem?= =?UTF-8?q?psProxy=20actualiser()?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/edt/umontp/fr/EmploiDuTempsProxy.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/edt/umontp/fr/EmploiDuTempsProxy.java b/src/main/java/edt/umontp/fr/EmploiDuTempsProxy.java index 1788d65..2f822bf 100644 --- a/src/main/java/edt/umontp/fr/EmploiDuTempsProxy.java +++ b/src/main/java/edt/umontp/fr/EmploiDuTempsProxy.java @@ -52,6 +52,7 @@ public void actualiser() { cacheDate = new HashMap<>(); cacheGroupe = new EnumMap<>(Groupe.class); cacheDateGroupe = new HashMap<>(); + emploiDuTemps.actualiser(); } class MultiKey { From a99c86c6564fe7ad78a434894de9d3c2116ca94a Mon Sep 17 00:00:00 2001 From: emerick-biron Date: Tue, 19 Jan 2021 11:14:40 +0100 Subject: [PATCH 064/111] =?UTF-8?q?:memo:=20premi=C3=A8re=20version=20de?= =?UTF-8?q?=20la=20JavaDoc?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/edt/umontp/fr/Cours.java | 67 +++++++++---------- .../java/edt/umontp/fr/EmploiDuTemps.java | 22 +++++- src/main/java/edt/umontp/fr/Groupe.java | 15 +++-- src/main/java/edt/umontp/fr/Planifiable.java | 22 ++++++ 4 files changed, 86 insertions(+), 40 deletions(-) diff --git a/src/main/java/edt/umontp/fr/Cours.java b/src/main/java/edt/umontp/fr/Cours.java index 22960ae..63428bc 100644 --- a/src/main/java/edt/umontp/fr/Cours.java +++ b/src/main/java/edt/umontp/fr/Cours.java @@ -27,7 +27,7 @@ public class Cours implements Comparable { private String intitule; public Cours(LocalDate date, String[] prof, LocalTime heureDebut, LocalTime heureFin, String lieu, Groupe groupe, - String intitule) { + String intitule) { this.date = date; this.prof = prof; this.heureDebut = heureDebut; @@ -38,6 +38,12 @@ public Cours(LocalDate date, String[] prof, LocalTime heureDebut, LocalTime heur duree = (int) Duration.between(heureDebut, heureFin).toMinutes(); } + /** + * Permet de creer un objet Cours a partir d'un VEVENT + * + * @param vEvent + * @since 1.0 + */ public Cours(Component vEvent) { Property summary = vEvent.getProperty(Property.SUMMARY); Property description = vEvent.getProperty(Property.DESCRIPTION); @@ -64,6 +70,13 @@ public Cours(Component vEvent) { duree = (int) Duration.between(heureDebut, heureFin).toMinutes(); } + /** + * Permet d'obtenir le(s) professeur(s) d'un VENVENT a partir de la description de ce dernier + * + * @param desc description du VENVENT + * @return le(s) professeur(s) du present dans la description + * @since 1.0 + */ public static String[] getProfFromDesc(String desc) { String regex = "(?<=\\n)[- A-Z]* [- A-Z]*(?=\\n)"; Matcher m = Pattern.compile(regex).matcher(desc); @@ -138,7 +151,7 @@ public String getIntitule() { /* * (non-Javadoc) - * + * * @see java.lang.Object#hashCode() */ @@ -159,50 +172,34 @@ public int hashCode() { /* * (non-Javadoc) - * + * * @see java.lang.Object#equals(java.lang.Object) */ @Override public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; + if (this == obj) return true; + if (obj == null) return false; + if (getClass() != obj.getClass()) return false; Cours other = (Cours) obj; if (date == null) { - if (other.date != null) - return false; - } else if (!date.equals(other.date)) - return false; - if (duree != other.duree) - return false; - if (groupe != other.groupe) - return false; + if (other.date != null) return false; + } else if (!date.equals(other.date)) return false; + if (duree != other.duree) return false; + if (groupe != other.groupe) return false; if (heureDebut == null) { - if (other.heureDebut != null) - return false; - } else if (!heureDebut.equals(other.heureDebut)) - return false; + if (other.heureDebut != null) return false; + } else if (!heureDebut.equals(other.heureDebut)) return false; if (heureFin == null) { - if (other.heureFin != null) - return false; - } else if (!heureFin.equals(other.heureFin)) - return false; + if (other.heureFin != null) return false; + } else if (!heureFin.equals(other.heureFin)) return false; if (intitule == null) { - if (other.intitule != null) - return false; - } else if (!intitule.equals(other.intitule)) - return false; + if (other.intitule != null) return false; + } else if (!intitule.equals(other.intitule)) return false; if (lieu == null) { - if (other.lieu != null) - return false; - } else if (!lieu.equals(other.lieu)) - return false; - if (!Arrays.equals(prof, other.prof)) - return false; + if (other.lieu != null) return false; + } else if (!lieu.equals(other.lieu)) return false; + if (!Arrays.equals(prof, other.prof)) return false; return true; } } diff --git a/src/main/java/edt/umontp/fr/EmploiDuTemps.java b/src/main/java/edt/umontp/fr/EmploiDuTemps.java index 194e6a9..5ea6c77 100644 --- a/src/main/java/edt/umontp/fr/EmploiDuTemps.java +++ b/src/main/java/edt/umontp/fr/EmploiDuTemps.java @@ -17,10 +17,17 @@ import net.fortuna.ical4j.model.Component; public class EmploiDuTemps implements InterfaceEmploiDuTemps { - private final String LIEN_ICAL = "https://proseconsult.umontpellier.fr/jsp/custom/modules/plannings/direct_cal.jsp?data=58c99062bab31d256bee14356aca3f2423c0f022cb9660eba051b2653be722c431b66c493702208e664667048bc04373dc5c094f7d1a811b903031bde802c7f59b21846d3c6254443d7b6e956d3145c6e0d5bac87b70fdd185b8b86771d71211a02411e8351020815cfb0dcc54c667187353dbcfc377b44753a4f433d4e51f753c2b0fc0eafdcbc1cbb6ef4e715ebea9d495758b595b12cb294e70e715876fbaa3c654023c76f43cd51442775ff171e0a5f21b50c55a5b52d94df3e7977af823a1e78ee86c6497b1cf8732d52143eeffacc27449fc13ec1f0b04d23e09712df15579474e1aa0cd65f50f33a1dd766301,1"; + private final String LIEN_ICAL = + "https://proseconsult.umontpellier.fr/jsp/custom/modules/plannings/direct_cal" + ".jsp?data" + + "=58c99062bab31d256bee14356aca3f2423c0f022cb9660eba051b2653be722c431b66c493702208e664667048bc04373dc5c094f7d1a811b903031bde802c7f59b21846d3c6254443d7b6e956d3145c6e0d5bac87b70fdd185b8b86771d71211a02411e8351020815cfb0dcc54c667187353dbcfc377b44753a4f433d4e51f753c2b0fc0eafdcbc1cbb6ef4e715ebea9d495758b595b12cb294e70e715876fbaa3c654023c76f43cd51442775ff171e0a5f21b50c55a5b52d94df3e7977af823a1e78ee86c6497b1cf8732d52143eeffacc27449fc13ec1f0b04d23e09712df15579474e1aa0cd65f50f33a1dd766301,1"; private static EmploiDuTemps singleton = null; private Planning planningEmploisDuTemps; + /** + * Permet mettre a jour l'emploi du temps + * + * @since 1.0 + */ private EmploiDuTemps() { actualiser(); } @@ -38,6 +45,13 @@ public static EmploiDuTemps getInstance() { return localInstance; } + /** + * Permet d'obtenir un objet calendar a parti d'un fichier ics + * + * @param fichierIcs fichier ics source + * @return objet calendar corespondant + * @since 1.0 + */ private Calendar convertieFichierIcsEnCalendar(File fichierIcs) { Calendar calendar = null; try (FileInputStream fileICS = new FileInputStream(fichierIcs)) { @@ -53,6 +67,12 @@ private Calendar convertieFichierIcsEnCalendar(File fichierIcs) { return calendar; } + /** + * Permet d'obtenir un fichier ics correspondant a un lien iCal (ici lien iCal = {@link #LIEN_ICAL} + * + * @return fichier ics correspondant + * @since 1.0 + */ private File getFichierIcsDepuisLienIcal() { File fichierIcs = new File("fichier.ics"); if (fichierIcs.isFile()) { diff --git a/src/main/java/edt/umontp/fr/Groupe.java b/src/main/java/edt/umontp/fr/Groupe.java index 05faf36..48a40f7 100644 --- a/src/main/java/edt/umontp/fr/Groupe.java +++ b/src/main/java/edt/umontp/fr/Groupe.java @@ -23,6 +23,7 @@ public enum Groupe { G4("G4", A2); private static final String REGEX; + static { Groupe[] groupes = values(); String[] strings = new String[groupes.length]; @@ -58,12 +59,18 @@ public String getIntitule() { return intitule; } + /** + * Permet d'obtenir le(s) groupe(s) d'enseignement a partir d'un texte (dans le cadre de cette API a partir de la + * description d'un VEVENT) + * + * @param texte texte source (ici description) + * @return groupe(s) correspondant + * @since 1.0 + */ public static Groupe getGroupeDepuisTexte(String texte) { final Matcher m = Pattern.compile(REGEX).matcher(texte); - if (m.find()) - return valueOf(m.group(0)); - else - return Groupe.NULL; + if (m.find()) return valueOf(m.group(0)); + else return Groupe.NULL; } private boolean possedeGroupeParent() { diff --git a/src/main/java/edt/umontp/fr/Planifiable.java b/src/main/java/edt/umontp/fr/Planifiable.java index 15fe713..4d1e3e1 100644 --- a/src/main/java/edt/umontp/fr/Planifiable.java +++ b/src/main/java/edt/umontp/fr/Planifiable.java @@ -3,10 +3,32 @@ import java.time.LocalDate; interface Planifiable { + /** + * Permet d'obtenir le planning correspondant a une date + * + * @param date date pour laquelle on veut obtenir le planning + * @return planning corresspndant + * @since 1.0 + */ public Planning getPlanningOf(LocalDate date); + /** + * Permet d'obtenir le planning correspondant a une date et un groupe + * + * @param date date dont on veut obtenir le planning + * @param groupe groupe dont on veut obtenir le planning + * @return planning correspondant + * @since 1.0 + */ public Planning getPlanningOf(LocalDate date, Groupe groupe); + /** + * Permet d'obtenir le planning correspondant a un groupe + * + * @param groupe groupe dont on veut obtenir le planning + * @return planning correspondant + * @since 1.0 + */ public Planning getPlanningOf(Groupe groupe); } From 2249bfdcc8699a4a2809ed57cc5a7762f12c2cde Mon Sep 17 00:00:00 2001 From: MathieuSoysal Date: Tue, 19 Jan 2021 11:28:36 +0100 Subject: [PATCH 065/111] =?UTF-8?q?=E2=9C=85=20Ajout=20tests=20valid=C3=A9?= =?UTF-8?q?s=20EMploiDuTempsTest?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/edt/umontp/fr/EmploiDuTempsTest.java | 24 +++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/src/test/java/edt/umontp/fr/EmploiDuTempsTest.java b/src/test/java/edt/umontp/fr/EmploiDuTempsTest.java index 23e8f44..ab53471 100644 --- a/src/test/java/edt/umontp/fr/EmploiDuTempsTest.java +++ b/src/test/java/edt/umontp/fr/EmploiDuTempsTest.java @@ -1,14 +1,34 @@ package edt.umontp.fr; import static org.junit.jupiter.api.Assertions.assertAll; +import static org.junit.jupiter.api.Assertions.assertTrue; + +import java.time.LocalDate; import org.junit.jupiter.api.Test; class EmploiDuTempsTest { @Test - void test_actualiser_verifierRetourneAucuneErreur() { + void test_getInstance_verifierRetourneAucuneErreur() { + assertAll(() -> EmploiDuTemps.getInstance()); + } + + @Test + void test_getPlanningOf_date_verifierRetourneAucuneErreur() { + EmploiDuTemps emploiDuTemps = EmploiDuTemps.getInstance(); + assertAll(() -> emploiDuTemps.getPlanningOf(LocalDate.now())); + } + + @Test + void test_getPlanningOf_groupe_verifierRetourneAucuneErreur() { + EmploiDuTemps emploiDuTemps = EmploiDuTemps.getInstance(); + assertAll(() -> emploiDuTemps.getPlanningOf(Groupe.A1)); + } + + @Test + void test_getPlanningOf_groupe_verifierRetournePasDeListeVide() { EmploiDuTemps emploiDuTemps = EmploiDuTemps.getInstance(); - assertAll(() -> emploiDuTemps.actualiser()); + assertTrue(emploiDuTemps.getPlanningOf(Groupe.A1).iterator().hasNext()); } } From 53c537d3c03a7510d42118b96ab5573a36e8b14b Mon Sep 17 00:00:00 2001 From: emerick-biron Date: Tue, 19 Jan 2021 11:38:42 +0100 Subject: [PATCH 066/111] :memo: add and update javadoc --- src/main/java/edt/umontp/fr/Cours.java | 7 +++++++ .../java/edt/umontp/fr/EmploiDuTemps.java | 7 +++++++ .../edt/umontp/fr/EmploiDuTempsProxy.java | 19 +++++++++++-------- src/main/java/edt/umontp/fr/Groupe.java | 7 +++++++ .../edt/umontp/fr/InterfaceEmploiDuTemps.java | 7 +++++++ src/main/java/edt/umontp/fr/Planifiable.java | 6 ++++++ src/main/java/edt/umontp/fr/Planning.java | 8 ++++++++ 7 files changed, 53 insertions(+), 8 deletions(-) diff --git a/src/main/java/edt/umontp/fr/Cours.java b/src/main/java/edt/umontp/fr/Cours.java index 63428bc..49f033b 100644 --- a/src/main/java/edt/umontp/fr/Cours.java +++ b/src/main/java/edt/umontp/fr/Cours.java @@ -15,6 +15,13 @@ import net.fortuna.ical4j.model.DateTime; import net.fortuna.ical4j.model.Property; +/** + * Cours est la classe qui gère les cours d'un planning + * + * @author emerick-biron, MathieuSoysal + * @version 1.0 + * @see Comparable + */ public class Cours implements Comparable { private final ZoneId ZONE_ID = ZoneId.of("Europe/Paris"); private LocalDate date; diff --git a/src/main/java/edt/umontp/fr/EmploiDuTemps.java b/src/main/java/edt/umontp/fr/EmploiDuTemps.java index 5ea6c77..a176037 100644 --- a/src/main/java/edt/umontp/fr/EmploiDuTemps.java +++ b/src/main/java/edt/umontp/fr/EmploiDuTemps.java @@ -16,6 +16,13 @@ import net.fortuna.ical4j.model.Calendar; import net.fortuna.ical4j.model.Component; +/** + * EmploisDuTemps est la classe qui permet de gérer un emploi du temps + * + * @author emerick-biron, MathieuSoysal + * @version 1.0 + * @see InterfaceEmploiDuTemps + */ public class EmploiDuTemps implements InterfaceEmploiDuTemps { private final String LIEN_ICAL = "https://proseconsult.umontpellier.fr/jsp/custom/modules/plannings/direct_cal" + ".jsp?data" + diff --git a/src/main/java/edt/umontp/fr/EmploiDuTempsProxy.java b/src/main/java/edt/umontp/fr/EmploiDuTempsProxy.java index a72d28c..6d7e560 100644 --- a/src/main/java/edt/umontp/fr/EmploiDuTempsProxy.java +++ b/src/main/java/edt/umontp/fr/EmploiDuTempsProxy.java @@ -6,6 +6,13 @@ // FIXME à tester ! +/** + * EmploiDuTempsProxy est un classe qui permet de proposer un proxy pour l'emploi du temps + * + * @author emerick-biron, MathieuSoysal + * @version 1.0 + * @see InterfaceEmploiDuTemps + */ public class EmploiDuTempsProxy implements InterfaceEmploiDuTemps { private static EmploiDuTempsProxy singleton = null; private EmploiDuTemps emploiDuTemps; @@ -65,17 +72,13 @@ public MultiKey(K1 key1, K2 key2) { @Override public boolean equals(Object o) { - if (this == o) - return true; - if (o == null || getClass() != o.getClass()) - return false; + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; MultiKey key = (MultiKey) o; - if (key1 != null ? !key1.equals(key.key1) : key.key1 != null) - return false; - if (key2 != null ? !key2.equals(key.key2) : key.key2 != null) - return false; + if (key1 != null ? !key1.equals(key.key1) : key.key1 != null) return false; + if (key2 != null ? !key2.equals(key.key2) : key.key2 != null) return false; return true; } diff --git a/src/main/java/edt/umontp/fr/Groupe.java b/src/main/java/edt/umontp/fr/Groupe.java index 48a40f7..3c48620 100644 --- a/src/main/java/edt/umontp/fr/Groupe.java +++ b/src/main/java/edt/umontp/fr/Groupe.java @@ -3,6 +3,13 @@ import java.util.regex.Matcher; import java.util.regex.Pattern; +/** + * Groupe est une enumeration qui permet de recenser les différents groupes d'enseignements pour lesquelles l'API est + * proposée + * + * @author emerick-biron, MathieuSoysal + * @version 1.0 + */ public enum Groupe { NULL("sans groupe"), // Gérer les exceptions A1("A1"), // première année dep info diff --git a/src/main/java/edt/umontp/fr/InterfaceEmploiDuTemps.java b/src/main/java/edt/umontp/fr/InterfaceEmploiDuTemps.java index 3f36f8b..a950c08 100644 --- a/src/main/java/edt/umontp/fr/InterfaceEmploiDuTemps.java +++ b/src/main/java/edt/umontp/fr/InterfaceEmploiDuTemps.java @@ -1,5 +1,12 @@ package edt.umontp.fr; +/** + * InterfaceEmploisDuTemps est un interface proposant des méthodes pour un emploi du temps + * + * @author emerick-biron, MathieuSoysal + * @version 1.0 + * @see Planifiable + */ interface InterfaceEmploiDuTemps extends Planifiable { public void actualiser(); } diff --git a/src/main/java/edt/umontp/fr/Planifiable.java b/src/main/java/edt/umontp/fr/Planifiable.java index 4d1e3e1..09ef4a3 100644 --- a/src/main/java/edt/umontp/fr/Planifiable.java +++ b/src/main/java/edt/umontp/fr/Planifiable.java @@ -2,6 +2,12 @@ import java.time.LocalDate; +/** + * Planifiable est une interface proposant des méthodes pour gérer un emploi du temps + * + * @author emerick-biron, MathieuSoysal + * @version 1.0 + */ interface Planifiable { /** * Permet d'obtenir le planning correspondant a une date diff --git a/src/main/java/edt/umontp/fr/Planning.java b/src/main/java/edt/umontp/fr/Planning.java index 02dac9a..6ec4e36 100644 --- a/src/main/java/edt/umontp/fr/Planning.java +++ b/src/main/java/edt/umontp/fr/Planning.java @@ -14,6 +14,14 @@ import edu.emory.mathcs.backport.java.util.Collections; import edu.emory.mathcs.backport.java.util.TreeSet; +/** + * Planning est un classe permettant de gérer un planning + * + * @author emerick-biron, MathieuSoysal + * @version 1.0 + * @see Planifiable + * @see Iterable + */ public class Planning implements Iterable, Planifiable { private SortedSet cours; From 8114cf791148fe59b36558a792b918075470d3d3 Mon Sep 17 00:00:00 2001 From: MathieuSoysal Date: Tue, 19 Jan 2021 11:41:12 +0100 Subject: [PATCH 067/111] =?UTF-8?q?=E2=9A=A1=20Optimisation=20getPlanningO?= =?UTF-8?q?f=20LocalDate=20Planning?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/edt/umontp/fr/Planning.java | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/src/main/java/edt/umontp/fr/Planning.java b/src/main/java/edt/umontp/fr/Planning.java index 0be0b05..647248c 100644 --- a/src/main/java/edt/umontp/fr/Planning.java +++ b/src/main/java/edt/umontp/fr/Planning.java @@ -4,14 +4,11 @@ import java.util.ArrayList; import java.util.Collection; import java.util.Iterator; -import java.util.LinkedList; -import java.util.Queue; import java.util.SortedSet; import java.util.Spliterator; import java.util.function.Consumer; import java.util.stream.Collectors; -import edu.emory.mathcs.backport.java.util.Collections; import edu.emory.mathcs.backport.java.util.TreeSet; public class Planning implements Iterable, Planifiable { @@ -39,13 +36,17 @@ public Spliterator spliterator() { @Override public Planning getPlanningOf(LocalDate date) { ArrayList result = new ArrayList<>(); - LocalDate lastDate = ((Cours) Collections.max(cours)).getDate(); + LocalDate lastDate = cours.last().getDate(); if (!lastDate.isBefore(date)) { - Queue coursTrie = new LinkedList<>(cours); - while (coursTrie.peek().getDate().isBefore(date)) - coursTrie.poll(); - while (!coursTrie.isEmpty() && coursTrie.peek().getDate().isEqual(date)) - result.add(coursTrie.poll()); + for (Cours c : cours) { + int compare = c.getDate().compareTo(date); + if (compare < 0) + continue; + if (compare == 0) + result.add(c); + else + return new Planning(result); + } } return new Planning(result); } From 9ba03c93cd180ec1643f05af5f62410a8788efbd Mon Sep 17 00:00:00 2001 From: emerick-biron Date: Tue, 19 Jan 2021 12:28:08 +0100 Subject: [PATCH 068/111] :hammer: add toString Cours et Planning --- src/main/java/edt/umontp/fr/Cours.java | 61 ++++++++++------------- src/main/java/edt/umontp/fr/Planning.java | 15 ++++-- 2 files changed, 37 insertions(+), 39 deletions(-) diff --git a/src/main/java/edt/umontp/fr/Cours.java b/src/main/java/edt/umontp/fr/Cours.java index 22960ae..50fdf18 100644 --- a/src/main/java/edt/umontp/fr/Cours.java +++ b/src/main/java/edt/umontp/fr/Cours.java @@ -8,6 +8,7 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.List; +import java.util.Locale; import java.util.regex.Matcher; import java.util.regex.Pattern; @@ -27,7 +28,7 @@ public class Cours implements Comparable { private String intitule; public Cours(LocalDate date, String[] prof, LocalTime heureDebut, LocalTime heureFin, String lieu, Groupe groupe, - String intitule) { + String intitule) { this.date = date; this.prof = prof; this.heureDebut = heureDebut; @@ -138,7 +139,7 @@ public String getIntitule() { /* * (non-Javadoc) - * + * * @see java.lang.Object#hashCode() */ @@ -157,52 +158,42 @@ public int hashCode() { return result; } + @Override + public String toString() { + return intitule.toUpperCase(Locale.ROOT) + " :\n" + date + "\n" + heureDebut + "-" + heureFin + "\n" + + Arrays.toString(prof) + "\n" + lieu + "\n" + groupe; + } + /* * (non-Javadoc) - * + * * @see java.lang.Object#equals(java.lang.Object) */ @Override public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; + if (this == obj) return true; + if (obj == null) return false; + if (getClass() != obj.getClass()) return false; Cours other = (Cours) obj; if (date == null) { - if (other.date != null) - return false; - } else if (!date.equals(other.date)) - return false; - if (duree != other.duree) - return false; - if (groupe != other.groupe) - return false; + if (other.date != null) return false; + } else if (!date.equals(other.date)) return false; + if (duree != other.duree) return false; + if (groupe != other.groupe) return false; if (heureDebut == null) { - if (other.heureDebut != null) - return false; - } else if (!heureDebut.equals(other.heureDebut)) - return false; + if (other.heureDebut != null) return false; + } else if (!heureDebut.equals(other.heureDebut)) return false; if (heureFin == null) { - if (other.heureFin != null) - return false; - } else if (!heureFin.equals(other.heureFin)) - return false; + if (other.heureFin != null) return false; + } else if (!heureFin.equals(other.heureFin)) return false; if (intitule == null) { - if (other.intitule != null) - return false; - } else if (!intitule.equals(other.intitule)) - return false; + if (other.intitule != null) return false; + } else if (!intitule.equals(other.intitule)) return false; if (lieu == null) { - if (other.lieu != null) - return false; - } else if (!lieu.equals(other.lieu)) - return false; - if (!Arrays.equals(prof, other.prof)) - return false; + if (other.lieu != null) return false; + } else if (!lieu.equals(other.lieu)) return false; + if (!Arrays.equals(prof, other.prof)) return false; return true; } } diff --git a/src/main/java/edt/umontp/fr/Planning.java b/src/main/java/edt/umontp/fr/Planning.java index 02dac9a..9cef074 100644 --- a/src/main/java/edt/umontp/fr/Planning.java +++ b/src/main/java/edt/umontp/fr/Planning.java @@ -36,16 +36,23 @@ public Spliterator spliterator() { return cours.spliterator(); } + @Override + public String toString() { + String res = "EDT :\n\n"; + for (Cours c : cours) { + res += c.toString() + "\n\n"; + } + return res; + } + @Override public Planning getPlanningOf(LocalDate date) { ArrayList result = new ArrayList<>(); LocalDate lastDate = ((Cours) Collections.max(cours)).getDate(); if (!lastDate.isBefore(date)) { Queue coursTrie = new LinkedList<>(cours); - while (coursTrie.peek().getDate().isBefore(date)) - coursTrie.poll(); - while (!coursTrie.isEmpty() && coursTrie.peek().getDate().isEqual(date)) - result.add(coursTrie.poll()); + while (coursTrie.peek().getDate().isBefore(date)) coursTrie.poll(); + while (!coursTrie.isEmpty() && coursTrie.peek().getDate().isEqual(date)) result.add(coursTrie.poll()); } return new Planning(result); } From 84afb532bcc31f4652f527fdbf81bb4c095f57c5 Mon Sep 17 00:00:00 2001 From: MathieuSoysal Date: Tue, 19 Jan 2021 12:40:48 +0100 Subject: [PATCH 069/111] =?UTF-8?q?=E2=9C=85=20Ajout=20test=20non-valid?= =?UTF-8?q?=C3=A9=20Planning?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/edt/umontp/fr/Cours.java | 1 + src/main/java/edt/umontp/fr/Planning.java | 7 +++++++ src/test/java/edt/umontp/fr/PlanningTest.java | 9 +++++++++ 3 files changed, 17 insertions(+) diff --git a/src/main/java/edt/umontp/fr/Cours.java b/src/main/java/edt/umontp/fr/Cours.java index 22960ae..e7f8724 100644 --- a/src/main/java/edt/umontp/fr/Cours.java +++ b/src/main/java/edt/umontp/fr/Cours.java @@ -155,6 +155,7 @@ public int hashCode() { result = prime * result + ((lieu == null) ? 0 : lieu.hashCode()); result = prime * result + Arrays.hashCode(prof); return result; + // TODO Améliorer la performance utiliser } /* diff --git a/src/main/java/edt/umontp/fr/Planning.java b/src/main/java/edt/umontp/fr/Planning.java index 647248c..c688cce 100644 --- a/src/main/java/edt/umontp/fr/Planning.java +++ b/src/main/java/edt/umontp/fr/Planning.java @@ -61,4 +61,11 @@ public Planning getPlanningOf(Groupe groupe) { return new Planning( cours.stream().filter(x -> x.getGroupe().estContenuDans(groupe)).collect(Collectors.toList())); } + + /** + * @return the cours + */ + SortedSet getCours() { + return cours; + } } diff --git a/src/test/java/edt/umontp/fr/PlanningTest.java b/src/test/java/edt/umontp/fr/PlanningTest.java index 00c7e19..8a8bc3f 100644 --- a/src/test/java/edt/umontp/fr/PlanningTest.java +++ b/src/test/java/edt/umontp/fr/PlanningTest.java @@ -8,6 +8,7 @@ import java.time.LocalDate; import java.time.LocalTime; import java.util.ArrayList; +import java.util.Iterator; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; @@ -67,4 +68,12 @@ void test_getPlanningOf_date_and_groupe() { assertEquals(cours2, planning.getPlanningOf(cours2.getDate(), cours2.getGroupe()).iterator().next()); } + @Test + void test_constructeur_Planning_casPlusieursCoursCommenceEnMemeTemps_neDoitSupprimerAucunCours() { + coursEnsemble.add(new Cours(LocalDate.of(2021, 1, 21), new String[] { "prof" }, LocalTime.of(14, 30), + LocalTime.of(15, 30), "K133", Groupe.S4, "Compta4")); + planning = new Planning(coursEnsemble); + assertEquals(coursEnsemble.size(), planning.getCours().size()); + } + } From c7c030afffcbe86976cad88a0a9b8ff7b2af7c28 Mon Sep 17 00:00:00 2001 From: MathieuSoysal Date: Tue, 19 Jan 2021 13:09:46 +0100 Subject: [PATCH 070/111] =?UTF-8?q?=E2=9C=85=20Ajout=20tests=20valid=C3=A9?= =?UTF-8?q?s=20CoursTest?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/test/java/edt/umontp/fr/CoursTest.java | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/test/java/edt/umontp/fr/CoursTest.java b/src/test/java/edt/umontp/fr/CoursTest.java index 4af7cb3..4f4cc66 100644 --- a/src/test/java/edt/umontp/fr/CoursTest.java +++ b/src/test/java/edt/umontp/fr/CoursTest.java @@ -2,6 +2,8 @@ import static org.junit.jupiter.api.Assertions.assertAll; import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNotEquals; import java.text.ParseException; import java.time.LocalDate; @@ -184,4 +186,22 @@ private static Stream genererArgumentsPourtestCompareTo_avecHeure() { Groupe.S1, "Compta1"), 1)); } + + @Test + void test_equals() { + Cours cours1 = new Cours(LocalDate.of(2021, 1, 21), new String[] { "prof" }, LocalTime.of(14, 30), + LocalTime.of(15, 30), "K133", Groupe.S4, "Compta4"); + Cours cours2 = new Cours(LocalDate.of(2021, 1, 21), new String[] { "prof" }, LocalTime.of(14, 30), + LocalTime.of(15, 30), "K133", Groupe.S3, "Compta4"); + assertFalse(cours1.equals(cours2)); + } + + @Test + void test_hashcode() { + Cours cours1 = new Cours(LocalDate.of(2021, 1, 21), new String[] { "prof" }, LocalTime.of(14, 30), + LocalTime.of(15, 30), "K133", Groupe.S4, "Compta4"); + Cours cours2 = new Cours(LocalDate.of(2021, 1, 21), new String[] { "prof" }, LocalTime.of(14, 30), + LocalTime.of(15, 30), "K133", Groupe.S3, "Compta4"); + assertNotEquals(cours1.hashCode(), cours2.hashCode()); + } } \ No newline at end of file From 196b892aaafb9c06d9d4c1a5ec1d8cfd8d978771 Mon Sep 17 00:00:00 2001 From: MathieuSoysal Date: Tue, 19 Jan 2021 14:51:01 +0100 Subject: [PATCH 071/111] =?UTF-8?q?=F0=9F=94=A8=20Validation=20tests=20Pla?= =?UTF-8?q?nningTest?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/edt/umontp/fr/Cours.java | 79 +++++++++++-------- src/main/java/edt/umontp/fr/Planning.java | 2 +- src/test/java/edt/umontp/fr/PlanningTest.java | 2 + 3 files changed, 48 insertions(+), 35 deletions(-) diff --git a/src/main/java/edt/umontp/fr/Cours.java b/src/main/java/edt/umontp/fr/Cours.java index eeb618b..b6a9204 100644 --- a/src/main/java/edt/umontp/fr/Cours.java +++ b/src/main/java/edt/umontp/fr/Cours.java @@ -28,7 +28,7 @@ public class Cours implements Comparable { private String intitule; public Cours(LocalDate date, String[] prof, LocalTime heureDebut, LocalTime heureFin, String lieu, Groupe groupe, - String intitule) { + String intitule) { this.date = date; this.prof = prof; this.heureDebut = heureDebut; @@ -77,8 +77,19 @@ public static String[] getProfFromDesc(String desc) { @Override public int compareTo(Cours o) { - int compareDate = date.compareTo(o.date); - return compareDate != 0 ? compareDate : heureDebut.compareTo(o.heureDebut); + int result = date.compareTo(o.date); + if (result != 0) + return result; + result = heureDebut.compareTo(o.heureDebut); + if (result != 0) + return result; + result = Integer.compare(duree, o.duree); + if (result != 0) + return result; + result = groupe.getIntitule().compareTo(o.groupe.getIntitule()); + if (result != 0) + return result; + return intitule.compareTo(o.intitule); } /** @@ -137,9 +148,17 @@ public String getIntitule() { return intitule; } + // TODO Améliorer la performance utiliser + + @Override + public String toString() { + return intitule.toUpperCase(Locale.ROOT) + " :\n" + date + "\n" + heureDebut + "-" + heureFin + "\n" + + Arrays.toString(prof) + "\n" + lieu + "\n" + groupe; + } + /* * (non-Javadoc) - * + * * @see java.lang.Object#hashCode() */ @@ -148,53 +167,45 @@ public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((date == null) ? 0 : date.hashCode()); - result = prime * result + duree; result = prime * result + ((groupe == null) ? 0 : groupe.hashCode()); result = prime * result + ((heureDebut == null) ? 0 : heureDebut.hashCode()); - result = prime * result + ((heureFin == null) ? 0 : heureFin.hashCode()); - result = prime * result + ((intitule == null) ? 0 : intitule.hashCode()); result = prime * result + ((lieu == null) ? 0 : lieu.hashCode()); - result = prime * result + Arrays.hashCode(prof); return result; - // TODO Améliorer la performance utiliser - } - - @Override - public String toString() { - return intitule.toUpperCase(Locale.ROOT) + " :\n" + date + "\n" + heureDebut + "-" + heureFin + "\n" + - Arrays.toString(prof) + "\n" + lieu + "\n" + groupe; } /* * (non-Javadoc) - * + * * @see java.lang.Object#equals(java.lang.Object) */ @Override public boolean equals(Object obj) { - if (this == obj) return true; - if (obj == null) return false; - if (getClass() != obj.getClass()) return false; + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; Cours other = (Cours) obj; if (date == null) { - if (other.date != null) return false; - } else if (!date.equals(other.date)) return false; - if (duree != other.duree) return false; - if (groupe != other.groupe) return false; + if (other.date != null) + return false; + } else if (!date.equals(other.date)) + return false; + if (groupe != other.groupe) + return false; if (heureDebut == null) { - if (other.heureDebut != null) return false; - } else if (!heureDebut.equals(other.heureDebut)) return false; - if (heureFin == null) { - if (other.heureFin != null) return false; - } else if (!heureFin.equals(other.heureFin)) return false; - if (intitule == null) { - if (other.intitule != null) return false; - } else if (!intitule.equals(other.intitule)) return false; + if (other.heureDebut != null) + return false; + } else if (!heureDebut.equals(other.heureDebut)) + return false; if (lieu == null) { - if (other.lieu != null) return false; - } else if (!lieu.equals(other.lieu)) return false; - if (!Arrays.equals(prof, other.prof)) return false; + if (other.lieu != null) + return false; + } else if (!lieu.equals(other.lieu)) + return false; return true; } + } diff --git a/src/main/java/edt/umontp/fr/Planning.java b/src/main/java/edt/umontp/fr/Planning.java index 1f9b53b..d2d86e7 100644 --- a/src/main/java/edt/umontp/fr/Planning.java +++ b/src/main/java/edt/umontp/fr/Planning.java @@ -74,7 +74,7 @@ public Planning getPlanningOf(Groupe groupe) { /** * @return the cours */ - SortedSet getCours() { + Collection getCours() { return cours; } } diff --git a/src/test/java/edt/umontp/fr/PlanningTest.java b/src/test/java/edt/umontp/fr/PlanningTest.java index 8a8bc3f..b1c7d5e 100644 --- a/src/test/java/edt/umontp/fr/PlanningTest.java +++ b/src/test/java/edt/umontp/fr/PlanningTest.java @@ -76,4 +76,6 @@ void test_constructeur_Planning_casPlusieursCoursCommenceEnMemeTemps_neDoitSuppr assertEquals(coursEnsemble.size(), planning.getCours().size()); } + // TODO faire un test plus cas où il y a plusiseurs groupe + } From 428a4f21a640a1036239e45301373a1c46fdc7be Mon Sep 17 00:00:00 2001 From: emerick-biron Date: Tue, 19 Jan 2021 14:58:12 +0100 Subject: [PATCH 072/111] :construction: Groupe -> Groupe[] --- src/main/java/edt/umontp/fr/Cours.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/edt/umontp/fr/Cours.java b/src/main/java/edt/umontp/fr/Cours.java index b6a9204..b460c34 100644 --- a/src/main/java/edt/umontp/fr/Cours.java +++ b/src/main/java/edt/umontp/fr/Cours.java @@ -24,10 +24,10 @@ public class Cours implements Comparable { private LocalTime heureFin; private String lieu; private int duree; - private Groupe groupe; + private Groupe[] groupe; private String intitule; - public Cours(LocalDate date, String[] prof, LocalTime heureDebut, LocalTime heureFin, String lieu, Groupe groupe, + public Cours(LocalDate date, String[] prof, LocalTime heureDebut, LocalTime heureFin, String lieu, Groupe[] groupe, String intitule) { this.date = date; this.prof = prof; From f6c67cee526289b36d58a0b9e860817ce953aa8e Mon Sep 17 00:00:00 2001 From: emerick-biron Date: Tue, 19 Jan 2021 14:59:45 +0100 Subject: [PATCH 073/111] :construction: Groupe -> Groupe[] --- src/main/java/edt/umontp/fr/Cours.java | 2 +- src/main/java/edt/umontp/fr/Groupe.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/edt/umontp/fr/Cours.java b/src/main/java/edt/umontp/fr/Cours.java index b460c34..7463f70 100644 --- a/src/main/java/edt/umontp/fr/Cours.java +++ b/src/main/java/edt/umontp/fr/Cours.java @@ -137,7 +137,7 @@ public int getDuree() { /** * @return the groupe */ - public Groupe getGroupe() { + public Groupe[] getGroupe() { return groupe; } diff --git a/src/main/java/edt/umontp/fr/Groupe.java b/src/main/java/edt/umontp/fr/Groupe.java index 05faf36..8f0b1b8 100644 --- a/src/main/java/edt/umontp/fr/Groupe.java +++ b/src/main/java/edt/umontp/fr/Groupe.java @@ -58,7 +58,7 @@ public String getIntitule() { return intitule; } - public static Groupe getGroupeDepuisTexte(String texte) { + public static Groupe[] getGroupeDepuisTexte(String texte) { final Matcher m = Pattern.compile(REGEX).matcher(texte); if (m.find()) return valueOf(m.group(0)); From e06586401db1dbdd1bf1d43dae87ff4e74445a13 Mon Sep 17 00:00:00 2001 From: MathieuSoysal Date: Tue, 19 Jan 2021 15:05:42 +0100 Subject: [PATCH 074/111] =?UTF-8?q?=F0=9F=9A=A7=20Mise=20=C3=A0=20jour=20g?= =?UTF-8?q?etGroupeDepuisTexte=20gestion=20de=20plusieurs=20groupe?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/edt/umontp/fr/Groupe.java | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/main/java/edt/umontp/fr/Groupe.java b/src/main/java/edt/umontp/fr/Groupe.java index 8f0b1b8..a29da1d 100644 --- a/src/main/java/edt/umontp/fr/Groupe.java +++ b/src/main/java/edt/umontp/fr/Groupe.java @@ -1,10 +1,13 @@ package edt.umontp.fr; +import java.security.acl.Group; +import java.util.ArrayList; +import java.util.Collection; import java.util.regex.Matcher; import java.util.regex.Pattern; public enum Groupe { - NULL("sans groupe"), // Gérer les exceptions + NULL("sans groupe"), // Gérer les exceptions TODO à voir si toujours util A1("A1"), // première année dep info S1("S1", A1), // S2("S2", A1), // @@ -60,10 +63,10 @@ public String getIntitule() { public static Groupe[] getGroupeDepuisTexte(String texte) { final Matcher m = Pattern.compile(REGEX).matcher(texte); - if (m.find()) - return valueOf(m.group(0)); - else - return Groupe.NULL; + Collection result = new ArrayList<>(); + while (m.find()) + result.add(valueOf(m.group(0))); + return result.toArray(Groupe[]::new); } private boolean possedeGroupeParent() { From ba076edaf2562538ae09666a5b1c2d572b053ecc Mon Sep 17 00:00:00 2001 From: emerick-biron Date: Tue, 19 Jan 2021 15:06:02 +0100 Subject: [PATCH 075/111] :construction: Groupe -> Groupe[] --- src/test/java/edt/umontp/fr/CoursTest.java | 40 +++++++++++----------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/src/test/java/edt/umontp/fr/CoursTest.java b/src/test/java/edt/umontp/fr/CoursTest.java index 4f4cc66..c06e238 100644 --- a/src/test/java/edt/umontp/fr/CoursTest.java +++ b/src/test/java/edt/umontp/fr/CoursTest.java @@ -120,25 +120,25 @@ void testCompareTo_avecDate(Cours cours1, Cours cours2, int excepted) { private static Stream genererArgumentsPourtestCompareTo_avecDate() { return Stream.of(// Arguments.of(new Cours(LocalDate.of(2021, 1, 20), new String[] { "prof" }, - LocalTime.of(13, 30), LocalTime.of(14, 30), "K133", Groupe.S1, + LocalTime.of(13, 30), LocalTime.of(14, 30), "K133", new Groupe[]{Groupe.S1}, "Compta1"), new Cours(LocalDate.of(2021, 1, 20), new String[] { "prof" }, LocalTime.of(13, 30), LocalTime.of(14, 30), "K133", - Groupe.S1, "Compta1"), + new Groupe[]{Groupe.S1}, "Compta1"), 0), // Arguments.of(new Cours(LocalDate.of(2021, 1, 19), new String[] { "prof" }, - LocalTime.of(13, 30), LocalTime.of(14, 30), "K133", Groupe.S1, + LocalTime.of(13, 30), LocalTime.of(14, 30), "K133", new Groupe[]{Groupe.S1}, "Compta1"), new Cours(LocalDate.of(2021, 1, 20), new String[] { "prof" }, LocalTime.of(13, 30), LocalTime.of(14, 30), "K133", - Groupe.S1, "Compta1"), + new Groupe[]{Groupe.S1}, "Compta1"), -1), // Arguments.of(new Cours(LocalDate.of(2021, 1, 21), new String[] { "prof" }, - LocalTime.of(13, 30), LocalTime.of(14, 30), "K133", Groupe.S1, + LocalTime.of(13, 30), LocalTime.of(14, 30), "K133", new Groupe[]{Groupe.S1}, "Compta1"), new Cours(LocalDate.of(2021, 1, 20), new String[] { "prof" }, LocalTime.of(13, 30), LocalTime.of(14, 30), "K133", - Groupe.S1, "Compta1"), + new Groupe[]{Groupe.S1}, "Compta1"), 1)); } @@ -151,57 +151,57 @@ void testCompareTo_avecHeure(Cours cours1, Cours cours2, int excepted) { private static Stream genererArgumentsPourtestCompareTo_avecHeure() { return Stream.of(// Arguments.of(new Cours(LocalDate.of(2021, 1, 20), new String[] { "prof" }, - LocalTime.of(13, 30), LocalTime.of(14, 30), "K133", Groupe.S1, + LocalTime.of(13, 30), LocalTime.of(14, 30), "K133", new Groupe[]{Groupe.S1}, "Compta1"), new Cours(LocalDate.of(2021, 1, 20), new String[] { "prof" }, LocalTime.of(13, 30), LocalTime.of(14, 30), "K133", - Groupe.S1, "Compta1"), + new Groupe[]{Groupe.S1}, "Compta1"), 0), // Arguments.of(new Cours(LocalDate.of(2021, 1, 20), new String[] { "prof" }, - LocalTime.of(12, 30), LocalTime.of(13, 30), "K133", Groupe.S1, + LocalTime.of(12, 30), LocalTime.of(13, 30), "K133", new Groupe[]{Groupe.S1}, "Compta1"), new Cours(LocalDate.of(2021, 1, 20), new String[] { "prof" }, LocalTime.of(13, 30), LocalTime.of(14, 30), "K133", - Groupe.S1, "Compta1"), + new Groupe[]{Groupe.S1}, "Compta1"), -1), // Arguments.of(new Cours(LocalDate.of(2021, 1, 20), new String[] { "prof" }, - LocalTime.of(13, 29), LocalTime.of(13, 30), "K133", Groupe.S1, + LocalTime.of(13, 29), LocalTime.of(13, 30), "K133", new Groupe[]{Groupe.S1}, "Compta1"), new Cours(LocalDate.of(2021, 1, 20), new String[] { "prof" }, LocalTime.of(13, 30), LocalTime.of(14, 30), "K133", - Groupe.S1, "Compta1"), + new Groupe[]{Groupe.S1}, "Compta1"), -1), // Arguments.of(new Cours(LocalDate.of(2021, 1, 20), new String[] { "prof" }, - LocalTime.of(13, 31), LocalTime.of(13, 30), "K133", Groupe.S1, + LocalTime.of(13, 31), LocalTime.of(13, 30), "K133", new Groupe[]{Groupe.S1}, "Compta1"), new Cours(LocalDate.of(2021, 1, 20), new String[] { "prof" }, LocalTime.of(13, 30), LocalTime.of(14, 30), "K133", - Groupe.S1, "Compta1"), + new Groupe[]{Groupe.S1}, "Compta1"), 1), // Arguments.of(new Cours(LocalDate.of(2021, 1, 21), new String[] { "prof" }, - LocalTime.of(14, 30), LocalTime.of(15, 30), "K133", Groupe.S1, + LocalTime.of(14, 30), LocalTime.of(15, 30), "K133", new Groupe[]{Groupe.S1}, "Compta1"), new Cours(LocalDate.of(2021, 1, 20), new String[] { "prof" }, LocalTime.of(13, 30), LocalTime.of(14, 30), "K133", - Groupe.S1, "Compta1"), + new Groupe[]{Groupe.S1}, "Compta1"), 1)); } @Test void test_equals() { Cours cours1 = new Cours(LocalDate.of(2021, 1, 21), new String[] { "prof" }, LocalTime.of(14, 30), - LocalTime.of(15, 30), "K133", Groupe.S4, "Compta4"); + LocalTime.of(15, 30), "K133", new Groupe[]{Groupe.S4}, "Compta4"); Cours cours2 = new Cours(LocalDate.of(2021, 1, 21), new String[] { "prof" }, LocalTime.of(14, 30), - LocalTime.of(15, 30), "K133", Groupe.S3, "Compta4"); + LocalTime.of(15, 30), "K133", new Groupe[]{Groupe.S3}, "Compta4"); assertFalse(cours1.equals(cours2)); } @Test void test_hashcode() { Cours cours1 = new Cours(LocalDate.of(2021, 1, 21), new String[] { "prof" }, LocalTime.of(14, 30), - LocalTime.of(15, 30), "K133", Groupe.S4, "Compta4"); + LocalTime.of(15, 30), "K133", new Groupe[]{Groupe.S4}, "Compta4"); Cours cours2 = new Cours(LocalDate.of(2021, 1, 21), new String[] { "prof" }, LocalTime.of(14, 30), - LocalTime.of(15, 30), "K133", Groupe.S3, "Compta4"); + LocalTime.of(15, 30), "K133", new Groupe[]{Groupe.S3}, "Compta4"); assertNotEquals(cours1.hashCode(), cours2.hashCode()); } } \ No newline at end of file From e526e29719b35a7aee33535e83f3f998077e02de Mon Sep 17 00:00:00 2001 From: emerick-biron Date: Tue, 19 Jan 2021 15:21:31 +0100 Subject: [PATCH 076/111] :construction: Groupe -> Groupe[] --- src/test/java/edt/umontp/fr/PlanningTest.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/test/java/edt/umontp/fr/PlanningTest.java b/src/test/java/edt/umontp/fr/PlanningTest.java index b1c7d5e..faad35c 100644 --- a/src/test/java/edt/umontp/fr/PlanningTest.java +++ b/src/test/java/edt/umontp/fr/PlanningTest.java @@ -20,13 +20,13 @@ class PlanningTest { private ArrayList coursEnsemble; private Cours cours1 = new Cours(LocalDate.of(2021, 1, 20), new String[] { "prof" }, LocalTime.of(13, 30), - LocalTime.of(14, 30), "K133", Groupe.S1, "Compta1"); + LocalTime.of(14, 30), "K133", new Groupe[]{Groupe.S1}, "Compta1"); private Cours cours2 = new Cours(LocalDate.of(2021, 1, 21), new String[] { "prof" }, LocalTime.of(14, 30), - LocalTime.of(15, 30), "K133", Groupe.S3, "Compta2"); + LocalTime.of(15, 30), "K133", new Groupe[]{Groupe.S3}, "Compta2"); private Cours cours3 = new Cours(LocalDate.of(2021, 1, 21), new String[] { "prof" }, LocalTime.of(13, 30), - LocalTime.of(14, 30), "K133", Groupe.S2, "Compta3"); + LocalTime.of(14, 30), "K133", new Groupe[]{Groupe.S2}, "Compta3"); private Cours cours4 = new Cours(LocalDate.of(2021, 1, 22), new String[] { "prof" }, LocalTime.of(11, 30), - LocalTime.of(12, 30), "K133", Groupe.S1, "Compta4"); + LocalTime.of(12, 30), "K133", new Groupe[]{Groupe.S1}, "Compta4"); @BeforeEach void initPlanning() { @@ -65,13 +65,13 @@ void test_getPlanningOf_groupe_groupeComposeVide() { @Test void test_getPlanningOf_date_and_groupe() { assertNotEquals(cours2, planning.getPlanningOf(cours2.getDate()).iterator().next()); - assertEquals(cours2, planning.getPlanningOf(cours2.getDate(), cours2.getGroupe()).iterator().next()); + assertEquals(cours2, planning.getPlanningOf(cours2.getDate(), cours2.getGroupe()[0]).iterator().next()); } @Test void test_constructeur_Planning_casPlusieursCoursCommenceEnMemeTemps_neDoitSupprimerAucunCours() { coursEnsemble.add(new Cours(LocalDate.of(2021, 1, 21), new String[] { "prof" }, LocalTime.of(14, 30), - LocalTime.of(15, 30), "K133", Groupe.S4, "Compta4")); + LocalTime.of(15, 30), "K133", new Groupe[]{Groupe.S4}, "Compta4")); planning = new Planning(coursEnsemble); assertEquals(coursEnsemble.size(), planning.getCours().size()); } From f90d913d1eb1ce5fe72539ab1b0a0d8d20037d67 Mon Sep 17 00:00:00 2001 From: MathieuSoysal Date: Tue, 19 Jan 2021 15:24:15 +0100 Subject: [PATCH 077/111] =?UTF-8?q?=E2=9C=85=20Mise=20=C3=A0=20jour=20test?= =?UTF-8?q?=20CoursTest?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/test/java/edt/umontp/fr/CoursTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/java/edt/umontp/fr/CoursTest.java b/src/test/java/edt/umontp/fr/CoursTest.java index c06e238..1178180 100644 --- a/src/test/java/edt/umontp/fr/CoursTest.java +++ b/src/test/java/edt/umontp/fr/CoursTest.java @@ -79,7 +79,7 @@ void test_constructeur_VEvent_duree_Bon() { @Test void test_constructeur_VEvent_groupe_Bon() { Cours cours = new Cours(component); - assertEquals(Groupe.A2, cours.getGroupe()); + assertEquals(Groupe.A2, cours.getGroupe()[0]); } @Test From a9d774ba0a9e936e7622e2329728ed76447c176a Mon Sep 17 00:00:00 2001 From: MathieuSoysal Date: Tue, 19 Jan 2021 15:24:47 +0100 Subject: [PATCH 078/111] =?UTF-8?q?=F0=9F=94=A8=20Validation=20de=20tous?= =?UTF-8?q?=20les=20tests=20Cours?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/edt/umontp/fr/Cours.java | 28 ++++++++++++++++---------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/src/main/java/edt/umontp/fr/Cours.java b/src/main/java/edt/umontp/fr/Cours.java index 7463f70..65e29af 100644 --- a/src/main/java/edt/umontp/fr/Cours.java +++ b/src/main/java/edt/umontp/fr/Cours.java @@ -24,7 +24,7 @@ public class Cours implements Comparable { private LocalTime heureFin; private String lieu; private int duree; - private Groupe[] groupe; + private Groupe[] groupes; private String intitule; public Cours(LocalDate date, String[] prof, LocalTime heureDebut, LocalTime heureFin, String lieu, Groupe[] groupe, @@ -34,7 +34,7 @@ public Cours(LocalDate date, String[] prof, LocalTime heureDebut, LocalTime heur this.heureDebut = heureDebut; this.heureFin = heureFin; this.lieu = lieu; - this.groupe = groupe; + this.groupes = groupe; this.intitule = intitule; duree = (int) Duration.between(heureDebut, heureFin).toMinutes(); } @@ -61,7 +61,7 @@ public Cours(Component vEvent) { lieu = location.getValue(); intitule = summary.getValue(); prof = getProfFromDesc(description.getValue()); - groupe = Groupe.getGroupeDepuisTexte(description.getValue()); + groupes = Groupe.getGroupeDepuisTexte(description.getValue()); duree = (int) Duration.between(heureDebut, heureFin).toMinutes(); } @@ -86,9 +86,12 @@ public int compareTo(Cours o) { result = Integer.compare(duree, o.duree); if (result != 0) return result; - result = groupe.getIntitule().compareTo(o.groupe.getIntitule()); - if (result != 0) - return result; + for (Groupe groupe : groupes) + for (Groupe autreGroupe : o.groupes) { + result = groupe.getIntitule().compareTo(autreGroupe.getIntitule()); + if (result != 0) + return result; + } return intitule.compareTo(o.intitule); } @@ -138,7 +141,7 @@ public int getDuree() { * @return the groupe */ public Groupe[] getGroupe() { - return groupe; + return groupes; } /** @@ -153,7 +156,7 @@ public String getIntitule() { @Override public String toString() { return intitule.toUpperCase(Locale.ROOT) + " :\n" + date + "\n" + heureDebut + "-" + heureFin + "\n" - + Arrays.toString(prof) + "\n" + lieu + "\n" + groupe; + + Arrays.toString(prof) + "\n" + lieu + "\n" + groupes; } /* @@ -167,7 +170,8 @@ public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((date == null) ? 0 : date.hashCode()); - result = prime * result + ((groupe == null) ? 0 : groupe.hashCode()); + for (Groupe groupe : groupes) + result = prime * result + ((groupe == null) ? 0 : groupe.hashCode()); result = prime * result + ((heureDebut == null) ? 0 : heureDebut.hashCode()); result = prime * result + ((lieu == null) ? 0 : lieu.hashCode()); return result; @@ -193,8 +197,10 @@ public boolean equals(Object obj) { return false; } else if (!date.equals(other.date)) return false; - if (groupe != other.groupe) - return false; + for (Groupe groupe : groupes) + for (Groupe oGroupe : other.groupes) + if (groupe != oGroupe) + return false; if (heureDebut == null) { if (other.heureDebut != null) return false; From 978980dff546d5560d314f481e26bdd4789a6b7d Mon Sep 17 00:00:00 2001 From: emerick-biron Date: Tue, 19 Jan 2021 15:28:43 +0100 Subject: [PATCH 079/111] :construction: supp import java.security.acl.Group; --- src/main/java/edt/umontp/fr/Groupe.java | 1 - 1 file changed, 1 deletion(-) diff --git a/src/main/java/edt/umontp/fr/Groupe.java b/src/main/java/edt/umontp/fr/Groupe.java index a29da1d..443e47a 100644 --- a/src/main/java/edt/umontp/fr/Groupe.java +++ b/src/main/java/edt/umontp/fr/Groupe.java @@ -1,6 +1,5 @@ package edt.umontp.fr; -import java.security.acl.Group; import java.util.ArrayList; import java.util.Collection; import java.util.regex.Matcher; From 1a1a6a634641a4eb3e09fdaf4164ee286cf5279d Mon Sep 17 00:00:00 2001 From: MathieuSoysal Date: Tue, 19 Jan 2021 15:41:00 +0100 Subject: [PATCH 080/111] =?UTF-8?q?=E2=9C=85=20Mise=20=C3=A0=20jours=20tes?= =?UTF-8?q?ts=20GroupeTest?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/test/java/edt/umontp/fr/GroupeTest.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/test/java/edt/umontp/fr/GroupeTest.java b/src/test/java/edt/umontp/fr/GroupeTest.java index 1ce03be..134e9dd 100644 --- a/src/test/java/edt/umontp/fr/GroupeTest.java +++ b/src/test/java/edt/umontp/fr/GroupeTest.java @@ -40,20 +40,20 @@ void valueOf() { void test_getGroupeDepuisTexte_A1Seul_A1() { String desc = "\n\nA1\nGOUAICH ABDELKADER\nLAGUILLAUMIE FABIEN\nPOUPET VICTOR\nROSENFELD MATTHIEU\nA " + "valider\n(Exporté le:18 / 01 / 2 021 10:51)\n"; - assertEquals(Groupe.A1, Groupe.getGroupeDepuisTexte(desc)); + assertEquals(Groupe.A1, Groupe.getGroupeDepuisTexte(desc)[0]); } @Test void test_getGroupeDepuisTexte_A1NonSeul_A1() { String desc = "\n\nA1-Semestre-1\nGOUAICH ABDELKADER\nLAGUILLAUMIE FABIEN\nPOUPET VICTOR\nROSENFELD " + "MATTHIEU\nA valider\n(Exporté le:18/01/2 021 10:51)\n"; - assertEquals(Groupe.A1, Groupe.getGroupeDepuisTexte(desc)); + assertEquals(Groupe.A1, Groupe.getGroupeDepuisTexte(desc)[0]); } @Test void test_getGroupeDepuisTexte_aucunGroupe_GroupeNULL() { String desc = "\n\nSemestre-1\nGOUAICH ABDELKADER\nLAGUILLAUMIE FABIEN\nPOUPET VICTOR\nROSENFELD " + "MATTHIEU\nA valider\n(Exporté le:18/01/2 021 10:51)\n"; - assertEquals(Groupe.NULL, Groupe.getGroupeDepuisTexte(desc)); + assertEquals(0, Groupe.getGroupeDepuisTexte(desc).length); } } From 6d1a109330973e94071709d569f392d6eb696086 Mon Sep 17 00:00:00 2001 From: MathieuSoysal Date: Tue, 19 Jan 2021 15:42:07 +0100 Subject: [PATCH 081/111] =?UTF-8?q?=E2=9C=85=20Mise=20=C3=A0=20jour=20test?= =?UTF-8?q?s=20PlanningTests?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/test/java/edt/umontp/fr/PlanningTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/java/edt/umontp/fr/PlanningTest.java b/src/test/java/edt/umontp/fr/PlanningTest.java index faad35c..91f35ad 100644 --- a/src/test/java/edt/umontp/fr/PlanningTest.java +++ b/src/test/java/edt/umontp/fr/PlanningTest.java @@ -65,7 +65,7 @@ void test_getPlanningOf_groupe_groupeComposeVide() { @Test void test_getPlanningOf_date_and_groupe() { assertNotEquals(cours2, planning.getPlanningOf(cours2.getDate()).iterator().next()); - assertEquals(cours2, planning.getPlanningOf(cours2.getDate(), cours2.getGroupe()[0]).iterator().next()); + assertEquals(cours2, planning.getPlanningOf(cours2.getDate(), cours2.getGroupes()[0]).iterator().next()); } @Test From fc290e6a54ffd9e2416eef095870eba67bab0827 Mon Sep 17 00:00:00 2001 From: MathieuSoysal Date: Tue, 19 Jan 2021 15:43:07 +0100 Subject: [PATCH 082/111] =?UTF-8?q?=E2=9C=85=20Mise=20=C3=A0=20jous=20test?= =?UTF-8?q?s=20CoursTests?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/test/java/edt/umontp/fr/CoursTest.java | 58 +++++++++++----------- 1 file changed, 29 insertions(+), 29 deletions(-) diff --git a/src/test/java/edt/umontp/fr/CoursTest.java b/src/test/java/edt/umontp/fr/CoursTest.java index 1178180..c8dd97a 100644 --- a/src/test/java/edt/umontp/fr/CoursTest.java +++ b/src/test/java/edt/umontp/fr/CoursTest.java @@ -79,7 +79,7 @@ void test_constructeur_VEvent_duree_Bon() { @Test void test_constructeur_VEvent_groupe_Bon() { Cours cours = new Cours(component); - assertEquals(Groupe.A2, cours.getGroupe()[0]); + assertEquals(Groupe.A2, cours.getGroupes()[0]); } @Test @@ -120,25 +120,25 @@ void testCompareTo_avecDate(Cours cours1, Cours cours2, int excepted) { private static Stream genererArgumentsPourtestCompareTo_avecDate() { return Stream.of(// Arguments.of(new Cours(LocalDate.of(2021, 1, 20), new String[] { "prof" }, - LocalTime.of(13, 30), LocalTime.of(14, 30), "K133", new Groupe[]{Groupe.S1}, - "Compta1"), + LocalTime.of(13, 30), LocalTime.of(14, 30), "K133", + new Groupe[] { Groupe.S1 }, "Compta1"), new Cours(LocalDate.of(2021, 1, 20), new String[] { "prof" }, LocalTime.of(13, 30), LocalTime.of(14, 30), "K133", - new Groupe[]{Groupe.S1}, "Compta1"), + new Groupe[] { Groupe.S1 }, "Compta1"), 0), // Arguments.of(new Cours(LocalDate.of(2021, 1, 19), new String[] { "prof" }, - LocalTime.of(13, 30), LocalTime.of(14, 30), "K133", new Groupe[]{Groupe.S1}, - "Compta1"), + LocalTime.of(13, 30), LocalTime.of(14, 30), "K133", + new Groupe[] { Groupe.S1 }, "Compta1"), new Cours(LocalDate.of(2021, 1, 20), new String[] { "prof" }, LocalTime.of(13, 30), LocalTime.of(14, 30), "K133", - new Groupe[]{Groupe.S1}, "Compta1"), + new Groupe[] { Groupe.S1 }, "Compta1"), -1), // Arguments.of(new Cours(LocalDate.of(2021, 1, 21), new String[] { "prof" }, - LocalTime.of(13, 30), LocalTime.of(14, 30), "K133", new Groupe[]{Groupe.S1}, - "Compta1"), + LocalTime.of(13, 30), LocalTime.of(14, 30), "K133", + new Groupe[] { Groupe.S1 }, "Compta1"), new Cours(LocalDate.of(2021, 1, 20), new String[] { "prof" }, LocalTime.of(13, 30), LocalTime.of(14, 30), "K133", - new Groupe[]{Groupe.S1}, "Compta1"), + new Groupe[] { Groupe.S1 }, "Compta1"), 1)); } @@ -151,57 +151,57 @@ void testCompareTo_avecHeure(Cours cours1, Cours cours2, int excepted) { private static Stream genererArgumentsPourtestCompareTo_avecHeure() { return Stream.of(// Arguments.of(new Cours(LocalDate.of(2021, 1, 20), new String[] { "prof" }, - LocalTime.of(13, 30), LocalTime.of(14, 30), "K133", new Groupe[]{Groupe.S1}, - "Compta1"), + LocalTime.of(13, 30), LocalTime.of(14, 30), "K133", + new Groupe[] { Groupe.S1 }, "Compta1"), new Cours(LocalDate.of(2021, 1, 20), new String[] { "prof" }, LocalTime.of(13, 30), LocalTime.of(14, 30), "K133", - new Groupe[]{Groupe.S1}, "Compta1"), + new Groupe[] { Groupe.S1 }, "Compta1"), 0), // Arguments.of(new Cours(LocalDate.of(2021, 1, 20), new String[] { "prof" }, - LocalTime.of(12, 30), LocalTime.of(13, 30), "K133", new Groupe[]{Groupe.S1}, - "Compta1"), + LocalTime.of(12, 30), LocalTime.of(13, 30), "K133", + new Groupe[] { Groupe.S1 }, "Compta1"), new Cours(LocalDate.of(2021, 1, 20), new String[] { "prof" }, LocalTime.of(13, 30), LocalTime.of(14, 30), "K133", - new Groupe[]{Groupe.S1}, "Compta1"), + new Groupe[] { Groupe.S1 }, "Compta1"), -1), // Arguments.of(new Cours(LocalDate.of(2021, 1, 20), new String[] { "prof" }, - LocalTime.of(13, 29), LocalTime.of(13, 30), "K133", new Groupe[]{Groupe.S1}, - "Compta1"), + LocalTime.of(13, 29), LocalTime.of(13, 30), "K133", + new Groupe[] { Groupe.S1 }, "Compta1"), new Cours(LocalDate.of(2021, 1, 20), new String[] { "prof" }, LocalTime.of(13, 30), LocalTime.of(14, 30), "K133", - new Groupe[]{Groupe.S1}, "Compta1"), + new Groupe[] { Groupe.S1 }, "Compta1"), -1), // Arguments.of(new Cours(LocalDate.of(2021, 1, 20), new String[] { "prof" }, - LocalTime.of(13, 31), LocalTime.of(13, 30), "K133", new Groupe[]{Groupe.S1}, - "Compta1"), + LocalTime.of(13, 31), LocalTime.of(13, 30), "K133", + new Groupe[] { Groupe.S1 }, "Compta1"), new Cours(LocalDate.of(2021, 1, 20), new String[] { "prof" }, LocalTime.of(13, 30), LocalTime.of(14, 30), "K133", - new Groupe[]{Groupe.S1}, "Compta1"), + new Groupe[] { Groupe.S1 }, "Compta1"), 1), // Arguments.of(new Cours(LocalDate.of(2021, 1, 21), new String[] { "prof" }, - LocalTime.of(14, 30), LocalTime.of(15, 30), "K133", new Groupe[]{Groupe.S1}, - "Compta1"), + LocalTime.of(14, 30), LocalTime.of(15, 30), "K133", + new Groupe[] { Groupe.S1 }, "Compta1"), new Cours(LocalDate.of(2021, 1, 20), new String[] { "prof" }, LocalTime.of(13, 30), LocalTime.of(14, 30), "K133", - new Groupe[]{Groupe.S1}, "Compta1"), + new Groupe[] { Groupe.S1 }, "Compta1"), 1)); } @Test void test_equals() { Cours cours1 = new Cours(LocalDate.of(2021, 1, 21), new String[] { "prof" }, LocalTime.of(14, 30), - LocalTime.of(15, 30), "K133", new Groupe[]{Groupe.S4}, "Compta4"); + LocalTime.of(15, 30), "K133", new Groupe[] { Groupe.S4 }, "Compta4"); Cours cours2 = new Cours(LocalDate.of(2021, 1, 21), new String[] { "prof" }, LocalTime.of(14, 30), - LocalTime.of(15, 30), "K133", new Groupe[]{Groupe.S3}, "Compta4"); + LocalTime.of(15, 30), "K133", new Groupe[] { Groupe.S3 }, "Compta4"); assertFalse(cours1.equals(cours2)); } @Test void test_hashcode() { Cours cours1 = new Cours(LocalDate.of(2021, 1, 21), new String[] { "prof" }, LocalTime.of(14, 30), - LocalTime.of(15, 30), "K133", new Groupe[]{Groupe.S4}, "Compta4"); + LocalTime.of(15, 30), "K133", new Groupe[] { Groupe.S4 }, "Compta4"); Cours cours2 = new Cours(LocalDate.of(2021, 1, 21), new String[] { "prof" }, LocalTime.of(14, 30), - LocalTime.of(15, 30), "K133", new Groupe[]{Groupe.S3}, "Compta4"); + LocalTime.of(15, 30), "K133", new Groupe[] { Groupe.S3 }, "Compta4"); assertNotEquals(cours1.hashCode(), cours2.hashCode()); } } \ No newline at end of file From ee12573ba2a8c734bf6dfc75e377f24ef701194d Mon Sep 17 00:00:00 2001 From: MathieuSoysal Date: Tue, 19 Jan 2021 15:55:58 +0100 Subject: [PATCH 083/111] =?UTF-8?q?=E2=9C=85=20Ajou=20tests=20non-valid?= =?UTF-8?q?=C3=A9=20PlanningTest?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/test/java/edt/umontp/fr/PlanningTest.java | 46 +++++++++++++++---- 1 file changed, 38 insertions(+), 8 deletions(-) diff --git a/src/test/java/edt/umontp/fr/PlanningTest.java b/src/test/java/edt/umontp/fr/PlanningTest.java index 91f35ad..c52ae4d 100644 --- a/src/test/java/edt/umontp/fr/PlanningTest.java +++ b/src/test/java/edt/umontp/fr/PlanningTest.java @@ -5,14 +5,20 @@ import static org.junit.jupiter.api.Assertions.assertNotEquals; import static org.junit.jupiter.api.Assertions.assertTrue; +import java.text.ParseException; import java.time.LocalDate; import java.time.LocalTime; import java.util.ArrayList; -import java.util.Iterator; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; +import net.fortuna.ical4j.model.Component; +import net.fortuna.ical4j.model.DateTime; +import net.fortuna.ical4j.model.component.VEvent; +import net.fortuna.ical4j.model.property.Description; +import net.fortuna.ical4j.model.property.Location; + class PlanningTest { private Planning planning; @@ -20,13 +26,13 @@ class PlanningTest { private ArrayList coursEnsemble; private Cours cours1 = new Cours(LocalDate.of(2021, 1, 20), new String[] { "prof" }, LocalTime.of(13, 30), - LocalTime.of(14, 30), "K133", new Groupe[]{Groupe.S1}, "Compta1"); + LocalTime.of(14, 30), "K133", new Groupe[] { Groupe.S1 }, "Compta1"); private Cours cours2 = new Cours(LocalDate.of(2021, 1, 21), new String[] { "prof" }, LocalTime.of(14, 30), - LocalTime.of(15, 30), "K133", new Groupe[]{Groupe.S3}, "Compta2"); + LocalTime.of(15, 30), "K133", new Groupe[] { Groupe.S3 }, "Compta2"); private Cours cours3 = new Cours(LocalDate.of(2021, 1, 21), new String[] { "prof" }, LocalTime.of(13, 30), - LocalTime.of(14, 30), "K133", new Groupe[]{Groupe.S2}, "Compta3"); + LocalTime.of(14, 30), "K133", new Groupe[] { Groupe.S2 }, "Compta3"); private Cours cours4 = new Cours(LocalDate.of(2021, 1, 22), new String[] { "prof" }, LocalTime.of(11, 30), - LocalTime.of(12, 30), "K133", new Groupe[]{Groupe.S1}, "Compta4"); + LocalTime.of(12, 30), "K133", new Groupe[] { Groupe.S1 }, "Compta4"); @BeforeEach void initPlanning() { @@ -65,17 +71,41 @@ void test_getPlanningOf_groupe_groupeComposeVide() { @Test void test_getPlanningOf_date_and_groupe() { assertNotEquals(cours2, planning.getPlanningOf(cours2.getDate()).iterator().next()); - assertEquals(cours2, planning.getPlanningOf(cours2.getDate(), cours2.getGroupes()[0]).iterator().next()); + assertEquals(cours2, + planning.getPlanningOf(cours2.getDate(), cours2.getGroupes()[0]).iterator().next()); } @Test void test_constructeur_Planning_casPlusieursCoursCommenceEnMemeTemps_neDoitSupprimerAucunCours() { coursEnsemble.add(new Cours(LocalDate.of(2021, 1, 21), new String[] { "prof" }, LocalTime.of(14, 30), - LocalTime.of(15, 30), "K133", new Groupe[]{Groupe.S4}, "Compta4")); + LocalTime.of(15, 30), "K133", new Groupe[] { Groupe.S4 }, "Compta4")); planning = new Planning(coursEnsemble); assertEquals(coursEnsemble.size(), planning.getCours().size()); } - // TODO faire un test plus cas où il y a plusiseurs groupe + @Test + void test_getPlanningOf_groupe_doitRetournerPlusieursGroupe() { + Component component; + DateTime startTime, endTime; + try { + startTime = new DateTime("20171127T150000"); + endTime = new DateTime("20171127T160000"); + } catch (ParseException pe) { + // yyyymmddTHHmmss is the correct format, but to make the compiler happy... + startTime = new DateTime(); + endTime = startTime; + } + component = new VEvent(startTime, endTime, "intitule"); + component.getProperties().add(new Description( + "\n\nA2-Semestre-3 A1\nBELMECHERI NASSIM\nHAETTEL THOMAS\nLA XUAN HOANG\nCHIROUZE ANNE\nA valider\n(Exporté le:18/01/2021 10:51)\n")); + component.getProperties().add(new Location("K133")); + Cours cours = new Cours(component); + ArrayList coursList = new ArrayList<>(); + coursList.add(cours); + Planning planning = new Planning(coursList); + + assertTrue(planning.getPlanningOf(Groupe.A1).iterator().hasNext()); + assertTrue(planning.getPlanningOf(Groupe.A2).iterator().hasNext()); + } } From cdf893630dc0a54206440dc7cc8da2e1f898e25e Mon Sep 17 00:00:00 2001 From: MathieuSoysal Date: Tue, 19 Jan 2021 16:02:27 +0100 Subject: [PATCH 084/111] =?UTF-8?q?=E2=9C=85=20Ajout=20test=20non-valid?= =?UTF-8?q?=C3=A9=20GroupeTest?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/test/java/edt/umontp/fr/GroupeTest.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/test/java/edt/umontp/fr/GroupeTest.java b/src/test/java/edt/umontp/fr/GroupeTest.java index 134e9dd..c4cc5c4 100644 --- a/src/test/java/edt/umontp/fr/GroupeTest.java +++ b/src/test/java/edt/umontp/fr/GroupeTest.java @@ -52,8 +52,14 @@ void test_getGroupeDepuisTexte_A1NonSeul_A1() { @Test void test_getGroupeDepuisTexte_aucunGroupe_GroupeNULL() { - String desc = "\n\nSemestre-1\nGOUAICH ABDELKADER\nLAGUILLAUMIE FABIEN\nPOUPET VICTOR\nROSENFELD " - + "MATTHIEU\nA valider\n(Exporté le:18/01/2 021 10:51)\n"; + String desc = "\n\nSemestre-1\nGOUAICH ABDELKADER\nLAGUILLAUMIE FABIEN\nPOUPET VICTOR\nROSENFELD MATTHIEU\nA valider\n(Exporté le:18/01/2 021 10:51)\n"; assertEquals(0, Groupe.getGroupeDepuisTexte(desc).length); } + + @Test + void test_getGroupeDepuisTexte_plusieursGroupe_retournPlusieursGroupe() { + String desc = "\n\nA1 & A2 Semestre-1\nGOUAICH ABDELKADER\nLAGUILLAUMIE FABIEN\nPOUPET VICTOR\nROSENFELD MATTHIEU\nA valider\n(Exporté le:18/01/2 021 10:51)\n"; + assertEquals(2, Groupe.getGroupeDepuisTexte(desc).length); + } + } From d8a50d7056004de193b7d36fb99673650ab141dc Mon Sep 17 00:00:00 2001 From: MathieuSoysal Date: Tue, 19 Jan 2021 16:06:17 +0100 Subject: [PATCH 085/111] =?UTF-8?q?=E2=9C=85=20Ajout=20test=20non-valid?= =?UTF-8?q?=C3=A9s=20CoursTest?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/test/java/edt/umontp/fr/CoursTest.java | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/test/java/edt/umontp/fr/CoursTest.java b/src/test/java/edt/umontp/fr/CoursTest.java index c8dd97a..8b06509 100644 --- a/src/test/java/edt/umontp/fr/CoursTest.java +++ b/src/test/java/edt/umontp/fr/CoursTest.java @@ -204,4 +204,26 @@ void test_hashcode() { LocalTime.of(15, 30), "K133", new Groupe[] { Groupe.S3 }, "Compta4"); assertNotEquals(cours1.hashCode(), cours2.hashCode()); } + + @Test + void test_getGroupes_plusieursGroupe_retournTousLesGroupes() { + Component component; + DateTime startTime, endTime; + try { + startTime = new DateTime("20171127T150000"); + endTime = new DateTime("20171127T160000"); + } catch (ParseException pe) { + // yyyymmddTHHmmss is the correct format, but to make the compiler happy... + startTime = new DateTime(); + endTime = startTime; + } + component = new VEvent(startTime, endTime, "intitule"); + component.getProperties().add(new Description( + "\n\nA2-Semestre-3 A1\nBELMECHERI NASSIM\nHAETTEL THOMAS\nLA XUAN HOANG\nCHIROUZE ANNE\nA valider\n(Exporté le:18/01/2021 10:51)\n")); + component.getProperties().add(new Location("K133")); + + Cours cours = new Cours(component); + + assertEquals(2, cours.getGroupes().length); + } } \ No newline at end of file From 7e0f207cc08ab30477886d5b3e1ee29f8c707958 Mon Sep 17 00:00:00 2001 From: MathieuSoysal Date: Tue, 19 Jan 2021 16:07:21 +0100 Subject: [PATCH 086/111] =?UTF-8?q?=F0=9F=94=A8=20Validation=20de=20tous?= =?UTF-8?q?=20les=20test=20!=20=F0=9F=8E=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/edt/umontp/fr/Cours.java | 2 +- src/main/java/edt/umontp/fr/Groupe.java | 6 ++++++ src/main/java/edt/umontp/fr/Planning.java | 4 ++-- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/main/java/edt/umontp/fr/Cours.java b/src/main/java/edt/umontp/fr/Cours.java index 65e29af..92c3586 100644 --- a/src/main/java/edt/umontp/fr/Cours.java +++ b/src/main/java/edt/umontp/fr/Cours.java @@ -140,7 +140,7 @@ public int getDuree() { /** * @return the groupe */ - public Groupe[] getGroupe() { + public Groupe[] getGroupes() { return groupes; } diff --git a/src/main/java/edt/umontp/fr/Groupe.java b/src/main/java/edt/umontp/fr/Groupe.java index a29da1d..c154fce 100644 --- a/src/main/java/edt/umontp/fr/Groupe.java +++ b/src/main/java/edt/umontp/fr/Groupe.java @@ -77,4 +77,10 @@ public boolean estContenuDans(Groupe autreGroupe) { return autreGroupe == this || (possedeGroupeParent() && groupeParent.estContenuDans(autreGroupe)); } + static boolean unGroupeDeGroupesEstContenuDans(Groupe[] groupes, Groupe autreGroupe) { + for (Groupe groupe : groupes) + if (groupe.estContenuDans(autreGroupe)) + return true; + return false; + } } diff --git a/src/main/java/edt/umontp/fr/Planning.java b/src/main/java/edt/umontp/fr/Planning.java index d2d86e7..f417525 100644 --- a/src/main/java/edt/umontp/fr/Planning.java +++ b/src/main/java/edt/umontp/fr/Planning.java @@ -67,8 +67,8 @@ public Planning getPlanningOf(LocalDate date, Groupe groupe) { @Override public Planning getPlanningOf(Groupe groupe) { - return new Planning( - cours.stream().filter(x -> x.getGroupe().estContenuDans(groupe)).collect(Collectors.toList())); + return new Planning(cours.stream().filter(x -> Groupe.unGroupeDeGroupesEstContenuDans(x.getGroupes(), groupe)) + .collect(Collectors.toList())); } /** From 85237b9a1fb47c656cc7725015281c84ec042714 Mon Sep 17 00:00:00 2001 From: emerick-biron Date: Tue, 19 Jan 2021 16:11:44 +0100 Subject: [PATCH 087/111] :hammer: fix toString --- src/main/java/edt/umontp/fr/Cours.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/edt/umontp/fr/Cours.java b/src/main/java/edt/umontp/fr/Cours.java index 92c3586..554f8fe 100644 --- a/src/main/java/edt/umontp/fr/Cours.java +++ b/src/main/java/edt/umontp/fr/Cours.java @@ -156,7 +156,7 @@ public String getIntitule() { @Override public String toString() { return intitule.toUpperCase(Locale.ROOT) + " :\n" + date + "\n" + heureDebut + "-" + heureFin + "\n" - + Arrays.toString(prof) + "\n" + lieu + "\n" + groupes; + + Arrays.toString(prof) + "\n" + lieu + "\n" + Arrays.toString(groupes); } /* From f517f3ddbc02b0c014db7ea43e28e1848780a1a5 Mon Sep 17 00:00:00 2001 From: emerick-biron Date: Tue, 19 Jan 2021 16:39:23 +0100 Subject: [PATCH 088/111] :memo: update JavaDoc --- src/main/java/edt/umontp/fr/Cours.java | 4 +-- .../java/edt/umontp/fr/EmploiDuTemps.java | 2 +- .../edt/umontp/fr/EmploiDuTempsProxy.java | 3 +++ src/main/java/edt/umontp/fr/Groupe.java | 26 ++++++++++++++----- .../edt/umontp/fr/InterfaceEmploiDuTemps.java | 4 +++ src/main/java/edt/umontp/fr/Planning.java | 12 ++++++--- 6 files changed, 37 insertions(+), 14 deletions(-) diff --git a/src/main/java/edt/umontp/fr/Cours.java b/src/main/java/edt/umontp/fr/Cours.java index 49f033b..9865aac 100644 --- a/src/main/java/edt/umontp/fr/Cours.java +++ b/src/main/java/edt/umontp/fr/Cours.java @@ -46,9 +46,9 @@ public Cours(LocalDate date, String[] prof, LocalTime heureDebut, LocalTime heur } /** - * Permet de creer un objet Cours a partir d'un VEVENT + * Permet de créer un objet cours a partir d'un VEVENT * - * @param vEvent + * @param vEvent event d'un objet Calendar * @since 1.0 */ public Cours(Component vEvent) { diff --git a/src/main/java/edt/umontp/fr/EmploiDuTemps.java b/src/main/java/edt/umontp/fr/EmploiDuTemps.java index a176037..065b84d 100644 --- a/src/main/java/edt/umontp/fr/EmploiDuTemps.java +++ b/src/main/java/edt/umontp/fr/EmploiDuTemps.java @@ -24,10 +24,10 @@ * @see InterfaceEmploiDuTemps */ public class EmploiDuTemps implements InterfaceEmploiDuTemps { + private static EmploiDuTemps singleton = null; private final String LIEN_ICAL = "https://proseconsult.umontpellier.fr/jsp/custom/modules/plannings/direct_cal" + ".jsp?data" + "=58c99062bab31d256bee14356aca3f2423c0f022cb9660eba051b2653be722c431b66c493702208e664667048bc04373dc5c094f7d1a811b903031bde802c7f59b21846d3c6254443d7b6e956d3145c6e0d5bac87b70fdd185b8b86771d71211a02411e8351020815cfb0dcc54c667187353dbcfc377b44753a4f433d4e51f753c2b0fc0eafdcbc1cbb6ef4e715ebea9d495758b595b12cb294e70e715876fbaa3c654023c76f43cd51442775ff171e0a5f21b50c55a5b52d94df3e7977af823a1e78ee86c6497b1cf8732d52143eeffacc27449fc13ec1f0b04d23e09712df15579474e1aa0cd65f50f33a1dd766301,1"; - private static EmploiDuTemps singleton = null; private Planning planningEmploisDuTemps; /** diff --git a/src/main/java/edt/umontp/fr/EmploiDuTempsProxy.java b/src/main/java/edt/umontp/fr/EmploiDuTempsProxy.java index 6d7e560..3992781 100644 --- a/src/main/java/edt/umontp/fr/EmploiDuTempsProxy.java +++ b/src/main/java/edt/umontp/fr/EmploiDuTempsProxy.java @@ -61,6 +61,9 @@ public void actualiser() { cacheDateGroupe = new HashMap<>(); } + /** + * Cette classe représente une combinaison de clefs + */ class MultiKey { private K1 key1; private K2 key2; diff --git a/src/main/java/edt/umontp/fr/Groupe.java b/src/main/java/edt/umontp/fr/Groupe.java index 3c48620..b67c443 100644 --- a/src/main/java/edt/umontp/fr/Groupe.java +++ b/src/main/java/edt/umontp/fr/Groupe.java @@ -59,13 +59,6 @@ private Groupe(String intitule, Groupe groupeParent) { this.groupeParent = groupeParent; } - /** - * @return the intitule - */ - public String getIntitule() { - return intitule; - } - /** * Permet d'obtenir le(s) groupe(s) d'enseignement a partir d'un texte (dans le cadre de cette API a partir de la * description d'un VEVENT) @@ -80,10 +73,29 @@ public static Groupe getGroupeDepuisTexte(String texte) { else return Groupe.NULL; } + /** + * @return the intitule + */ + public String getIntitule() { + return intitule; + } + + /** + * Permet de savoir si ce groupe appartient a un autre groupe + * + * @return {@code boolean} + * @since 1.0 + */ private boolean possedeGroupeParent() { return groupeParent != null; } + /** + * Permet de savoir si ce groupe est contenu dans un autre groupe + * + * @return {@code boolean} + * @since 1.0 + */ public boolean estContenuDans(Groupe autreGroupe) { return autreGroupe == this || (possedeGroupeParent() && groupeParent.estContenuDans(autreGroupe)); } diff --git a/src/main/java/edt/umontp/fr/InterfaceEmploiDuTemps.java b/src/main/java/edt/umontp/fr/InterfaceEmploiDuTemps.java index a950c08..3b3166e 100644 --- a/src/main/java/edt/umontp/fr/InterfaceEmploiDuTemps.java +++ b/src/main/java/edt/umontp/fr/InterfaceEmploiDuTemps.java @@ -8,5 +8,9 @@ * @see Planifiable */ interface InterfaceEmploiDuTemps extends Planifiable { + + /** + * Permet d'actualiser l'emploi du temps + */ public void actualiser(); } diff --git a/src/main/java/edt/umontp/fr/Planning.java b/src/main/java/edt/umontp/fr/Planning.java index 6ec4e36..1cd4db6 100644 --- a/src/main/java/edt/umontp/fr/Planning.java +++ b/src/main/java/edt/umontp/fr/Planning.java @@ -25,6 +25,12 @@ public class Planning implements Iterable, Planifiable { private SortedSet cours; + /** + * Permet de créer un objet Planning a partir d'une collection de cours + * + * @param cours collection de cours + * @since 1.0 + */ public Planning(Collection cours) { this.cours = new TreeSet(cours); } @@ -50,10 +56,8 @@ public Planning getPlanningOf(LocalDate date) { LocalDate lastDate = ((Cours) Collections.max(cours)).getDate(); if (!lastDate.isBefore(date)) { Queue coursTrie = new LinkedList<>(cours); - while (coursTrie.peek().getDate().isBefore(date)) - coursTrie.poll(); - while (!coursTrie.isEmpty() && coursTrie.peek().getDate().isEqual(date)) - result.add(coursTrie.poll()); + while (coursTrie.peek().getDate().isBefore(date)) coursTrie.poll(); + while (!coursTrie.isEmpty() && coursTrie.peek().getDate().isEqual(date)) result.add(coursTrie.poll()); } return new Planning(result); } From adfc7a03ff414d2bedb330d17d181ea1cc8573fe Mon Sep 17 00:00:00 2001 From: MathieuSoysal Date: Tue, 19 Jan 2021 16:42:56 +0100 Subject: [PATCH 089/111] =?UTF-8?q?=E2=99=BB=20Respect=20principe=20YAGNI?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/edt/umontp/fr/EmploiDuTempsProxy.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/edt/umontp/fr/EmploiDuTempsProxy.java b/src/main/java/edt/umontp/fr/EmploiDuTempsProxy.java index 2f822bf..e40a1d6 100644 --- a/src/main/java/edt/umontp/fr/EmploiDuTempsProxy.java +++ b/src/main/java/edt/umontp/fr/EmploiDuTempsProxy.java @@ -55,7 +55,7 @@ public void actualiser() { emploiDuTemps.actualiser(); } - class MultiKey { + private class MultiKey { private K1 key1; private K2 key2; From 35585e80d7c5bacae286fe16d5b709fd2dbd8734 Mon Sep 17 00:00:00 2001 From: MathieuSoysal Date: Tue, 19 Jan 2021 16:43:03 +0100 Subject: [PATCH 090/111] =?UTF-8?q?=E2=9C=85=20Ajout=20tests=20valid=C3=A9?= =?UTF-8?q?s=20EmploiDuTempsProxy?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../edt/umontp/fr/EmploiDuTempsProxyTest.java | 111 ++++++++++++++++++ 1 file changed, 111 insertions(+) create mode 100644 src/test/java/edt/umontp/fr/EmploiDuTempsProxyTest.java diff --git a/src/test/java/edt/umontp/fr/EmploiDuTempsProxyTest.java b/src/test/java/edt/umontp/fr/EmploiDuTempsProxyTest.java new file mode 100644 index 0000000..d9f36db --- /dev/null +++ b/src/test/java/edt/umontp/fr/EmploiDuTempsProxyTest.java @@ -0,0 +1,111 @@ +package edt.umontp.fr; + +import static org.junit.jupiter.api.Assertions.assertAll; +import static org.junit.jupiter.api.Assertions.assertTrue; + +import java.time.LocalDate; + +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.Test; + +class EmploiDuTempsProxyTest { + + private EmploiDuTempsProxy emploiDuTempsProxyTest; + + @AfterEach + void init() { + emploiDuTempsProxyTest.actualiser(); + } + + @Test + void test_getInstance_retourneAucuneErreur() { + assertAll(() -> EmploiDuTempsProxy.getInstance()); + } + + @Test + void test_getPlanningOf_date_plusRapide() { + emploiDuTempsProxyTest = EmploiDuTempsProxy.getInstance(); + + long tempsExecution1 = rapiditeGetPlanningOfDate(); + long tempsExecution2 = rapiditeGetPlanningOfDate(); + + assertTrue(tempsExecution1 > tempsExecution2); + } + + private long rapiditeGetPlanningOfDate() { + long startTime = System.currentTimeMillis(); + emploiDuTempsProxyTest.getPlanningOf(LocalDate.now()); + emploiDuTempsProxyTest.getPlanningOf(LocalDate.now().plusDays(1)); + emploiDuTempsProxyTest.getPlanningOf(LocalDate.now().plusDays(2)); + emploiDuTempsProxyTest.getPlanningOf(LocalDate.now().plusDays(3)); + emploiDuTempsProxyTest.getPlanningOf(LocalDate.now().plusDays(4)); + emploiDuTempsProxyTest.getPlanningOf(LocalDate.now().plusDays(5)); + emploiDuTempsProxyTest.getPlanningOf(LocalDate.now().plusDays(6)); + emploiDuTempsProxyTest.getPlanningOf(LocalDate.now().plusDays(7)); + emploiDuTempsProxyTest.getPlanningOf(LocalDate.now().plusDays(8)); + emploiDuTempsProxyTest.getPlanningOf(LocalDate.now().plusDays(9)); + emploiDuTempsProxyTest.getPlanningOf(LocalDate.now().plusDays(10)); + return System.currentTimeMillis() - startTime; + } + + @Test + void test_getPlanningOf_Groupe_plusRapide() { + emploiDuTempsProxyTest = EmploiDuTempsProxy.getInstance(); + + long tempsExecution1 = rapiditeGetPlanningOfGroupe(); + long tempsExecution2 = rapiditeGetPlanningOfGroupe(); + + assertTrue(tempsExecution1 > tempsExecution2); + } + + private long rapiditeGetPlanningOfGroupe() { + long startTime = System.currentTimeMillis(); + emploiDuTempsProxyTest.getPlanningOf(Groupe.A1); + emploiDuTempsProxyTest.getPlanningOf(Groupe.Q1); + emploiDuTempsProxyTest.getPlanningOf(Groupe.Q2); + emploiDuTempsProxyTest.getPlanningOf(Groupe.Q3); + emploiDuTempsProxyTest.getPlanningOf(Groupe.Q4); + emploiDuTempsProxyTest.getPlanningOf(Groupe.G1); + emploiDuTempsProxyTest.getPlanningOf(Groupe.G2); + emploiDuTempsProxyTest.getPlanningOf(Groupe.G3); + emploiDuTempsProxyTest.getPlanningOf(Groupe.G4); + emploiDuTempsProxyTest.getPlanningOf(Groupe.A2); + return System.currentTimeMillis() - startTime; + } + + @Test + void test_getPlanningOf_DateGroupe_plusRapide() { + emploiDuTempsProxyTest = EmploiDuTempsProxy.getInstance(); + + long tempsExecution1 = rapiditeGetPlanningOfDateGroupe(); + long tempsExecution2 = rapiditeGetPlanningOfDateGroupe(); + + assertTrue(tempsExecution1 > tempsExecution2); + } + + private long rapiditeGetPlanningOfDateGroupe() { + long startTime = System.currentTimeMillis(); + emploiDuTempsProxyTest.getPlanningOf(LocalDate.now().plusDays(1), Groupe.A1); + emploiDuTempsProxyTest.getPlanningOf(LocalDate.now().plusDays(2), Groupe.Q1); + emploiDuTempsProxyTest.getPlanningOf(LocalDate.now().plusDays(3), Groupe.Q2); + emploiDuTempsProxyTest.getPlanningOf(LocalDate.now().plusDays(4), Groupe.Q3); + emploiDuTempsProxyTest.getPlanningOf(LocalDate.now().plusDays(5), Groupe.Q4); + emploiDuTempsProxyTest.getPlanningOf(LocalDate.now().plusDays(6), Groupe.G1); + emploiDuTempsProxyTest.getPlanningOf(LocalDate.now().plusDays(7), Groupe.G2); + emploiDuTempsProxyTest.getPlanningOf(LocalDate.now().plusDays(8), Groupe.G3); + emploiDuTempsProxyTest.getPlanningOf(LocalDate.now().plusDays(9), Groupe.G4); + emploiDuTempsProxyTest.getPlanningOf(LocalDate.now().plusDays(10), Groupe.A2); + return System.currentTimeMillis() - startTime; + } + + @Test + void test_getPlanningOf_DateGroupe_plusRapideInteligent() { + emploiDuTempsProxyTest = EmploiDuTempsProxy.getInstance(); + + long tempsExecution1 = rapiditeGetPlanningOfDate(); + long tempsExecution2 = rapiditeGetPlanningOfDateGroupe(); + + assertTrue(tempsExecution1 > tempsExecution2); + } + +} From 76ad29c1e87128ed94e378b7c825585fd0deb2f1 Mon Sep 17 00:00:00 2001 From: MathieuSoysal Date: Tue, 19 Jan 2021 16:48:04 +0100 Subject: [PATCH 091/111] =?UTF-8?q?=F0=9F=94=A5=20Suppression=20class=20ob?= =?UTF-8?q?sol=C3=A8tes?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/edt/umontp/fr/App.java | 13 ------------- src/test/java/edt/umontp/fr/AppTest.java | 18 ------------------ 2 files changed, 31 deletions(-) delete mode 100644 src/main/java/edt/umontp/fr/App.java delete mode 100644 src/test/java/edt/umontp/fr/AppTest.java diff --git a/src/main/java/edt/umontp/fr/App.java b/src/main/java/edt/umontp/fr/App.java deleted file mode 100644 index 02d7dee..0000000 --- a/src/main/java/edt/umontp/fr/App.java +++ /dev/null @@ -1,13 +0,0 @@ -package edt.umontp.fr; - -/** - * Hello world! - * - */ -public class App -{ - public static void main( String[] args ) - { - System.out.println( "Hello World!" ); - } -} diff --git a/src/test/java/edt/umontp/fr/AppTest.java b/src/test/java/edt/umontp/fr/AppTest.java deleted file mode 100644 index 2f26bee..0000000 --- a/src/test/java/edt/umontp/fr/AppTest.java +++ /dev/null @@ -1,18 +0,0 @@ -package edt.umontp.fr; - -import static org.junit.jupiter.api.Assertions.assertTrue; - -import org.junit.jupiter.api.Test; - -/** - * Unit test for simple App. - */ -class AppTest { - /** - * Rigorous Test :-) - */ - @Test - void shouldAnswerWithTrue() { - assertTrue(true); - } -} From 466a268802d72ab62564679c2de6461a0ae311b6 Mon Sep 17 00:00:00 2001 From: MathieuSoysal Date: Tue, 19 Jan 2021 16:55:32 +0100 Subject: [PATCH 092/111] =?UTF-8?q?=F0=9F=8E=A8=20Petite=20mise=20en=20for?= =?UTF-8?q?me?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/edt/umontp/fr/EmploiDuTempsProxy.java | 2 -- src/main/java/edt/umontp/fr/Groupe.java | 1 - 2 files changed, 3 deletions(-) diff --git a/src/main/java/edt/umontp/fr/EmploiDuTempsProxy.java b/src/main/java/edt/umontp/fr/EmploiDuTempsProxy.java index e40a1d6..baa735d 100644 --- a/src/main/java/edt/umontp/fr/EmploiDuTempsProxy.java +++ b/src/main/java/edt/umontp/fr/EmploiDuTempsProxy.java @@ -4,8 +4,6 @@ import java.util.EnumMap; import java.util.HashMap; -// FIXME à tester ! - public class EmploiDuTempsProxy implements InterfaceEmploiDuTemps { private static EmploiDuTempsProxy singleton = null; private EmploiDuTemps emploiDuTemps; diff --git a/src/main/java/edt/umontp/fr/Groupe.java b/src/main/java/edt/umontp/fr/Groupe.java index 6ecf7d2..82f570d 100644 --- a/src/main/java/edt/umontp/fr/Groupe.java +++ b/src/main/java/edt/umontp/fr/Groupe.java @@ -6,7 +6,6 @@ import java.util.regex.Pattern; public enum Groupe { - NULL("sans groupe"), // Gérer les exceptions TODO à voir si toujours util A1("A1"), // première année dep info S1("S1", A1), // S2("S2", A1), // From bc2c32ea77f169e80337b72bf4e2bdf0f051a3e9 Mon Sep 17 00:00:00 2001 From: MathieuSoysal Date: Tue, 19 Jan 2021 17:14:41 +0100 Subject: [PATCH 093/111] =?UTF-8?q?=E2=9C=85=20Mise=20=C3=A0=20jous=20des?= =?UTF-8?q?=20test=20valid=C3=A9s=20EmploiDuTempsProxyTest?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../edt/umontp/fr/EmploiDuTempsProxyTest.java | 81 ++++++++++--------- 1 file changed, 43 insertions(+), 38 deletions(-) diff --git a/src/test/java/edt/umontp/fr/EmploiDuTempsProxyTest.java b/src/test/java/edt/umontp/fr/EmploiDuTempsProxyTest.java index d9f36db..2af4ed6 100644 --- a/src/test/java/edt/umontp/fr/EmploiDuTempsProxyTest.java +++ b/src/test/java/edt/umontp/fr/EmploiDuTempsProxyTest.java @@ -10,21 +10,22 @@ class EmploiDuTempsProxyTest { - private EmploiDuTempsProxy emploiDuTempsProxyTest; + private EmploiDuTempsProxy emploiDuTempsProxy; @AfterEach void init() { - emploiDuTempsProxyTest.actualiser(); + emploiDuTempsProxy.actualiser(); } @Test void test_getInstance_retourneAucuneErreur() { - assertAll(() -> EmploiDuTempsProxy.getInstance()); + assertAll(() -> emploiDuTempsProxy = EmploiDuTempsProxy.getInstance()); } @Test void test_getPlanningOf_date_plusRapide() { - emploiDuTempsProxyTest = EmploiDuTempsProxy.getInstance(); + emploiDuTempsProxy = EmploiDuTempsProxy.getInstance(); + emploiDuTempsProxy.actualiser(); long tempsExecution1 = rapiditeGetPlanningOfDate(); long tempsExecution2 = rapiditeGetPlanningOfDate(); @@ -34,23 +35,24 @@ void test_getPlanningOf_date_plusRapide() { private long rapiditeGetPlanningOfDate() { long startTime = System.currentTimeMillis(); - emploiDuTempsProxyTest.getPlanningOf(LocalDate.now()); - emploiDuTempsProxyTest.getPlanningOf(LocalDate.now().plusDays(1)); - emploiDuTempsProxyTest.getPlanningOf(LocalDate.now().plusDays(2)); - emploiDuTempsProxyTest.getPlanningOf(LocalDate.now().plusDays(3)); - emploiDuTempsProxyTest.getPlanningOf(LocalDate.now().plusDays(4)); - emploiDuTempsProxyTest.getPlanningOf(LocalDate.now().plusDays(5)); - emploiDuTempsProxyTest.getPlanningOf(LocalDate.now().plusDays(6)); - emploiDuTempsProxyTest.getPlanningOf(LocalDate.now().plusDays(7)); - emploiDuTempsProxyTest.getPlanningOf(LocalDate.now().plusDays(8)); - emploiDuTempsProxyTest.getPlanningOf(LocalDate.now().plusDays(9)); - emploiDuTempsProxyTest.getPlanningOf(LocalDate.now().plusDays(10)); + emploiDuTempsProxy.getPlanningOf(LocalDate.now()); + emploiDuTempsProxy.getPlanningOf(LocalDate.now().plusDays(1)); + emploiDuTempsProxy.getPlanningOf(LocalDate.now().plusDays(2)); + emploiDuTempsProxy.getPlanningOf(LocalDate.now().plusDays(3)); + emploiDuTempsProxy.getPlanningOf(LocalDate.now().plusDays(4)); + emploiDuTempsProxy.getPlanningOf(LocalDate.now().plusDays(5)); + emploiDuTempsProxy.getPlanningOf(LocalDate.now().plusDays(6)); + emploiDuTempsProxy.getPlanningOf(LocalDate.now().plusDays(7)); + emploiDuTempsProxy.getPlanningOf(LocalDate.now().plusDays(8)); + emploiDuTempsProxy.getPlanningOf(LocalDate.now().plusDays(9)); + emploiDuTempsProxy.getPlanningOf(LocalDate.now().plusDays(10)); return System.currentTimeMillis() - startTime; } @Test void test_getPlanningOf_Groupe_plusRapide() { - emploiDuTempsProxyTest = EmploiDuTempsProxy.getInstance(); + emploiDuTempsProxy = EmploiDuTempsProxy.getInstance(); + emploiDuTempsProxy.actualiser(); long tempsExecution1 = rapiditeGetPlanningOfGroupe(); long tempsExecution2 = rapiditeGetPlanningOfGroupe(); @@ -60,22 +62,24 @@ void test_getPlanningOf_Groupe_plusRapide() { private long rapiditeGetPlanningOfGroupe() { long startTime = System.currentTimeMillis(); - emploiDuTempsProxyTest.getPlanningOf(Groupe.A1); - emploiDuTempsProxyTest.getPlanningOf(Groupe.Q1); - emploiDuTempsProxyTest.getPlanningOf(Groupe.Q2); - emploiDuTempsProxyTest.getPlanningOf(Groupe.Q3); - emploiDuTempsProxyTest.getPlanningOf(Groupe.Q4); - emploiDuTempsProxyTest.getPlanningOf(Groupe.G1); - emploiDuTempsProxyTest.getPlanningOf(Groupe.G2); - emploiDuTempsProxyTest.getPlanningOf(Groupe.G3); - emploiDuTempsProxyTest.getPlanningOf(Groupe.G4); - emploiDuTempsProxyTest.getPlanningOf(Groupe.A2); + emploiDuTempsProxy.getPlanningOf(Groupe.A1); + emploiDuTempsProxy.getPlanningOf(Groupe.Q1); + emploiDuTempsProxy.getPlanningOf(Groupe.Q2); + emploiDuTempsProxy.getPlanningOf(Groupe.Q3); + emploiDuTempsProxy.getPlanningOf(Groupe.Q4); + emploiDuTempsProxy.getPlanningOf(Groupe.G1); + emploiDuTempsProxy.getPlanningOf(Groupe.G2); + emploiDuTempsProxy.getPlanningOf(Groupe.G3); + emploiDuTempsProxy.getPlanningOf(Groupe.G4); + emploiDuTempsProxy.getPlanningOf(Groupe.A2); return System.currentTimeMillis() - startTime; } @Test void test_getPlanningOf_DateGroupe_plusRapide() { - emploiDuTempsProxyTest = EmploiDuTempsProxy.getInstance(); + + emploiDuTempsProxy = EmploiDuTempsProxy.getInstance(); + emploiDuTempsProxy.actualiser(); long tempsExecution1 = rapiditeGetPlanningOfDateGroupe(); long tempsExecution2 = rapiditeGetPlanningOfDateGroupe(); @@ -85,22 +89,23 @@ void test_getPlanningOf_DateGroupe_plusRapide() { private long rapiditeGetPlanningOfDateGroupe() { long startTime = System.currentTimeMillis(); - emploiDuTempsProxyTest.getPlanningOf(LocalDate.now().plusDays(1), Groupe.A1); - emploiDuTempsProxyTest.getPlanningOf(LocalDate.now().plusDays(2), Groupe.Q1); - emploiDuTempsProxyTest.getPlanningOf(LocalDate.now().plusDays(3), Groupe.Q2); - emploiDuTempsProxyTest.getPlanningOf(LocalDate.now().plusDays(4), Groupe.Q3); - emploiDuTempsProxyTest.getPlanningOf(LocalDate.now().plusDays(5), Groupe.Q4); - emploiDuTempsProxyTest.getPlanningOf(LocalDate.now().plusDays(6), Groupe.G1); - emploiDuTempsProxyTest.getPlanningOf(LocalDate.now().plusDays(7), Groupe.G2); - emploiDuTempsProxyTest.getPlanningOf(LocalDate.now().plusDays(8), Groupe.G3); - emploiDuTempsProxyTest.getPlanningOf(LocalDate.now().plusDays(9), Groupe.G4); - emploiDuTempsProxyTest.getPlanningOf(LocalDate.now().plusDays(10), Groupe.A2); + emploiDuTempsProxy.getPlanningOf(LocalDate.now().plusDays(1), Groupe.A1); + emploiDuTempsProxy.getPlanningOf(LocalDate.now().plusDays(2), Groupe.Q1); + emploiDuTempsProxy.getPlanningOf(LocalDate.now().plusDays(3), Groupe.Q2); + emploiDuTempsProxy.getPlanningOf(LocalDate.now().plusDays(4), Groupe.Q3); + emploiDuTempsProxy.getPlanningOf(LocalDate.now().plusDays(5), Groupe.Q4); + emploiDuTempsProxy.getPlanningOf(LocalDate.now().plusDays(6), Groupe.G1); + emploiDuTempsProxy.getPlanningOf(LocalDate.now().plusDays(7), Groupe.G2); + emploiDuTempsProxy.getPlanningOf(LocalDate.now().plusDays(8), Groupe.G3); + emploiDuTempsProxy.getPlanningOf(LocalDate.now().plusDays(9), Groupe.G4); + emploiDuTempsProxy.getPlanningOf(LocalDate.now().plusDays(10), Groupe.A2); return System.currentTimeMillis() - startTime; } @Test void test_getPlanningOf_DateGroupe_plusRapideInteligent() { - emploiDuTempsProxyTest = EmploiDuTempsProxy.getInstance(); + emploiDuTempsProxy = EmploiDuTempsProxy.getInstance(); + emploiDuTempsProxy.actualiser(); long tempsExecution1 = rapiditeGetPlanningOfDate(); long tempsExecution2 = rapiditeGetPlanningOfDateGroupe(); From a0981592b724ebe463a5697c4b9609e55cd85cba Mon Sep 17 00:00:00 2001 From: MathieuSoysal Date: Tue, 19 Jan 2021 19:27:50 +0100 Subject: [PATCH 094/111] =?UTF-8?q?=F0=9F=93=9D=20Mise=20=C3=A0=20jour=20g?= =?UTF-8?q?=C3=A9n=C3=A9ral=20de=20la=20JavaDoc?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/edt/umontp/fr/Cours.java | 60 +++-- .../java/edt/umontp/fr/EmploiDuTemps.java | 43 +++- .../edt/umontp/fr/EmploiDuTempsProxy.java | 3 + src/main/java/edt/umontp/fr/Groupe.java | 243 ++++++++++++++++-- .../edt/umontp/fr/InterfaceEmploiDuTemps.java | 3 +- src/main/java/edt/umontp/fr/Planifiable.java | 3 +- src/main/java/edt/umontp/fr/Planning.java | 19 +- 7 files changed, 314 insertions(+), 60 deletions(-) diff --git a/src/main/java/edt/umontp/fr/Cours.java b/src/main/java/edt/umontp/fr/Cours.java index e2e09ef..45221ce 100644 --- a/src/main/java/edt/umontp/fr/Cours.java +++ b/src/main/java/edt/umontp/fr/Cours.java @@ -17,11 +17,24 @@ import net.fortuna.ical4j.model.Property; /** - * Cours est la classe qui gère les cours d'un planning - * - * @author emerick-biron, MathieuSoysal - * @version 1.0 + * Cours est la classe représentant un cours au sein du planning. + *

+ * Un objet Cours est caractérisé par les informations suivantes : + *

    + *
  • Une date.
  • + *
  • D'une liste de professeurs.
  • + *
  • D'une heure de début.
  • + *
  • D'une heure de fin.
  • + *
  • D'une durée.
  • + *
  • D'une liste de {@link Groupe}.
  • + *
  • D'un intitule.
  • + *
+ * * @see Comparable + * + * @author emerick-biron + * @author MathieuSoysal + * @version 1.0.0 */ public class Cours implements Comparable { private final ZoneId ZONE_ID = ZoneId.of("Europe/Paris"); @@ -47,12 +60,17 @@ public Cours(LocalDate date, String[] prof, LocalTime heureDebut, LocalTime heur } /** - * Permet de créer un objet cours a partir d'un VEVENT - * - * @param vEvent event d'un objet Calendar - * @since 1.0 + * Constructeur Cours. + *

+ * Le constructeur est chargé de trouver toutes attributs de class {@link Cours} + * au sein du {@link Component}. + *

+ * + * @param vEvent l'évenement du calendrier qui représente un cours + * + * @see Component */ - public Cours(Component vEvent) { + Cours(Component vEvent) { Property summary = vEvent.getProperty(Property.SUMMARY); Property description = vEvent.getProperty(Property.DESCRIPTION); Property dtStart = vEvent.getProperty(Property.DTSTART); @@ -83,10 +101,10 @@ public Cours(Component vEvent) { * de ce dernier * * @param desc description du VENVENT - * @return le(s) professeur(s) du present dans la description + * @return {@code String[]} le(s) professeur(s) du present dans la description * @since 1.0 */ - public static String[] getProfFromDesc(String desc) { + static String[] getProfFromDesc(String desc) { String regex = "(?<=\\n)[- A-Z]* [- A-Z]*(?=\\n)"; Matcher m = Pattern.compile(regex).matcher(desc); final List matches = new ArrayList<>(); @@ -117,63 +135,63 @@ public int compareTo(Cours o) { } /** - * @return the date + * @return {@code LocalDate} la date de début du cours */ public LocalDate getDate() { return date; } /** - * @return the prof + * @return {@code String[]} les professeurs organisant le cours */ public String[] getProf() { return prof; } /** - * @return the heureDebut + * @return {@code LocalTime} l'heure de début du cours */ public LocalTime getHeureDebut() { return heureDebut; } /** - * @return the heureFin + * @return {@code LocalTime} l'heure de fin du cours */ public LocalTime getHeureFin() { return heureFin; } /** - * @return the lieu + * @return {@code String} le lieu */ public String getLieu() { return lieu; } /** - * @return the duree + * @return {@code int} la durée du cours */ public int getDuree() { return duree; } /** - * @return the groupe + * @return {@code Groupe[]} les groupes assignés au cours + * + * @see Groupe */ public Groupe[] getGroupes() { return groupes; } /** - * @return the intitule + * @return {@code String} l'intitulé du cours */ public String getIntitule() { return intitule; } - // TODO Améliorer la performance utiliser - @Override public String toString() { return intitule.toUpperCase(Locale.ROOT) + " :\n" + date + "\n" + heureDebut + "-" + heureFin + "\n" diff --git a/src/main/java/edt/umontp/fr/EmploiDuTemps.java b/src/main/java/edt/umontp/fr/EmploiDuTemps.java index 065b84d..667db10 100644 --- a/src/main/java/edt/umontp/fr/EmploiDuTemps.java +++ b/src/main/java/edt/umontp/fr/EmploiDuTemps.java @@ -17,17 +17,30 @@ import net.fortuna.ical4j.model.Component; /** - * EmploisDuTemps est la classe qui permet de gérer un emploi du temps - * - * @author emerick-biron, MathieuSoysal - * @version 1.0 + * EmploisDuTemps est la classe représentant tout l'emploi du temps + * l'unviersité. + *

+ * De plus, l'EmploiDuTemps est un singleton, il ne peut y avoir donc qu'une + * instance de celle-ci. + *

+ * + * @deprecated Pour l'utilisation de celle-ci il est préférable de passer par + * son proxy : {@link EmploiDuTempsProxy} afin d'avoir une meilleure + * optimisation. + * * @see InterfaceEmploiDuTemps + * @see EmploiDuTempsProxy + * + * @author emerick-biron + * @author MathieuSoysal + * @version 1.0.0 */ +@Deprecated(forRemoval = false) public class EmploiDuTemps implements InterfaceEmploiDuTemps { private static EmploiDuTemps singleton = null; - private final String LIEN_ICAL = - "https://proseconsult.umontpellier.fr/jsp/custom/modules/plannings/direct_cal" + ".jsp?data" + - "=58c99062bab31d256bee14356aca3f2423c0f022cb9660eba051b2653be722c431b66c493702208e664667048bc04373dc5c094f7d1a811b903031bde802c7f59b21846d3c6254443d7b6e956d3145c6e0d5bac87b70fdd185b8b86771d71211a02411e8351020815cfb0dcc54c667187353dbcfc377b44753a4f433d4e51f753c2b0fc0eafdcbc1cbb6ef4e715ebea9d495758b595b12cb294e70e715876fbaa3c654023c76f43cd51442775ff171e0a5f21b50c55a5b52d94df3e7977af823a1e78ee86c6497b1cf8732d52143eeffacc27449fc13ec1f0b04d23e09712df15579474e1aa0cd65f50f33a1dd766301,1"; + private final String LIEN_ICAL = "https://proseconsult.umontpellier.fr/jsp/custom/modules/plannings/direct_cal" + + ".jsp?data" + + "=58c99062bab31d256bee14356aca3f2423c0f022cb9660eba051b2653be722c431b66c493702208e664667048bc04373dc5c094f7d1a811b903031bde802c7f59b21846d3c6254443d7b6e956d3145c6e0d5bac87b70fdd185b8b86771d71211a02411e8351020815cfb0dcc54c667187353dbcfc377b44753a4f433d4e51f753c2b0fc0eafdcbc1cbb6ef4e715ebea9d495758b595b12cb294e70e715876fbaa3c654023c76f43cd51442775ff171e0a5f21b50c55a5b52d94df3e7977af823a1e78ee86c6497b1cf8732d52143eeffacc27449fc13ec1f0b04d23e09712df15579474e1aa0cd65f50f33a1dd766301,1"; private Planning planningEmploisDuTemps; /** @@ -39,6 +52,17 @@ private EmploiDuTemps() { actualiser(); } + /** + * Retourne l'instance de {@link EmploiDuTemps}. + * + * @return {@code EmploiDuTemps} + * + * @deprecated Pour des raisons d'optimisation il est préférable de passer pour + * le proxy : {@link EmploiDuTempsProxy} + * + * @see EmploiDuTempsProxy + */ + @Deprecated public static EmploiDuTemps getInstance() { EmploiDuTemps localInstance = singleton; if (localInstance == null) { @@ -53,7 +77,7 @@ public static EmploiDuTemps getInstance() { } /** - * Permet d'obtenir un objet calendar a parti d'un fichier ics + * Permet d'obtenir un objet {@link Calendar} a parti d'un fichier ics * * @param fichierIcs fichier ics source * @return objet calendar corespondant @@ -75,7 +99,8 @@ private Calendar convertieFichierIcsEnCalendar(File fichierIcs) { } /** - * Permet d'obtenir un fichier ics correspondant a un lien iCal (ici lien iCal = {@link #LIEN_ICAL} + * Permet d'obtenir un fichier ics correspondant a un lien iCal (ici lien iCal = + * {@link #LIEN_ICAL} * * @return fichier ics correspondant * @since 1.0 diff --git a/src/main/java/edt/umontp/fr/EmploiDuTempsProxy.java b/src/main/java/edt/umontp/fr/EmploiDuTempsProxy.java index 67c82bf..f2f1254 100644 --- a/src/main/java/edt/umontp/fr/EmploiDuTempsProxy.java +++ b/src/main/java/edt/umontp/fr/EmploiDuTempsProxy.java @@ -14,11 +14,13 @@ */ public class EmploiDuTempsProxy implements InterfaceEmploiDuTemps { private static EmploiDuTempsProxy singleton = null; + @SuppressWarnings("deprecation") private EmploiDuTemps emploiDuTemps; private EnumMap cacheGroupe; private HashMap cacheDate; private HashMap, Planning> cacheDateGroupe; + @SuppressWarnings("deprecation") private EmploiDuTempsProxy() { emploiDuTemps = EmploiDuTemps.getInstance(); actualiser(); @@ -53,6 +55,7 @@ public Planning getPlanningOf(Groupe groupe) { return cacheGroupe.computeIfAbsent(groupe, k -> emploiDuTemps.getPlanningOf(k)); } + @SuppressWarnings("deprecation") @Override public void actualiser() { cacheDate = new HashMap<>(); diff --git a/src/main/java/edt/umontp/fr/Groupe.java b/src/main/java/edt/umontp/fr/Groupe.java index 074f0b9..97ee291 100644 --- a/src/main/java/edt/umontp/fr/Groupe.java +++ b/src/main/java/edt/umontp/fr/Groupe.java @@ -6,30 +6,186 @@ import java.util.regex.Pattern; /** - * Groupe est une enumeration qui permet de recenser les différents groupes - * d'enseignements pour lesquelles l'API est proposée - * - * @author emerick-biron, MathieuSoysal - * @version 1.0 + * Groupe est une enumeration qui permet de recenser les différents groupes + * d'enseignements de l'université + *

+ * Une instance de groupe est caractérisé par les informations suivantes : + *

    + *
  • Un intitulé.
  • + *
  • Un groupe parent.
  • + *
+ *

+ * De plus, un {@link Groupe} ne pas être instancié, il faut donc utiliser + * l'enumération. + *

+ * + * @see SDZLevel + * + * @author emerick-biron + * @author MathieuSoysal + * @version 1.0.0 */ public enum Groupe { - A1("A1"), // première année dep info - S1("S1", A1), // - S2("S2", A1), // - S3("S3", A1), // - S4("S4", A1), // - S5("S5", A1), // - S6("S6", A1), // - A2("A2"), // deuxième année dep info - Q1("Q1", A2), // - Q2("Q2", A2), // - Q3("Q3", A2), // - Q4("Q4", A2), // - G1("G1", A2), // - G2("G2", A2), // - G3("G3", A2), // + /** + * {@code A1} est l'objet représentant les classes de première année du + * département informatique de l'IUT de Montpellier. + * + * Cet objet n'est pas modifiable. + * + * @see Groupe + */ + A1("A1"), + + /** + * {@code S1} est l'objet représentant le premier groupe des étudiants de + * première année du département informatique de l'IUT de Montpellier. + * + * Cet objet n'est pas modifiable. + * + * @see Groupe + */ + S1("S1", A1), + /** + * {@code S2} est l'objet représentant le deuxième groupe des étudiants de + * première année du département informatique de l'IUT de Montpellier. + * + * Cet objet n'est pas modifiable. + * + * @see Groupe + */ + S2("S2", A1), + /** + * {@code S3} est l'objet représentant le troisième groupe des étudiants de + * première année du département informatique de l'IUT de Montpellier. + * + * Cet objet n'est pas modifiable. + * + * @see Groupe + */ + S3("S3", A1), + /** + * {@code S4} est l'objet représentant le quatrième groupe des étudiants de + * première année du département informatique de l'IUT de Montpellier. + * + * Cet objet n'est pas modifiable. + * + * @see Groupe + */ + S4("S4", A1), + /** + * {@code S5} est l'objet représentant le cinquième groupe des étudiants de + * première année du département informatique de l'IUT de Montpellier. + * + * Cet objet n'est pas modifiable. + * + * @see Groupe + */ + S5("S5", A1), + /** + * {@code S6} est l'objet représentant le sixième groupe des étudiants de + * première année du département informatique de l'IUT de Montpellier. + * + * Cet objet n'est pas modifiable. + * + * @see Groupe + */ + S6("S6", A1), + /** + * {@code A2} est l'objet représentant les classes de deuxième année du + * département informatique de l'IUT de Montpellier. + * + * Cet objet n'est pas modifiable. + * + * @see Groupe + */ + A2("A2"), + /** + * {@code Q1} est l'objet représentant le premier groupe des étudiants de + * deuxième année de troisième semestre du département informatique de l'IUT de + * Montpellier. + * + * Cet objet n'est pas modifiable. + * + * @see Groupe + */ + Q1("Q1", A2), + /** + * {@code Q2} est l'objet représentant le deuxième groupe des étudiants de + * deuxième année de troisième semestre du département informatique de l'IUT de + * Montpellier. + * + * Cet objet n'est pas modifiable. + * + * @see Groupe + */ + Q2("Q2", A2), + /** + * {@code Q3} est l'objet représentant le troisième groupe des étudiants de + * deuxième année de troisième semestre du département informatique de l'IUT de + * Montpellier. + * + * Cet objet n'est pas modifiable. + * + * @see Groupe + */ + Q3("Q3", A2), + /** + * {@code Q4} est l'objet représentant le quatrième groupe des étudiants de + * deuxième année de troisième semestre du département informatique de l'IUT de + * Montpellier. + * + * Cet objet n'est pas modifiable. + * + * @see Groupe + */ + Q4("Q4", A2), + /** + * {@code G1} est l'objet représentant le premier groupe des étudiants de + * deuxième année de quatrième semestre du département informatique de l'IUT de + * Montpellier. + * + * Cet objet n'est pas modifiable. + * + * @see Groupe + */ + G1("G1", A2), + /** + * {@code G2} est l'objet représentant le deuxième groupe des étudiants de + * deuxième année de quatrième semestre du département informatique de l'IUT de + * Montpellier. + * + * Cet objet n'est pas modifiable. + * + * @see Groupe + */ + G2("G2", A2), + /** + * {@code G3} est l'objet représentant le troisième groupe des étudiants de + * deuxième année de quatrième semestre du département informatique de l'IUT de + * Montpellier. + * + * Cet objet n'est pas modifiable. + * + * @see Groupe + */ + G3("G3", A2), + /** + * {@code G4} est l'objet représentant le quatrième groupe des étudiants de + * deuxième année de quatrième semestre du département informatique de l'IUT de + * Montpellier. + * + * Cet objet n'est pas modifiable. + * + * @see Groupe + */ G4("G4", A2); + /** + * Ce regex permet de trouver quelles groupe ont étés référencé au sein d'un + * texte. + * + * @see Groupe#getGroupeDepuisTexte(String) + */ private static final String REGEX; static { @@ -40,11 +196,31 @@ public enum Groupe { REGEX = String.format("(%s)", String.join("|", strings)); } + /** + * Intitule du groupe, l'intitule est utilisé pour retrouver quelles sont les + * groupes qui ont étés référencé au sein d'un texte. + * + * @see Groupe#REGEX + */ private String intitule; + + /** + * Cet attribut permet de représenter le groupe englobant le groupe actuel + * (this) + * + * Par exemple : Le groupe parent de {@code S1} est {@code A1} car {@code A1} + * contient {@code S1} + * + * @see Groupe#S1 + * @see Groupe#A1 + * @see Groupe#estContenuDans(Groupe) + */ private Groupe groupeParent; /** * @param intitule + * + * @see Groupe#intitule */ private Groupe(String intitule) { this.intitule = intitule; @@ -54,6 +230,9 @@ private Groupe(String intitule) { /** * @param intitule * @param groupeParent + * + * @see Groupe#intitule + * @see Groupe#groupeParent */ private Groupe(String intitule, Groupe groupeParent) { this.intitule = intitule; @@ -65,7 +244,7 @@ private Groupe(String intitule, Groupe groupeParent) { * cadre de cette API a partir de la description d'un VEVENT) * * @param texte texte source (ici description) - * @return groupe(s) correspondant + * @return {@code Groupe[]} groupe(s) correspondant * @since 1.0 */ public static Groupe[] getGroupeDepuisTexte(String texte) { @@ -77,7 +256,9 @@ public static Groupe[] getGroupeDepuisTexte(String texte) { } /** - * @return the intitule + * @return {@code String}l'intitule du groupe + * + * @see Groupe#intitule */ public String getIntitule() { return intitule; @@ -88,21 +269,37 @@ public String getIntitule() { * * @return {@code boolean} * @since 1.0 + * + * @see Groupe#groupeParent */ private boolean possedeGroupeParent() { return groupeParent != null; } /** - * Permet de savoir si ce groupe est contenu dans un autre groupe + * Permet de savoir si ce groupe est contenu dans {@code autreGroupe} * + * @param autreGroupe {@link Groupe} auquel on vérifie s'il contient le groupe + * actuel (this) + * * @return {@code boolean} * @since 1.0 + * + * @see Groupe#groupeParent + * @see Groupe#possedeGroupeParent() */ public boolean estContenuDans(Groupe autreGroupe) { return autreGroupe == this || (possedeGroupeParent() && groupeParent.estContenuDans(autreGroupe)); } + /** + * Retourn vrai si l'un des groupe de {@code groupes} est contenu dans le groupe + * {@code autreGroupe} + * + * @return {@code boolean} + * + * @see Groupe#estContenuDans(Groupe) + */ static boolean unGroupeDeGroupesEstContenuDans(Groupe[] groupes, Groupe autreGroupe) { for (Groupe groupe : groupes) if (groupe.estContenuDans(autreGroupe)) diff --git a/src/main/java/edt/umontp/fr/InterfaceEmploiDuTemps.java b/src/main/java/edt/umontp/fr/InterfaceEmploiDuTemps.java index 3b3166e..1621e2b 100644 --- a/src/main/java/edt/umontp/fr/InterfaceEmploiDuTemps.java +++ b/src/main/java/edt/umontp/fr/InterfaceEmploiDuTemps.java @@ -3,7 +3,8 @@ /** * InterfaceEmploisDuTemps est un interface proposant des méthodes pour un emploi du temps * - * @author emerick-biron, MathieuSoysal + * @author emerick-biron + * @author MathieuSoysal * @version 1.0 * @see Planifiable */ diff --git a/src/main/java/edt/umontp/fr/Planifiable.java b/src/main/java/edt/umontp/fr/Planifiable.java index 09ef4a3..2912faa 100644 --- a/src/main/java/edt/umontp/fr/Planifiable.java +++ b/src/main/java/edt/umontp/fr/Planifiable.java @@ -5,7 +5,8 @@ /** * Planifiable est une interface proposant des méthodes pour gérer un emploi du temps * - * @author emerick-biron, MathieuSoysal + * @author emerick-biron + * @author MathieuSoysal * @version 1.0 */ interface Planifiable { diff --git a/src/main/java/edt/umontp/fr/Planning.java b/src/main/java/edt/umontp/fr/Planning.java index 40ffa7e..fa77299 100644 --- a/src/main/java/edt/umontp/fr/Planning.java +++ b/src/main/java/edt/umontp/fr/Planning.java @@ -12,12 +12,19 @@ import edu.emory.mathcs.backport.java.util.TreeSet; /** - * Planning est un classe permettant de gérer un planning - * - * @author emerick-biron, MathieuSoysal - * @version 1.0 - * @see Planifiable + * Planning est la classe représentant un planning de {@link Cours} de + * l'empois du temps de l'université. + *

+ * Une instance de Planning est caractérisé par une liste de {@link Cours} + *

+ * * @see Iterable + * @see Planifiable + * @see Cours + * + * @author emerick-biron + * @author MathieuSoysal + * @version 1.0.0 */ public class Planning implements Iterable, Planifiable { private SortedSet cours; @@ -27,6 +34,8 @@ public class Planning implements Iterable, Planifiable { * * @param cours collection de cours * @since 1.0 + * + * @see Cours */ public Planning(Collection cours) { this.cours = new TreeSet(cours); From 06a43122fcb8ee5a692f782356e5b7f909e40355 Mon Sep 17 00:00:00 2001 From: MathieuSoysal Date: Tue, 19 Jan 2021 20:04:39 +0100 Subject: [PATCH 095/111] =?UTF-8?q?=F0=9F=93=9D=20Mise=20=C3=A0=20jour=20J?= =?UTF-8?q?avaDoc=20Planifiable?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/edt/umontp/fr/Planifiable.java | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/src/main/java/edt/umontp/fr/Planifiable.java b/src/main/java/edt/umontp/fr/Planifiable.java index 2912faa..3266e7f 100644 --- a/src/main/java/edt/umontp/fr/Planifiable.java +++ b/src/main/java/edt/umontp/fr/Planifiable.java @@ -3,7 +3,8 @@ import java.time.LocalDate; /** - * Planifiable est une interface proposant des méthodes pour gérer un emploi du temps + * Planifiable est une interface proposant des méthodes pour gérer un emploi du + * temps * * @author emerick-biron * @author MathieuSoysal @@ -11,30 +12,38 @@ */ interface Planifiable { /** - * Permet d'obtenir le planning correspondant a une date + * Permet d'obtenir le planning correspondant à une date * * @param date date pour laquelle on veut obtenir le planning - * @return planning corresspndant + * @return {@code Planning} correspondant * @since 1.0 + * + * @see Planning */ public Planning getPlanningOf(LocalDate date); /** - * Permet d'obtenir le planning correspondant a une date et un groupe + * Permet d'obtenir le planning correspondant à une date et un groupe * * @param date date dont on veut obtenir le planning * @param groupe groupe dont on veut obtenir le planning * @return planning correspondant * @since 1.0 + * + * @see Groupe + * @see Planning */ public Planning getPlanningOf(LocalDate date, Groupe groupe); /** - * Permet d'obtenir le planning correspondant a un groupe + * Permet d'obtenir le planning correspondant à un groupe * * @param groupe groupe dont on veut obtenir le planning * @return planning correspondant * @since 1.0 + * + * @see Groupe + * @see Planning */ public Planning getPlanningOf(Groupe groupe); From ac2b59ee0be2a856866abe3e8ef38589f61fb65b Mon Sep 17 00:00:00 2001 From: MathieuSoysal Date: Tue, 19 Jan 2021 20:30:14 +0100 Subject: [PATCH 096/111] =?UTF-8?q?=F0=9F=94=A8=20Mise=20=C3=A0=20jour=20t?= =?UTF-8?q?oString=20Cours?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/edt/umontp/fr/Cours.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/java/edt/umontp/fr/Cours.java b/src/main/java/edt/umontp/fr/Cours.java index 45221ce..f23757a 100644 --- a/src/main/java/edt/umontp/fr/Cours.java +++ b/src/main/java/edt/umontp/fr/Cours.java @@ -194,8 +194,9 @@ public String getIntitule() { @Override public String toString() { - return intitule.toUpperCase(Locale.ROOT) + " :\n" + date + "\n" + heureDebut + "-" + heureFin + "\n" - + Arrays.toString(prof) + "\n" + lieu + "\n" + Arrays.toString(groupes); + return intitule.toUpperCase(Locale.ROOT) + " :\n Date : " + date + "\n Commence à " + heureDebut + " jusqu'à " + + heureFin + "\n Enseignant :" + Arrays.toString(prof) + " \n Localisation : " + lieu + " \n Groupe : " + + Arrays.toString(groupes); } /* From d18f637f09aa5b94f3ad58456e3fe401af7357c2 Mon Sep 17 00:00:00 2001 From: MathieuSoysal Date: Tue, 19 Jan 2021 20:31:41 +0100 Subject: [PATCH 097/111] =?UTF-8?q?=E2=9C=85=20Mise=20=C3=A0=20jour=20test?= =?UTF-8?q?=20EmploiDuTempsTest?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/test/java/edt/umontp/fr/EmploiDuTempsTest.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/test/java/edt/umontp/fr/EmploiDuTempsTest.java b/src/test/java/edt/umontp/fr/EmploiDuTempsTest.java index ab53471..3dbe643 100644 --- a/src/test/java/edt/umontp/fr/EmploiDuTempsTest.java +++ b/src/test/java/edt/umontp/fr/EmploiDuTempsTest.java @@ -7,6 +7,7 @@ import org.junit.jupiter.api.Test; +@SuppressWarnings("deprecation") class EmploiDuTempsTest { @Test From 5a84c147dd6454ddeee7d0de420eb7d79c464623 Mon Sep 17 00:00:00 2001 From: MathieuSoysal Date: Tue, 19 Jan 2021 20:43:40 +0100 Subject: [PATCH 098/111] =?UTF-8?q?=E2=9C=85=20Mise=20=C3=A0=20jour=20test?= =?UTF-8?q?s=20:=20EmploiDuTempsProxyTest?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/test/java/edt/umontp/fr/EmploiDuTempsProxyTest.java | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/test/java/edt/umontp/fr/EmploiDuTempsProxyTest.java b/src/test/java/edt/umontp/fr/EmploiDuTempsProxyTest.java index 2af4ed6..e8e7490 100644 --- a/src/test/java/edt/umontp/fr/EmploiDuTempsProxyTest.java +++ b/src/test/java/edt/umontp/fr/EmploiDuTempsProxyTest.java @@ -25,7 +25,6 @@ void test_getInstance_retourneAucuneErreur() { @Test void test_getPlanningOf_date_plusRapide() { emploiDuTempsProxy = EmploiDuTempsProxy.getInstance(); - emploiDuTempsProxy.actualiser(); long tempsExecution1 = rapiditeGetPlanningOfDate(); long tempsExecution2 = rapiditeGetPlanningOfDate(); @@ -52,7 +51,6 @@ private long rapiditeGetPlanningOfDate() { @Test void test_getPlanningOf_Groupe_plusRapide() { emploiDuTempsProxy = EmploiDuTempsProxy.getInstance(); - emploiDuTempsProxy.actualiser(); long tempsExecution1 = rapiditeGetPlanningOfGroupe(); long tempsExecution2 = rapiditeGetPlanningOfGroupe(); @@ -77,9 +75,7 @@ private long rapiditeGetPlanningOfGroupe() { @Test void test_getPlanningOf_DateGroupe_plusRapide() { - emploiDuTempsProxy = EmploiDuTempsProxy.getInstance(); - emploiDuTempsProxy.actualiser(); long tempsExecution1 = rapiditeGetPlanningOfDateGroupe(); long tempsExecution2 = rapiditeGetPlanningOfDateGroupe(); @@ -105,9 +101,10 @@ private long rapiditeGetPlanningOfDateGroupe() { @Test void test_getPlanningOf_DateGroupe_plusRapideInteligent() { emploiDuTempsProxy = EmploiDuTempsProxy.getInstance(); - emploiDuTempsProxy.actualiser(); - long tempsExecution1 = rapiditeGetPlanningOfDate(); + long tempsExecution1 = rapiditeGetPlanningOfDateGroupe(); + emploiDuTempsProxy.actualiser(); + rapiditeGetPlanningOfDate(); long tempsExecution2 = rapiditeGetPlanningOfDateGroupe(); assertTrue(tempsExecution1 > tempsExecution2); From 9e53033630ae49d9af5c6f23e8fae9cb5e456fc8 Mon Sep 17 00:00:00 2001 From: MathieuSoysal Date: Wed, 20 Jan 2021 18:07:54 +0100 Subject: [PATCH 099/111] =?UTF-8?q?=E2=9E=95=20Ajout=20dependence=20Javado?= =?UTF-8?q?c?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 61 ++++++++++++------------- src/main/java/edt/umontp/fr/Groupe.java | 1 - 2 files changed, 28 insertions(+), 34 deletions(-) diff --git a/pom.xml b/pom.xml index 06f4769..8efdce5 100644 --- a/pom.xml +++ b/pom.xml @@ -1,7 +1,6 @@ - + 4.0.0 edt.umontp.fr @@ -45,46 +44,42 @@
- + + - - - maven-clean-plugin - 3.1.0 - - - - maven-resources-plugin - 3.0.2 - - - maven-compiler-plugin - 3.8.0 - + org.apache.maven.plugins maven-surefire-plugin - 2.22.1 + 3.0.0-M5 + + + . + src/test/java/** + + - maven-jar-plugin - 3.0.2 - - - maven-install-plugin - 2.5.2 - - - maven-deploy-plugin - 2.8.2 + org.apache.maven.plugins + maven-javadoc-plugin + 3.0.0 + + 11 + 11 + - - maven-site-plugin - 3.7.1 + org.apache.maven.plugins + maven-failsafe-plugin + 2.22.0 - maven-project-info-reports-plugin - 3.0.0 + org.apache.maven.plugins + maven-compiler-plugin + 3.8.1 + + 11 + 11 + diff --git a/src/main/java/edt/umontp/fr/Groupe.java b/src/main/java/edt/umontp/fr/Groupe.java index 97ee291..762a118 100644 --- a/src/main/java/edt/umontp/fr/Groupe.java +++ b/src/main/java/edt/umontp/fr/Groupe.java @@ -19,7 +19,6 @@ * l'enumération. *

* - * @see SDZLevel * * @author emerick-biron * @author MathieuSoysal From 2d6b46c7569377f38087ba0679adc3e6c9c1e086 Mon Sep 17 00:00:00 2001 From: MathieuSoysal Date: Wed, 20 Jan 2021 18:33:28 +0100 Subject: [PATCH 100/111] =?UTF-8?q?=E2=9C=85=20Mise=20=C3=A0=20jour=20des?= =?UTF-8?q?=20tests=20CoursTests?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/edt/umontp/fr/Cours.java | 9 ++++----- src/main/java/edt/umontp/fr/EmploiDuTemps.java | 2 ++ src/test/java/edt/umontp/fr/CoursTest.java | 6 ++++-- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/main/java/edt/umontp/fr/Cours.java b/src/main/java/edt/umontp/fr/Cours.java index f23757a..997ca0e 100644 --- a/src/main/java/edt/umontp/fr/Cours.java +++ b/src/main/java/edt/umontp/fr/Cours.java @@ -4,7 +4,6 @@ import java.time.Duration; import java.time.LocalDate; import java.time.LocalTime; -import java.time.ZoneId; import java.util.ArrayList; import java.util.Arrays; import java.util.List; @@ -37,7 +36,6 @@ * @version 1.0.0 */ public class Cours implements Comparable { - private final ZoneId ZONE_ID = ZoneId.of("Europe/Paris"); private LocalDate date; private String[] prof; private LocalTime heureDebut; @@ -70,6 +68,7 @@ public Cours(LocalDate date, String[] prof, LocalTime heureDebut, LocalTime heur * * @see Component */ + @SuppressWarnings("deprecation") Cours(Component vEvent) { Property summary = vEvent.getProperty(Property.SUMMARY); Property description = vEvent.getProperty(Property.DESCRIPTION); @@ -86,9 +85,9 @@ public Cours(LocalDate date, String[] prof, LocalTime heureDebut, LocalTime heur e.printStackTrace(); } - date = LocalDate.ofInstant(dateDebut.toInstant(), ZONE_ID); - heureDebut = LocalTime.ofInstant(dateDebut.toInstant(), ZONE_ID); - heureFin = LocalTime.ofInstant(dateFin.toInstant(), ZONE_ID); + date = LocalDate.ofInstant(dateDebut.toInstant(), EmploiDuTemps.ZONE_ID); + heureDebut = LocalTime.ofInstant(dateDebut.toInstant(), EmploiDuTemps.ZONE_ID); + heureFin = LocalTime.ofInstant(dateFin.toInstant(), EmploiDuTemps.ZONE_ID); lieu = location.getValue(); intitule = summary.getValue(); prof = getProfFromDesc(description.getValue()); diff --git a/src/main/java/edt/umontp/fr/EmploiDuTemps.java b/src/main/java/edt/umontp/fr/EmploiDuTemps.java index 667db10..7a8d6cd 100644 --- a/src/main/java/edt/umontp/fr/EmploiDuTemps.java +++ b/src/main/java/edt/umontp/fr/EmploiDuTemps.java @@ -9,6 +9,7 @@ import java.nio.file.Files; import java.nio.file.Paths; import java.time.LocalDate; +import java.time.ZoneId; import java.util.ArrayList; import net.fortuna.ical4j.data.CalendarBuilder; @@ -37,6 +38,7 @@ */ @Deprecated(forRemoval = false) public class EmploiDuTemps implements InterfaceEmploiDuTemps { + static final ZoneId ZONE_ID = ZoneId.of("Europe/Paris"); private static EmploiDuTemps singleton = null; private final String LIEN_ICAL = "https://proseconsult.umontpellier.fr/jsp/custom/modules/plannings/direct_cal" + ".jsp?data" diff --git a/src/test/java/edt/umontp/fr/CoursTest.java b/src/test/java/edt/umontp/fr/CoursTest.java index 8b06509..6ffab90 100644 --- a/src/test/java/edt/umontp/fr/CoursTest.java +++ b/src/test/java/edt/umontp/fr/CoursTest.java @@ -59,15 +59,17 @@ void test_constructeur_VEvent_dateBon() { } @Test + @SuppressWarnings("deprecation") void test_constructeur_VEvent_heureDebut_Bon() { Cours cours = new Cours(component); - assertEquals(LocalTime.of(15, 00), cours.getHeureDebut()); + assertEquals(LocalTime.now(EmploiDuTemps.ZONE_ID).of(15, 00), cours.getHeureDebut()); } @Test + @SuppressWarnings("deprecation") void test_constructeur_VEvent_heureFin_Bon() { Cours cours = new Cours(component); - assertEquals(LocalTime.of(16, 00), cours.getHeureFin()); + assertEquals(LocalTime.now(EmploiDuTemps.ZONE_ID).of(16, 00), cours.getHeureFin()); } @Test From efb5db3a9117d0ea49824e9b55269b097fb47cc4 Mon Sep 17 00:00:00 2001 From: MathieuSoysal Date: Wed, 20 Jan 2021 18:45:51 +0100 Subject: [PATCH 101/111] =?UTF-8?q?=E2=9C=85=20Correction=20des=20test=20C?= =?UTF-8?q?oursTests?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/test/java/edt/umontp/fr/CoursTest.java | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/test/java/edt/umontp/fr/CoursTest.java b/src/test/java/edt/umontp/fr/CoursTest.java index 6ffab90..37c1a86 100644 --- a/src/test/java/edt/umontp/fr/CoursTest.java +++ b/src/test/java/edt/umontp/fr/CoursTest.java @@ -59,17 +59,15 @@ void test_constructeur_VEvent_dateBon() { } @Test - @SuppressWarnings("deprecation") void test_constructeur_VEvent_heureDebut_Bon() { Cours cours = new Cours(component); - assertEquals(LocalTime.now(EmploiDuTemps.ZONE_ID).of(15, 00), cours.getHeureDebut()); + assertEquals(15, cours.getHeureDebut().getHour()); } @Test - @SuppressWarnings("deprecation") void test_constructeur_VEvent_heureFin_Bon() { Cours cours = new Cours(component); - assertEquals(LocalTime.now(EmploiDuTemps.ZONE_ID).of(16, 00), cours.getHeureFin()); + assertEquals(16, cours.getHeureFin().getHour()); } @Test From 45186bcb5be05975d2cac9248689c3d0b45497fb Mon Sep 17 00:00:00 2001 From: MathieuSoysal Date: Wed, 20 Jan 2021 21:12:17 +0100 Subject: [PATCH 102/111] =?UTF-8?q?=F0=9F=90=9B=20Fixasion=20du=20bug=20d?= =?UTF-8?q?=C3=BB=20=C3=A0=20la=20Localisation?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/edt/umontp/fr/Cours.java | 6 +++--- src/main/java/edt/umontp/fr/Planning.java | 2 +- src/test/java/edt/umontp/fr/CoursTest.java | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/main/java/edt/umontp/fr/Cours.java b/src/main/java/edt/umontp/fr/Cours.java index 997ca0e..37aa542 100644 --- a/src/main/java/edt/umontp/fr/Cours.java +++ b/src/main/java/edt/umontp/fr/Cours.java @@ -85,9 +85,9 @@ public Cours(LocalDate date, String[] prof, LocalTime heureDebut, LocalTime heur e.printStackTrace(); } - date = LocalDate.ofInstant(dateDebut.toInstant(), EmploiDuTemps.ZONE_ID); - heureDebut = LocalTime.ofInstant(dateDebut.toInstant(), EmploiDuTemps.ZONE_ID); - heureFin = LocalTime.ofInstant(dateFin.toInstant(), EmploiDuTemps.ZONE_ID); + date = LocalDate.of(dateDebut.getYear() + 1900, dateDebut.getMonth() + 1, dateDebut.getDate()); + heureDebut = LocalTime.of(dateDebut.getHours(), dateDebut.getMinutes()); + heureFin = LocalTime.of(dateFin.getHours(), dateFin.getMinutes()); lieu = location.getValue(); intitule = summary.getValue(); prof = getProfFromDesc(description.getValue()); diff --git a/src/main/java/edt/umontp/fr/Planning.java b/src/main/java/edt/umontp/fr/Planning.java index fa77299..6032d29 100644 --- a/src/main/java/edt/umontp/fr/Planning.java +++ b/src/main/java/edt/umontp/fr/Planning.java @@ -6,10 +6,10 @@ import java.util.Iterator; import java.util.SortedSet; import java.util.Spliterator; +import java.util.TreeSet; import java.util.function.Consumer; import java.util.stream.Collectors; -import edu.emory.mathcs.backport.java.util.TreeSet; /** * Planning est la classe représentant un planning de {@link Cours} de diff --git a/src/test/java/edt/umontp/fr/CoursTest.java b/src/test/java/edt/umontp/fr/CoursTest.java index 37c1a86..8b06509 100644 --- a/src/test/java/edt/umontp/fr/CoursTest.java +++ b/src/test/java/edt/umontp/fr/CoursTest.java @@ -61,13 +61,13 @@ void test_constructeur_VEvent_dateBon() { @Test void test_constructeur_VEvent_heureDebut_Bon() { Cours cours = new Cours(component); - assertEquals(15, cours.getHeureDebut().getHour()); + assertEquals(LocalTime.of(15, 00), cours.getHeureDebut()); } @Test void test_constructeur_VEvent_heureFin_Bon() { Cours cours = new Cours(component); - assertEquals(16, cours.getHeureFin().getHour()); + assertEquals(LocalTime.of(16, 00), cours.getHeureFin()); } @Test From 3773a3f5c1e0e78ed9df09783267b33dbd3af7bd Mon Sep 17 00:00:00 2001 From: MathieuSoysal Date: Wed, 20 Jan 2021 23:30:35 +0100 Subject: [PATCH 103/111] =?UTF-8?q?=F0=9F=93=9D=20Ajout=20badge=20Javadoc?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index eb1935c..b1c5d28 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,5 @@ ![GitHub Actions](https://github.com/DevLab-umontp/API-JAVA-EDT/workflows/Java%20CI%20with%20Maven/badge.svg) +[![Javadoc](https://img.shields.io/badge/JavaDoc-Online-green)](https://mathieusoysal.github.io/stats/api-java-edt) [![Gitmoji.dev](https://img.shields.io/badge/gitmoji-%20😜%20😍-FFDD67.svg?style=flat-square)](https://gitmoji.dev) # ![](ressources/devicon.png) API Java : EDT IUT Montpellier From 4c0611726da0caf13cd7c566eb1e4fd3df1a38f6 Mon Sep 17 00:00:00 2001 From: MathieuSoysal Date: Thu, 21 Jan 2021 11:23:20 +0100 Subject: [PATCH 104/111] =?UTF-8?q?=F0=9F=93=9D=20Mise=20=C3=A0=20jour=20d?= =?UTF-8?q?e=20la=20JavaDoc?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/edt/umontp/fr/EmploiDuTemps.java | 36 +++++++++++-- .../edt/umontp/fr/EmploiDuTempsProxy.java | 53 ++++++++++++++++--- src/main/java/edt/umontp/fr/Groupe.java | 4 +- .../edt/umontp/fr/InterfaceEmploiDuTemps.java | 2 +- src/main/java/edt/umontp/fr/Planning.java | 31 ++++++++++- 5 files changed, 113 insertions(+), 13 deletions(-) diff --git a/src/main/java/edt/umontp/fr/EmploiDuTemps.java b/src/main/java/edt/umontp/fr/EmploiDuTemps.java index 7a8d6cd..0855e7d 100644 --- a/src/main/java/edt/umontp/fr/EmploiDuTemps.java +++ b/src/main/java/edt/umontp/fr/EmploiDuTemps.java @@ -25,9 +25,9 @@ * instance de celle-ci. *

* - * @deprecated Pour l'utilisation de celle-ci il est préférable de passer par - * son proxy : {@link EmploiDuTempsProxy} afin d'avoir une meilleure - * optimisation. + * @deprecated Pour l'utilisation de la class EmploiDuTemps, il est préférable + * de passer par son proxy : {@link EmploiDuTempsProxy} afin d'avoir + * de meilleurs temps de réponse. * * @see InterfaceEmploiDuTemps * @see EmploiDuTempsProxy @@ -133,16 +133,46 @@ public void actualiser() { planningEmploisDuTemps = new Planning(coursList); } + /** + * Permet d'obtenir le planning correspondant à une date + * + * @param date date pour laquelle on veut obtenir le planning + * @return {@code Planning} correspondant + * @since 1.0 + * + * @see Planning + */ @Override public Planning getPlanningOf(LocalDate date) { return planningEmploisDuTemps.getPlanningOf(date); } + /** + * Permet d'obtenir le planning correspondant à une date et un groupe + * + * @param date date dont on veut obtenir le planning + * @param groupe groupe dont on veut obtenir le planning + * @return planning correspondant + * @since 1.0 + * + * @see Groupe + * @see Planning + */ @Override public Planning getPlanningOf(LocalDate date, Groupe groupe) { return planningEmploisDuTemps.getPlanningOf(date, groupe); } + /** + * Permet d'obtenir le planning correspondant à un groupe + * + * @param groupe groupe dont on veut obtenir le planning + * @return planning correspondant + * @since 1.0 + * + * @see Groupe + * @see Planning + */ @Override public Planning getPlanningOf(Groupe groupe) { return planningEmploisDuTemps.getPlanningOf(groupe); diff --git a/src/main/java/edt/umontp/fr/EmploiDuTempsProxy.java b/src/main/java/edt/umontp/fr/EmploiDuTempsProxy.java index f2f1254..cb4cdf9 100644 --- a/src/main/java/edt/umontp/fr/EmploiDuTempsProxy.java +++ b/src/main/java/edt/umontp/fr/EmploiDuTempsProxy.java @@ -5,14 +5,18 @@ import java.util.HashMap; /** - * EmploiDuTempsProxy est un classe qui permet de proposer un proxy pour - * l'emploi du temps - * - * @author emerick-biron, MathieuSoysal - * @version 1.0 + * EmploiDuTempsProxy est la classe représentant le proxy de la class + * {@link EmploiDuTemps}. + *

+ * L'instance d'EmploiDuTempsProxy est caractérisé par une liste de cache. + * + * @author emerick-biron + * @author MathieuSoysal + * @version 1.0.0 + * @see EmploiDuTemps * @see InterfaceEmploiDuTemps */ -public class EmploiDuTempsProxy implements InterfaceEmploiDuTemps { +public final class EmploiDuTempsProxy implements InterfaceEmploiDuTemps { private static EmploiDuTempsProxy singleton = null; @SuppressWarnings("deprecation") private EmploiDuTemps emploiDuTemps; @@ -26,6 +30,10 @@ private EmploiDuTempsProxy() { actualiser(); } + /** + * @return l'instance de {@link EmploiDuTempsProxy}. + * + */ public static EmploiDuTempsProxy getInstance() { EmploiDuTempsProxy localInstance = singleton; if (localInstance == null) { @@ -39,22 +47,55 @@ public static EmploiDuTempsProxy getInstance() { return localInstance; } + /** + * Permet d'obtenir le planning correspondant à une date + * + * @param date date pour laquelle on veut obtenir le planning + * @return {@code Planning} correspondant + * @since 1.0 + * + * @see Planning + */ @Override public Planning getPlanningOf(LocalDate date) { return cacheDate.computeIfAbsent(date, k -> emploiDuTemps.getPlanningOf(k)); } + /** + * Permet d'obtenir le planning correspondant à une date et un groupe + * + * @param date date dont on veut obtenir le planning + * @param groupe groupe dont on veut obtenir le planning + * @return planning correspondant + * @since 1.0 + * + * @see Groupe + * @see Planning + */ @Override public Planning getPlanningOf(LocalDate date, Groupe groupe) { MultiKey multiKey = new MultiKey<>(date, groupe); return cacheDateGroupe.computeIfAbsent(multiKey, k -> getPlanningOf(k.key1).getPlanningOf(k.key2)); } + /** + * Permet d'obtenir le planning correspondant à un groupe + * + * @param groupe groupe dont on veut obtenir le planning + * @return planning correspondant + * @since 1.0 + * + * @see Groupe + * @see Planning + */ @Override public Planning getPlanningOf(Groupe groupe) { return cacheGroupe.computeIfAbsent(groupe, k -> emploiDuTemps.getPlanningOf(k)); } + /** + * Permet d'actualiser l'emploi du temps avec celui de l'ent. + */ @SuppressWarnings("deprecation") @Override public void actualiser() { diff --git a/src/main/java/edt/umontp/fr/Groupe.java b/src/main/java/edt/umontp/fr/Groupe.java index 762a118..9bf701b 100644 --- a/src/main/java/edt/umontp/fr/Groupe.java +++ b/src/main/java/edt/umontp/fr/Groupe.java @@ -7,7 +7,7 @@ /** * Groupe est une enumeration qui permet de recenser les différents groupes - * d'enseignements de l'université + * d'élèves de l'université *

* Une instance de groupe est caractérisé par les informations suivantes : *

    @@ -15,7 +15,7 @@ *
  • Un groupe parent.
  • *
*

- * De plus, un {@link Groupe} ne pas être instancié, il faut donc utiliser + * De plus, un {@link Groupe} ne pas être instancié, il faut donc passer par * l'enumération. *

* diff --git a/src/main/java/edt/umontp/fr/InterfaceEmploiDuTemps.java b/src/main/java/edt/umontp/fr/InterfaceEmploiDuTemps.java index 1621e2b..f45a371 100644 --- a/src/main/java/edt/umontp/fr/InterfaceEmploiDuTemps.java +++ b/src/main/java/edt/umontp/fr/InterfaceEmploiDuTemps.java @@ -11,7 +11,7 @@ interface InterfaceEmploiDuTemps extends Planifiable { /** - * Permet d'actualiser l'emploi du temps + * Permet d'actualiser l'emploi du temps avec celui de l'ent. */ public void actualiser(); } diff --git a/src/main/java/edt/umontp/fr/Planning.java b/src/main/java/edt/umontp/fr/Planning.java index 6032d29..1a6902b 100644 --- a/src/main/java/edt/umontp/fr/Planning.java +++ b/src/main/java/edt/umontp/fr/Planning.java @@ -10,7 +10,6 @@ import java.util.function.Consumer; import java.util.stream.Collectors; - /** * Planning est la classe représentant un planning de {@link Cours} de * l'empois du temps de l'université. @@ -65,6 +64,15 @@ public String toString() { return res; } + /** + * Permet d'obtenir le planning correspondant à une date + * + * @param date date pour laquelle on veut obtenir le planning + * @return {@code Planning} correspondant + * @since 1.0 + * + * @see Planning + */ @Override public Planning getPlanningOf(LocalDate date) { ArrayList result = new ArrayList<>(); @@ -83,11 +91,32 @@ public Planning getPlanningOf(LocalDate date) { return new Planning(result); } + /** + * Permet d'obtenir le planning correspondant à une date et un groupe + * + * @param date date dont on veut obtenir le planning + * @param groupe groupe dont on veut obtenir le planning + * @return planning correspondant + * @since 1.0 + * + * @see Groupe + * @see Planning + */ @Override public Planning getPlanningOf(LocalDate date, Groupe groupe) { return getPlanningOf(date).getPlanningOf(groupe); } + /** + * Permet d'obtenir le planning correspondant à un groupe + * + * @param groupe groupe dont on veut obtenir le planning + * @return planning correspondant + * @since 1.0 + * + * @see Groupe + * @see Planning + */ @Override public Planning getPlanningOf(Groupe groupe) { return new Planning(cours.stream().filter(x -> Groupe.unGroupeDeGroupesEstContenuDans(x.getGroupes(), groupe)) From c0a64a7d4922197e0a6706c8c9c61e1357feb123 Mon Sep 17 00:00:00 2001 From: MathieuSoysal Date: Thu, 21 Jan 2021 11:56:00 +0100 Subject: [PATCH 105/111] =?UTF-8?q?=F0=9F=8E=A8=20l=C3=A9g=C3=A8re=20mise?= =?UTF-8?q?=20en=20forme=20du=20code?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/edt/umontp/fr/EmploiDuTemps.java | 2 +- src/main/java/edt/umontp/fr/EmploiDuTempsProxy.java | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main/java/edt/umontp/fr/EmploiDuTemps.java b/src/main/java/edt/umontp/fr/EmploiDuTemps.java index 0855e7d..4f2ab58 100644 --- a/src/main/java/edt/umontp/fr/EmploiDuTemps.java +++ b/src/main/java/edt/umontp/fr/EmploiDuTemps.java @@ -37,7 +37,7 @@ * @version 1.0.0 */ @Deprecated(forRemoval = false) -public class EmploiDuTemps implements InterfaceEmploiDuTemps { +public final class EmploiDuTemps implements InterfaceEmploiDuTemps { static final ZoneId ZONE_ID = ZoneId.of("Europe/Paris"); private static EmploiDuTemps singleton = null; private final String LIEN_ICAL = "https://proseconsult.umontpellier.fr/jsp/custom/modules/plannings/direct_cal" diff --git a/src/main/java/edt/umontp/fr/EmploiDuTempsProxy.java b/src/main/java/edt/umontp/fr/EmploiDuTempsProxy.java index cb4cdf9..773ae07 100644 --- a/src/main/java/edt/umontp/fr/EmploiDuTempsProxy.java +++ b/src/main/java/edt/umontp/fr/EmploiDuTempsProxy.java @@ -56,6 +56,7 @@ public static EmploiDuTempsProxy getInstance() { * * @see Planning */ + @SuppressWarnings("deprecation") @Override public Planning getPlanningOf(LocalDate date) { return cacheDate.computeIfAbsent(date, k -> emploiDuTemps.getPlanningOf(k)); @@ -88,6 +89,7 @@ public Planning getPlanningOf(LocalDate date, Groupe groupe) { * @see Groupe * @see Planning */ + @SuppressWarnings("deprecation") @Override public Planning getPlanningOf(Groupe groupe) { return cacheGroupe.computeIfAbsent(groupe, k -> emploiDuTemps.getPlanningOf(k)); @@ -124,7 +126,7 @@ public boolean equals(Object o) { if (o == null || getClass() != o.getClass()) return false; - MultiKey key = (MultiKey) o; + MultiKey key = (MultiKey) o; if (key1 != null ? !key1.equals(key.key1) : key.key1 != null) return false; From c0935a138ca498a90b68164d67cfd91b9fc74b95 Mon Sep 17 00:00:00 2001 From: MathieuSoysal Date: Thu, 21 Jan 2021 12:11:54 +0100 Subject: [PATCH 106/111] =?UTF-8?q?=E2=9C=85=20Ajout=20test=20non-valid?= =?UTF-8?q?=C3=A9=20PlanningTest=20=F0=9F=9B=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/test/java/edt/umontp/fr/PlanningTest.java | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/src/test/java/edt/umontp/fr/PlanningTest.java b/src/test/java/edt/umontp/fr/PlanningTest.java index c52ae4d..45e1393 100644 --- a/src/test/java/edt/umontp/fr/PlanningTest.java +++ b/src/test/java/edt/umontp/fr/PlanningTest.java @@ -51,15 +51,22 @@ void test_getPlanningOf_date() { @Test void test_getPlanningOf_groupe_simpleGroupe() { - Planning planningA1 = planning.getPlanningOf(Groupe.S3); - assertEquals(cours2, planningA1.iterator().next()); + Planning planningS3 = planning.getPlanningOf(Groupe.S3); + assertEquals(cours2, planningS3.iterator().next()); } - + @Test void test_getPlanningOf_groupe_groupeCompose() { Planning planningA1 = planning.getPlanningOf(Groupe.A1); - for (Cours cours : planningA1) - assertTrue(coursEnsemble.contains(cours)); + assertEquals(0, planningA1.getCours().size()); + } + + @Test + void test_getPlanningOf_sousGroupeDeA1_doitRetournerLeCoursA1() { + coursEnsemble.add(new Cours(LocalDate.of(2021, 1, 21), new String[] { "prof" }, LocalTime.of(14, 30), + LocalTime.of(15, 30), "K133", new Groupe[] { Groupe.A1 }, "Compta4")); + planning = new Planning(coursEnsemble); + assertEquals(1, planning.getPlanningOf(Groupe.S4).getCours().size()); } @Test From b9b1498578cddf7873bee0d4cd85cf726f1ce2b4 Mon Sep 17 00:00:00 2001 From: MathieuSoysal Date: Thu, 21 Jan 2021 12:54:41 +0100 Subject: [PATCH 107/111] =?UTF-8?q?=F0=9F=94=A8=20Validations=20de=20tous?= =?UTF-8?q?=20les=20tests=20PlanningTest?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/edt/umontp/fr/Groupe.java | 7 +++++-- src/main/java/edt/umontp/fr/Planning.java | 4 ++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/main/java/edt/umontp/fr/Groupe.java b/src/main/java/edt/umontp/fr/Groupe.java index 9bf701b..6b3a644 100644 --- a/src/main/java/edt/umontp/fr/Groupe.java +++ b/src/main/java/edt/umontp/fr/Groupe.java @@ -287,8 +287,11 @@ private boolean possedeGroupeParent() { * @see Groupe#groupeParent * @see Groupe#possedeGroupeParent() */ - public boolean estContenuDans(Groupe autreGroupe) { - return autreGroupe == this || (possedeGroupeParent() && groupeParent.estContenuDans(autreGroupe)); + public boolean estContenuDans(Groupe... autreGroupes) { + for (Groupe aGroupe : autreGroupes) + if (aGroupe == this || (possedeGroupeParent() && groupeParent.estContenuDans(aGroupe))) + return true; + return false; } /** diff --git a/src/main/java/edt/umontp/fr/Planning.java b/src/main/java/edt/umontp/fr/Planning.java index 1a6902b..ebee51d 100644 --- a/src/main/java/edt/umontp/fr/Planning.java +++ b/src/main/java/edt/umontp/fr/Planning.java @@ -119,8 +119,8 @@ public Planning getPlanningOf(LocalDate date, Groupe groupe) { */ @Override public Planning getPlanningOf(Groupe groupe) { - return new Planning(cours.stream().filter(x -> Groupe.unGroupeDeGroupesEstContenuDans(x.getGroupes(), groupe)) - .collect(Collectors.toList())); + return new Planning( + cours.stream().filter(c -> groupe.estContenuDans(c.getGroupes())).collect(Collectors.toList())); } /** From 5b64337b9912860c5f9441228fc7e7854ed2d78c Mon Sep 17 00:00:00 2001 From: MathieuSoysal Date: Thu, 21 Jan 2021 12:55:04 +0100 Subject: [PATCH 108/111] =?UTF-8?q?=E2=9C=85=20Mise=20=C3=A0=20jour=20test?= =?UTF-8?q?s=20:=20EmploiDuTempsProxyTest?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../edt/umontp/fr/EmploiDuTempsProxyTest.java | 25 ++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/src/test/java/edt/umontp/fr/EmploiDuTempsProxyTest.java b/src/test/java/edt/umontp/fr/EmploiDuTempsProxyTest.java index e8e7490..9c40f39 100644 --- a/src/test/java/edt/umontp/fr/EmploiDuTempsProxyTest.java +++ b/src/test/java/edt/umontp/fr/EmploiDuTempsProxyTest.java @@ -44,7 +44,17 @@ private long rapiditeGetPlanningOfDate() { emploiDuTempsProxy.getPlanningOf(LocalDate.now().plusDays(7)); emploiDuTempsProxy.getPlanningOf(LocalDate.now().plusDays(8)); emploiDuTempsProxy.getPlanningOf(LocalDate.now().plusDays(9)); - emploiDuTempsProxy.getPlanningOf(LocalDate.now().plusDays(10)); + emploiDuTempsProxy.getPlanningOf(LocalDate.now().plusDays(10)); emploiDuTempsProxy.getPlanningOf(LocalDate.now().plusDays(1)); + emploiDuTempsProxy.getPlanningOf(LocalDate.now().plusDays(11)); emploiDuTempsProxy.getPlanningOf(LocalDate.now().plusDays(1)); + emploiDuTempsProxy.getPlanningOf(LocalDate.now().plusDays(12)); + emploiDuTempsProxy.getPlanningOf(LocalDate.now().plusDays(13)); + emploiDuTempsProxy.getPlanningOf(LocalDate.now().plusDays(14)); + emploiDuTempsProxy.getPlanningOf(LocalDate.now().plusDays(15)); + emploiDuTempsProxy.getPlanningOf(LocalDate.now().plusDays(16)); + emploiDuTempsProxy.getPlanningOf(LocalDate.now().plusDays(17)); + emploiDuTempsProxy.getPlanningOf(LocalDate.now().plusDays(18)); + emploiDuTempsProxy.getPlanningOf(LocalDate.now().plusDays(19)); + return System.currentTimeMillis() - startTime; } @@ -60,6 +70,10 @@ void test_getPlanningOf_Groupe_plusRapide() { private long rapiditeGetPlanningOfGroupe() { long startTime = System.currentTimeMillis(); + emploiDuTempsProxy.getPlanningOf(Groupe.S1); + emploiDuTempsProxy.getPlanningOf(Groupe.S2); + emploiDuTempsProxy.getPlanningOf(Groupe.S3); + emploiDuTempsProxy.getPlanningOf(Groupe.S4); emploiDuTempsProxy.getPlanningOf(Groupe.A1); emploiDuTempsProxy.getPlanningOf(Groupe.Q1); emploiDuTempsProxy.getPlanningOf(Groupe.Q2); @@ -95,6 +109,15 @@ private long rapiditeGetPlanningOfDateGroupe() { emploiDuTempsProxy.getPlanningOf(LocalDate.now().plusDays(8), Groupe.G3); emploiDuTempsProxy.getPlanningOf(LocalDate.now().plusDays(9), Groupe.G4); emploiDuTempsProxy.getPlanningOf(LocalDate.now().plusDays(10), Groupe.A2); + emploiDuTempsProxy.getPlanningOf(LocalDate.now().plusDays(11), Groupe.A1); + emploiDuTempsProxy.getPlanningOf(LocalDate.now().plusDays(12), Groupe.Q1); + emploiDuTempsProxy.getPlanningOf(LocalDate.now().plusDays(13), Groupe.Q2); + emploiDuTempsProxy.getPlanningOf(LocalDate.now().plusDays(14), Groupe.Q3); + emploiDuTempsProxy.getPlanningOf(LocalDate.now().plusDays(15), Groupe.Q4); + emploiDuTempsProxy.getPlanningOf(LocalDate.now().plusDays(16), Groupe.G1); + emploiDuTempsProxy.getPlanningOf(LocalDate.now().plusDays(17), Groupe.G2); + emploiDuTempsProxy.getPlanningOf(LocalDate.now().plusDays(18), Groupe.G3); + emploiDuTempsProxy.getPlanningOf(LocalDate.now().plusDays(19), Groupe.G4); return System.currentTimeMillis() - startTime; } From 369a058a08170d9f7cdbdde80b97ed95444ce9bb Mon Sep 17 00:00:00 2001 From: MathieuSoysal Date: Thu, 21 Jan 2021 12:57:13 +0100 Subject: [PATCH 109/111] =?UTF-8?q?=F0=9F=94=A5=20Suppression=20m=C3=A9tho?= =?UTF-8?q?de=20obsol=C3=A8te?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/edt/umontp/fr/Groupe.java | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/src/main/java/edt/umontp/fr/Groupe.java b/src/main/java/edt/umontp/fr/Groupe.java index 6b3a644..a03ae0f 100644 --- a/src/main/java/edt/umontp/fr/Groupe.java +++ b/src/main/java/edt/umontp/fr/Groupe.java @@ -22,7 +22,7 @@ * * @author emerick-biron * @author MathieuSoysal - * @version 1.0.0 + * @version 1.2.0 */ public enum Groupe { /** @@ -293,19 +293,4 @@ public boolean estContenuDans(Groupe... autreGroupes) { return true; return false; } - - /** - * Retourn vrai si l'un des groupe de {@code groupes} est contenu dans le groupe - * {@code autreGroupe} - * - * @return {@code boolean} - * - * @see Groupe#estContenuDans(Groupe) - */ - static boolean unGroupeDeGroupesEstContenuDans(Groupe[] groupes, Groupe autreGroupe) { - for (Groupe groupe : groupes) - if (groupe.estContenuDans(autreGroupe)) - return true; - return false; - } } From fffa276df3734d3edfa05f1a1ac2025add4d2f17 Mon Sep 17 00:00:00 2001 From: emerick-biron Date: Thu, 21 Jan 2021 12:58:00 +0100 Subject: [PATCH 110/111] :hammer: maj toString Cours --- src/main/java/edt/umontp/fr/Cours.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/edt/umontp/fr/Cours.java b/src/main/java/edt/umontp/fr/Cours.java index 37aa542..6f50036 100644 --- a/src/main/java/edt/umontp/fr/Cours.java +++ b/src/main/java/edt/umontp/fr/Cours.java @@ -193,7 +193,7 @@ public String getIntitule() { @Override public String toString() { - return intitule.toUpperCase(Locale.ROOT) + " :\n Date : " + date + "\n Commence à " + heureDebut + " jusqu'à " + return intitule.toUpperCase(Locale.ROOT) + " :\n Date : " + date + "\n Commence à " + heureDebut + " finit à " + heureFin + "\n Enseignant :" + Arrays.toString(prof) + " \n Localisation : " + lieu + " \n Groupe : " + Arrays.toString(groupes); } From 9ec521d9f03a33cce98a81fde78a0d537c831d0d Mon Sep 17 00:00:00 2001 From: emerick-biron Date: Thu, 21 Jan 2021 12:58:37 +0100 Subject: [PATCH 111/111] :hammer: maj toString Cours --- src/main/java/edt/umontp/fr/Cours.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/edt/umontp/fr/Cours.java b/src/main/java/edt/umontp/fr/Cours.java index 6f50036..c0f992f 100644 --- a/src/main/java/edt/umontp/fr/Cours.java +++ b/src/main/java/edt/umontp/fr/Cours.java @@ -193,7 +193,7 @@ public String getIntitule() { @Override public String toString() { - return intitule.toUpperCase(Locale.ROOT) + " :\n Date : " + date + "\n Commence à " + heureDebut + " finit à " + return intitule.toUpperCase(Locale.ROOT) + " :\n Date : " + date + "\n Commence à " + heureDebut + ", finit à " + heureFin + "\n Enseignant :" + Arrays.toString(prof) + " \n Localisation : " + lieu + " \n Groupe : " + Arrays.toString(groupes); }