From b2ebfe848e7b1773676c7419c9411cc5d7df4cbd Mon Sep 17 00:00:00 2001 From: Simoes Lukas Date: Thu, 22 Jan 2026 14:28:35 +0100 Subject: [PATCH] ANDROID WE --- DEV3.2/CM1/01_Division/Main.class | Bin 0 -> 1711 bytes DEV3.2/CM1/01_Division/Main.java | 31 +++++ DEV3.2/TP08/02_Authentification/ABR.class | Bin 0 -> 2356 bytes DEV3.2/TP08/02_Authentification/ABR.java | 112 ++++++++++++++++++ .../Authentification.class | Bin 2871 -> 2792 bytes .../02_Authentification/Authentification.java | 23 ++-- .../01_Chat/v1/activity_main.xml | 47 ++++++++ 7 files changed, 202 insertions(+), 11 deletions(-) create mode 100644 DEV3.2/CM1/01_Division/Main.class create mode 100644 DEV3.2/CM1/01_Division/Main.java create mode 100644 DEV3.2/TP08/02_Authentification/ABR.class create mode 100644 DEV3.2/TP08/02_Authentification/ABR.java create mode 100644 DEV4.5/TP01_Mise_en_page/01_Chat/v1/activity_main.xml diff --git a/DEV3.2/CM1/01_Division/Main.class b/DEV3.2/CM1/01_Division/Main.class new file mode 100644 index 0000000000000000000000000000000000000000..a4651326c24f5187fbd689a9fe49512565e85523 GIT binary patch literal 1711 zcmX^0Z`VEs1_pD6WG)6V1|@a|WiAFL5Us++z`~#kBGf>HI*8B!$!W4PXn|;LZU%V< z9T1_*$)LxeFT}vWV9do}!eGk5UTAf|l$IR_qMcj0|ixnR%Hdc8mDC~Pyul@j$=SY%1z`2;3^wcxwu}s1!TF^{$*FFcAR{<^6EpMlK)QJt#2F+Q8AL#A z{nC=m9DT>4qQpv<)WXtKMg~E!FxUdmypq)P)FK`RI|h4@CI=n{M+PSz24@Br9tKwi zH%10|gkp$$-SUfa6H8nxl2Z#xGV}9z7~B~=co;kxym%PA8GP6oe0doB82lL-1f25o zONvX15(|7&OEU6Piuu_X0yr1~c^HBig4r2Dco;$%!WbDCco@P#v;e{$h_6BFA{ZH1 zK%Qb`K$7-P%1TWxVPp`-5>ku|LSS>ie)cR$ElMoOFJffiC`c?SPW8+yVPp{1z!JWm zj0`Lqo}ggn$jmDVOUwZU6SIbL&@!Z7hROkG>Rhn(keIP%WDo|2GO8tv46FqpD{+Kz7$XBaSUx9@kwFdFCa9@c zEMjMf1|@@dMg|qIgn$tC$kmFx_Oj0|i(`T5zU1&jXrHmO2%nTe13=CU#GcZMNXJGb$ z(!N@Ly8Fynn9W#4Sw&eEF_`FzvKm>j?Pg$!lw{k%z`C7*&5B(|l6@Nk`wj+to9GA{prT4x&rx1a7#1|CL+nGABeI~jNx84fV8Sg~wk;FDz8#lX+N zu#G`r`TzTy82E$)w=oE5W7QxG*C2wfVIu=0gBpVagEIrDv|s2rxJ^@G-bD@H2Qba54lk2s30ch%l5hh%!_$h%+=XNHWZ3kYZTD zAkDCvL6%`NgB*h_0|SE>1IK>`Nd`7{203;HCNPp?WMp9Y&!EY`jw;B`Ak4tX&cOAH zf&B*q>mLRdb_V%h49b5PcpwZ0W(EZY1_mYuMTR&A1_mw$Mur%M1cq1!Nd^N31_llW LMg~I$Mg}7Q5f7tu literal 0 HcmV?d00001 diff --git a/DEV3.2/CM1/01_Division/Main.java b/DEV3.2/CM1/01_Division/Main.java new file mode 100644 index 0000000..28b2f3a --- /dev/null +++ b/DEV3.2/CM1/01_Division/Main.java @@ -0,0 +1,31 @@ +import java.util.ArrayDeque; +import java.util.Queue; + +public class Main { + public static void main(String[] args) { + ArrayDeque textes = new ArrayDeque<>(); + ArrayDeque entiers = new ArrayDeque<>(); + + for (String chaine : args) { + try { + Integer entier = new Integer(Integer.parseInt(chaine)); + + entiers.addLast(entier.intValue()); + } catch (NumberFormatException e) { + textes.addLast(chaine); + } + } + + for (Integer entier : entiers) { + System.out.print(entier + " "); + } + + System.out.println(""); + + for (String texte : textes) { + System.out.print(texte + " "); + } + + System.out.println(""); + } +} \ No newline at end of file diff --git a/DEV3.2/TP08/02_Authentification/ABR.class b/DEV3.2/TP08/02_Authentification/ABR.class new file mode 100644 index 0000000000000000000000000000000000000000..824c89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ya(hM04atv7vW(?V2*Kjg0 x{b3McXVB$jU}n$*Yt?6nV_;z5Vqj#5VMt(zWsqcW24@*21{VfK23IiY0RYDF39SGC literal 0 HcmV?d00001 diff --git a/DEV3.2/TP08/02_Authentification/ABR.java b/DEV3.2/TP08/02_Authentification/ABR.java new file mode 100644 index 0000000..ada1da0 --- /dev/null +++ b/DEV3.2/TP08/02_Authentification/ABR.java @@ -0,0 +1,112 @@ +public class ABR { + + private String valeur; + private ABR filsGauche; + private ABR filsDroit; + private int compteur = 0; + + public ABR() { + this.valeur = null; + this.filsDroit = null; + this.filsGauche = null; + } + + public ABR(String valeur) { + this.valeur = valeur; + } + + + public boolean authentifier(String id, String password) { + + // Si le noeud courant est vide, aller dans le fils gauche + if (this.valeur == null) { + if (this.filsGauche != null) { + return this.filsGauche.authentifier(id, password); + } + return false; // rien dans l'arbre + } + + // Si on trouve l'id au noeud courant + if (this.valeur.equals(id)) { + if (this.filsDroit != null && this.filsDroit.valeur.equals(password)) { + return true; + } + return false; + } + + // Sinon, continuer à gauche + if (this.filsGauche != null) { + return this.filsGauche.authentifier(id, password); + } + + return false; +} + + + public void supprimer(String id) { + if (this.filsGauche != null) { + if (this.filsGauche.valeur.equals(id)) { + if (this.filsGauche.filsGauche != null) { + this.filsGauche = this.filsGauche.filsGauche; + } else { + this.filsGauche = null; + } + System.out.println("Suppression effectuée."); + } else { + this.filsGauche.supprimer(id); + } + } + } + + + public void ajouterUtilisateur(String id, String password) { + if (this.filsGauche != null && this.filsGauche.equals(id)) { + System.out.println("Valeur déjà présente."); + return; + } + + if (this.filsGauche != null) { + this.filsGauche.ajouterUtilisateur(id, password); + } else { + this.filsGauche = new ABR(id); + this.filsGauche.filsDroit = new ABR(password); + } + } + + public boolean estPresent(String id) { + if (this.filsGauche == null) { + return false; + } + + if (this.compteur == 0) { + this.compteur++; + this.filsGauche.estPresent(id); + } + + if (this.compteur != 0 && this.valeur == null) { + return false; + } + + if (this.valeur.equals(id)) { + return true; + } else { + return this.filsGauche.estPresent(id); + } + } + + public String toString() { + String aRenvoyer = ""; + + if (this.filsDroit == null && this.filsGauche == null) { + return ""; + } else { + if (this.filsGauche == null) { + return ""; + } else { + aRenvoyer += "Identifiant : " + this.filsGauche.valeur + " / Mot de passe : " + this.filsGauche.filsDroit.valeur + "\n"; + return aRenvoyer + this.filsGauche.toString(); + } + } + } + +} \ No newline at end of file diff --git a/DEV3.2/TP08/02_Authentification/Authentification.class b/DEV3.2/TP08/02_Authentification/Authentification.class index a94c555a9cd21c6faeff933825b84fcb3eebc8cf..de7814e8989fd653bebd691a77019597fefbfc15 100644 GIT binary patch delta 1441 zcmdlk_CmD&)W2Q(7#JAL8D?-X=rTC4GdOZFFfllAG6*p^fmqI*3@!|=LJSNHo?HxG z4Bj9y9}Wgz5XVo5fe|Fk#1O#25GcgJ1mOe=F)%ZDvNMEoF$jT73}a^q2bmJV#URQM z$;BYT5XHd|&A|}E#b6`K5X-?32Qn-kB$2?ukjTYgGqG1vFPMWNgPkE0q%n(wA)B2c zhl3%Pogt5rfhQ$1xg;|`FE25(D3y_c)yL5(XtEOHA;$d4j~KP;4Hyg=8JHcNf_ND8 z81#7<3K@#n8H#xrN*GER83dg2^Gk|LiV_QaQ%f@PQ;PZ77|J*p%6S+n7%JHrs(2Wx z87z4iY8Xrz8AL)$GIKJE6H8J{ixd*G@=Hq&uhau6sO4a&<6$sosApu5^GQ|6%`Z_% zNmVFFEG|w}NS(ZjiJ!B9hrxoul7pdf@*yU#z$S)f9tH!377)?O$iTqJz*1P6S;E86 z#?a2lz+|Vu!_Wb;wUeQXk%3WxhoPIHhmnCfF(rkE!35+Imc-JM43Lecj10^vsX3El znGKnH8A>NlWX|ys$Vx0r)Xz!GOVEiMTtN-a*!D`8|1 z)xcDu88tb8#hAH|p?`84ONX`)*w3j&NWp-n&p#BrWllxe; zCQo7&o_vKhadIK6;$%~{B(@2l;GHsgE}JIfw8_WWwlYqiT+8k!smlNg3noxBF)%Q& zGB7e2Fc>m0G8j#M!>(9w%)r3F$H2_Mz`()4!obPE&%njN2nr973I+y-90q2vteMsp z1{UpY46HL5gf=m-Y42iSXJFXIz_FY`1T3Soje&C$1Dg=nHU^GO3~V5=Z4BHS85kIt z7(jMNF|aW(Fz_;PGw?A;F$gdyGYB$hGYC5~m@26qN| zu(hlV%u-_942+k6rY#reSMw=t+K zXAsvFk^+mdEoa~c*`p4M#{cbBESnfKg|xQSGjJ^bUj^amfTeObGJulLG=`ZB8Vq_2 z(-@X9XhWkljzOG(fkB6XgF%l$iot+EmcfWYjlqOL4;-GB40a5*4DJke3}FoR4Dk#O z40#NW4CM??3{4Eq41El44AU5V8D=tgGR$W1Vpz=J%dm{WJD*_%gAc<7249BF4F2Fi zQfA=%#~{njAjHlf!p>mxhrxoK!B$+D`xgVd6FY;34?BZ44+ArU9XPSsGfZY+04L&! g3{x2{q8vp9f3k|9D2%pjRCE(RfxdEx8~5g;=n zxfnzlqPQ4D7@|2CVmKILIT+%&80x(l;z42w91Mvdqmnonl0h0%I2ckvbQ%XkI*88T zV8~==$O0LZ&B2hv&XCK&kjKuD&&a@&l9^nRnV*-Jm|2v{$iVNDl~|UjUs{rxqwkwo zV9m(D8JwA(msnB?k~Kw@wegv}j!kB=J|jD$-Nf66CNE&rh%jU@Vq_3R7~+vwoZ*{T zz{8-+pvTTo$iq;?P|VIy!oyI?P{zn0;FOa2G>2BLkxX4?_<_ zFCznUVoC}RgDHafjK?3gpomQ@^n|gvl~29qh~nr6r6E z7LyOM3QvB|CdUp_bDl+I@^)6m$oXfOyf z7%+%3m@_aixUeuV$p|wrff?(G`EY?T(REdF?L772@L6t$BL5;zfK?7_n$fIHmoD9|sHXutU z`*P~l^Uh+J017YZZ45Fx+ZbepG+ diff --git a/DEV3.2/TP08/02_Authentification/Authentification.java b/DEV3.2/TP08/02_Authentification/Authentification.java index 7bd5462..e6f0aef 100644 --- a/DEV3.2/TP08/02_Authentification/Authentification.java +++ b/DEV3.2/TP08/02_Authentification/Authentification.java @@ -1,42 +1,43 @@ import java.awt.*; -import java.util.HashMap; -import java.util.Map; import java.io.*; public class Authentification { - private Map dictionnaire; + private ABR dictionnaire; public Authentification() { - this.dictionnaire = new HashMap<>(); + this.dictionnaire = new ABR(); } public void ajouter(String username, String password) { - if (this.dictionnaire.get(username) != null) { + if (this.dictionnaire.estPresent(username)) { System.out.println("L'utilisateur '" + username + "' existe déjà."); } else { - this.dictionnaire.put(username, password); + this.dictionnaire.ajouterUtilisateur(username, password); System.out.println("Utilisateur ajouté."); } + System.out.println(this.dictionnaire); } public void authentifier(String username, String password) { - if (this.dictionnaire.get(username) == null) { + if (!this.dictionnaire.estPresent(username)) { System.out.println("L'utilisateur '" + username + "' n'existe pas."); - } else if (!this.dictionnaire.get(username).equals(password)) { + } else if (!this.dictionnaire.authentifier(username, password)) { System.out.println("Le mot de passe est incorrect."); } else { System.out.println("L'utilisateur '" + username + "' est authentifié."); } + System.out.println(this.dictionnaire); } public void supprimer(String username) { - if (this.dictionnaire.get(username) == null) { + if (!this.dictionnaire.estPresent(username)) { System.out.println("L'utilisateur '" + username + "' n'existe pas."); } else { - this.dictionnaire.remove(username); + this.dictionnaire.supprimer(username); System.out.println("L'utilisateur '" + username + "' a été supprimé"); } + System.out.println(this.dictionnaire); } public static void main(String[] args) { @@ -63,7 +64,7 @@ public class Authentification { auth.authentifier(ligne[1], ligne[2]); } else if (input.equals("del")) { auth.supprimer(ligne[1]); - } else if (input.equals("quit")) { + } else. if (input.equals("quit")) { } else { System.out.println("Commande non reconnue."); diff --git a/DEV4.5/TP01_Mise_en_page/01_Chat/v1/activity_main.xml b/DEV4.5/TP01_Mise_en_page/01_Chat/v1/activity_main.xml new file mode 100644 index 0000000..c8c4d1d --- /dev/null +++ b/DEV4.5/TP01_Mise_en_page/01_Chat/v1/activity_main.xml @@ -0,0 +1,47 @@ + + + + + + + + + + + +