wtf


SUBMITTED BY: putri

DATE: April 24, 2016, 1:34 a.m.

FORMAT: Text only

SIZE: 17.3 kB

HITS: 690

  1. //
  2. // Source code recreated from a .class file by IntelliJ IDEA
  3. // (powered by Fernflower decompiler)
  4. //
  5. import java.util.ArrayList;
  6. import java.util.Scanner;
  7. public class Corrige {
  8. private static ArrayList<String> prenoms = new ArrayList();
  9. private static ArrayList<String> noms = new ArrayList();
  10. private static ArrayList<String> unites = new ArrayList();
  11. private static ArrayList<String> courriels = new ArrayList();
  12. private static ArrayList<Integer> postes = new ArrayList();
  13. private static ArrayList<String> locaux = new ArrayList();
  14. public Corrige() {
  15. }
  16. public static void main(String[] args) {
  17. Scanner sc = new Scanner(System.in);
  18. int option;
  19. label107:
  20. do {
  21. afficherMenuPrincipal();
  22. option = sc.nextInt();
  23. int option2;
  24. int option3;
  25. String nouveauCourriel;
  26. String nouvelleUnite;
  27. String nouveauLocal;
  28. int nouveauPoste;
  29. String nouvelleUnite1;
  30. String nouveauLocal1;
  31. String var12;
  32. switch(option) {
  33. case 1:
  34. label104:
  35. do {
  36. afficherMenuRecherche();
  37. option2 = sc.nextInt();
  38. ArrayList var14;
  39. int var15;
  40. switch(option2) {
  41. case 1:
  42. System.out.println("saisissez l expression a rechercher");
  43. var12 = sc.nextLine();
  44. var14 = rechercheRapide(var12);
  45. var15 = 0;
  46. while(true) {
  47. if(var15 >= var14.size()) {
  48. continue label104;
  49. }
  50. imprimerEntree(((Integer)var14.get(var15)).intValue());
  51. ++var15;
  52. }
  53. case 2:
  54. do {
  55. afficherMenuRechercheAvancee();
  56. option3 = sc.nextInt();
  57. var14 = new ArrayList();
  58. switch(option3) {
  59. case 1:
  60. System.out.println("Saissez le nom?");
  61. nouveauCourriel = sc.next();
  62. var14 = rechercheAvancee(nouveauCourriel, "nom");
  63. break;
  64. case 2:
  65. System.out.println("Saissez le prenom?");
  66. nouvelleUnite = sc.next();
  67. var14 = rechercheAvancee(nouvelleUnite, "prenom");
  68. break;
  69. case 3:
  70. System.out.println("Saissez le courriel?");
  71. nouveauLocal = sc.next();
  72. var14 = rechercheAvancee(nouveauLocal, "courriel");
  73. break;
  74. case 4:
  75. System.out.println("Saisissez le numero de poste?");
  76. nouveauPoste = sc.nextInt();
  77. var14 = rechercheAvancee(String.valueOf(nouveauPoste), "poste");
  78. break;
  79. case 5:
  80. System.out.println("Saisissez l unite?");
  81. nouvelleUnite1 = sc.next();
  82. var14 = rechercheAvancee(nouvelleUnite1, "unite");
  83. break;
  84. case 6:
  85. System.out.println("Saisissez le local?");
  86. nouveauLocal1 = sc.next();
  87. var14 = rechercheAvancee(nouveauLocal1, "local");
  88. }
  89. for(var15 = 0; var15 < var14.size(); ++var15) {
  90. imprimerEntree(((Integer)var14.get(var15)).intValue());
  91. }
  92. } while(option3 != 99);
  93. }
  94. } while(option2 != 99);
  95. break;
  96. case 2:
  97. while(true) {
  98. afficherMenuConfiguration();
  99. option2 = sc.nextInt();
  100. for(option3 = 0; option3 < prenoms.size(); ++option3) {
  101. imprimerEntree(option3);
  102. }
  103. label73:
  104. switch(option2) {
  105. case 1:
  106. System.out.println("Saisissez l entree a modifier");
  107. option3 = sc.nextInt();
  108. while(true) {
  109. afficherMenuModification();
  110. int var13 = sc.nextInt();
  111. switch(var13) {
  112. case 1:
  113. System.out.println("Saisissez le nouveau nom?");
  114. nouveauCourriel = sc.next();
  115. modifier(option3 - 1, "nom", nouveauCourriel);
  116. break;
  117. case 2:
  118. System.out.println("Saisissez le nouveau prenom?");
  119. nouvelleUnite = sc.next();
  120. modifier(option3 - 1, "prenom", nouvelleUnite);
  121. break;
  122. case 3:
  123. System.out.println("Saisissez le nouveau courriel?");
  124. nouveauLocal = sc.next();
  125. modifier(option3 - 1, "courriel", nouveauLocal);
  126. break;
  127. case 4:
  128. System.out.println("Saisissez le nouveau poste?");
  129. nouveauPoste = sc.nextInt();
  130. modifier(option3 - 1, "poste", String.valueOf(nouveauPoste));
  131. break;
  132. case 5:
  133. System.out.println("Saisissez la nouvelle unite?");
  134. nouvelleUnite1 = sc.next();
  135. modifier(option3 - 1, "unite", nouvelleUnite1);
  136. break;
  137. case 6:
  138. System.out.println("Saisissez le nouveau local?");
  139. nouveauLocal1 = sc.next();
  140. modifier(option3 - 1, "local", nouveauLocal1);
  141. }
  142. if(var13 == 99) {
  143. break label73;
  144. }
  145. }
  146. case 2:
  147. System.out.println("Saissez le nouveau nom");
  148. var12 = sc.next();
  149. System.out.println("Saissez le nouveau prenom");
  150. String nouveauPrenom = sc.next();
  151. System.out.println("Saissez le nouveau courriel");
  152. nouveauCourriel = sc.next();
  153. System.out.println("Saissez la nouvelle unite");
  154. nouvelleUnite = sc.next();
  155. System.out.println("Saissez le nouveau local");
  156. nouveauLocal = sc.next();
  157. System.out.println("Saissez le nouveau poste");
  158. nouveauPoste = sc.nextInt();
  159. ajouter(nouveauPrenom, var12, nouveauCourriel, nouvelleUnite, nouveauLocal, nouveauPoste);
  160. break;
  161. case 3:
  162. System.out.println("Saissez l entree a eliminer");
  163. option3 = sc.nextInt();
  164. eliminer(option3 - 1);
  165. }
  166. if(option2 == 99) {
  167. continue label107;
  168. }
  169. }
  170. case 99:
  171. System.out.println("merci et bye");
  172. }
  173. } while(option != 99);
  174. }
  175. public static void imprimerEntree(int indice) {
  176. System.out.println("Entree " + (indice + 1));
  177. System.out.println("Prenom: " + (String)prenoms.get(indice));
  178. System.out.println("Nom: " + (String)noms.get(indice));
  179. System.out.println("Courriel: " + (String)courriels.get(indice));
  180. System.out.println("Unite: " + (String)unites.get(indice));
  181. System.out.println("Local: " + (String)locaux.get(indice));
  182. System.out.println("Poste: " + postes.get(indice));
  183. }
  184. public static void afficherMenuRecherche() {
  185. System.out.println("Menu recherche");
  186. System.out.println("1. Recherche rapide");
  187. System.out.println("2. Recherche avancee");
  188. System.out.println("99. Quitter");
  189. }
  190. public static void afficherMenuRechercheAvancee() {
  191. System.out.println("Menu recherche avancee");
  192. System.out.println("1. recherche par nom");
  193. System.out.println("2. recherche par prenom");
  194. System.out.println("3. recherche par courriel");
  195. System.out.println("4. recherche par poste");
  196. System.out.println("5. recherche par unite");
  197. System.out.println("6. recherche par local");
  198. System.out.println("99. Quitter");
  199. }
  200. public static void afficherMenuModification() {
  201. System.out.println("Menu moddification");
  202. System.out.println("1. modifier nom");
  203. System.out.println("2. modifier prenom");
  204. System.out.println("3. modifier courriel");
  205. System.out.println("4. modifier poste");
  206. System.out.println("5. modifier unite");
  207. System.out.println("6. modifier local");
  208. System.out.println("99. Quitter");
  209. }
  210. public static void afficherMenuPrincipal() {
  211. System.out.println("Menu principal");
  212. System.out.println("1. Recherche");
  213. System.out.println("2. Configurer");
  214. System.out.println("99. Quitter");
  215. }
  216. public static void afficherMenuConfiguration() {
  217. System.out.println("Menu configuration");
  218. System.out.println("1. Modifier entree");
  219. System.out.println("2. Ajouter entree");
  220. System.out.println("3. Supprimer entree");
  221. System.out.println("99. Quitter");
  222. }
  223. public static ArrayList<Integer> rechercheRapide(String saisi) {
  224. ArrayList returnList = new ArrayList();
  225. int tailleBottin = prenoms.size();
  226. for(int i = 0; i < tailleBottin; ++i) {
  227. String prenom = (String)prenoms.get(i);
  228. String nom = (String)noms.get(i);
  229. String unite = (String)unites.get(i);
  230. String courriel = (String)courriels.get(i);
  231. Integer poste = (Integer)postes.get(i);
  232. String local = (String)locaux.get(i);
  233. if(prenom.contains(saisi)) {
  234. returnList.add(Integer.valueOf(i));
  235. } else if(nom.contains(saisi)) {
  236. returnList.add(Integer.valueOf(i));
  237. } else if(unite.contains(saisi)) {
  238. returnList.add(Integer.valueOf(i));
  239. } else if(courriel.contains(saisi)) {
  240. returnList.add(Integer.valueOf(i));
  241. } else if(poste.toString().contains(saisi)) {
  242. returnList.add(Integer.valueOf(i));
  243. } else if(local.contains(saisi)) {
  244. returnList.add(Integer.valueOf(i));
  245. }
  246. }
  247. return returnList;
  248. }
  249. public static ArrayList<Integer> rechercheAvancee(String saisi, String cas) {
  250. ArrayList returnList = new ArrayList();
  251. int tailleBottin = prenoms.size();
  252. byte var5 = -1;
  253. switch(cas.hashCode()) {
  254. case -980102839:
  255. if(cas.equals("prenom")) {
  256. var5 = 0;
  257. }
  258. break;
  259. case -368382809:
  260. if(cas.equals("courriel")) {
  261. var5 = 3;
  262. }
  263. break;
  264. case 109260:
  265. if(cas.equals("nom")) {
  266. var5 = 1;
  267. }
  268. break;
  269. case 103145323:
  270. if(cas.equals("local")) {
  271. var5 = 4;
  272. }
  273. break;
  274. case 106855365:
  275. if(cas.equals("poste")) {
  276. var5 = 5;
  277. }
  278. break;
  279. case 111433569:
  280. if(cas.equals("unite")) {
  281. var5 = 2;
  282. }
  283. }
  284. int i;
  285. String var8;
  286. switch(var5) {
  287. case 0:
  288. for(i = 0; i < tailleBottin; ++i) {
  289. var8 = (String)prenoms.get(i);
  290. if(var8.contains(saisi)) {
  291. returnList.add(Integer.valueOf(i));
  292. }
  293. }
  294. return returnList;
  295. case 1:
  296. for(i = 0; i < tailleBottin; ++i) {
  297. var8 = (String)noms.get(i);
  298. if(var8.contains(saisi)) {
  299. returnList.add(Integer.valueOf(i));
  300. }
  301. }
  302. return returnList;
  303. case 2:
  304. for(i = 0; i < tailleBottin; ++i) {
  305. var8 = (String)unites.get(i);
  306. if(var8.contains(saisi)) {
  307. returnList.add(Integer.valueOf(i));
  308. }
  309. }
  310. return returnList;
  311. case 3:
  312. for(i = 0; i < tailleBottin; ++i) {
  313. var8 = (String)courriels.get(i);
  314. if(var8.contains(saisi)) {
  315. returnList.add(Integer.valueOf(i));
  316. }
  317. }
  318. return returnList;
  319. case 4:
  320. for(i = 0; i < tailleBottin; ++i) {
  321. var8 = (String)locaux.get(i);
  322. if(var8.contains(saisi)) {
  323. returnList.add(Integer.valueOf(i));
  324. }
  325. }
  326. return returnList;
  327. case 5:
  328. for(i = 0; i < tailleBottin; ++i) {
  329. Integer poste = (Integer)postes.get(i);
  330. if(poste.toString().compareTo(saisi) == 0) {
  331. returnList.add(Integer.valueOf(i));
  332. }
  333. }
  334. }
  335. return returnList;
  336. }
  337. public static void modifier(int indice, String cas, String saisi) {
  338. byte var4 = -1;
  339. switch(cas.hashCode()) {
  340. case -980102839:
  341. if(cas.equals("prenom")) {
  342. var4 = 0;
  343. }
  344. break;
  345. case -368382809:
  346. if(cas.equals("courriel")) {
  347. var4 = 3;
  348. }
  349. break;
  350. case 109260:
  351. if(cas.equals("nom")) {
  352. var4 = 1;
  353. }
  354. break;
  355. case 103145323:
  356. if(cas.equals("local")) {
  357. var4 = 2;
  358. }
  359. break;
  360. case 106855365:
  361. if(cas.equals("poste")) {
  362. var4 = 5;
  363. }
  364. break;
  365. case 111433569:
  366. if(cas.equals("unite")) {
  367. var4 = 4;
  368. }
  369. }
  370. switch(var4) {
  371. case 0:
  372. modifierString(indice, saisi, prenoms);
  373. break;
  374. case 1:
  375. modifierString(indice, saisi, noms);
  376. break;
  377. case 2:
  378. modifierString(indice, saisi, locaux);
  379. break;
  380. case 3:
  381. modifierString(indice, saisi, courriels);
  382. break;
  383. case 4:
  384. modifierString(indice, saisi, unites);
  385. break;
  386. case 5:
  387. modifierInteger(indice, Integer.valueOf(Integer.parseInt(saisi)), postes);
  388. }
  389. }
  390. private static void modifierString(int indice, String saisi, ArrayList<String> alist) {
  391. alist.set(indice, saisi);
  392. }
  393. private static void modifierInteger(int indice, Integer saisi, ArrayList<Integer> alist) {
  394. alist.set(indice, saisi);
  395. }
  396. public static void eliminer(int indice) {
  397. int tailleBottin = prenoms.size();
  398. if(indice < tailleBottin) {
  399. prenoms.remove(indice);
  400. noms.remove(indice);
  401. courriels.remove(indice);
  402. unites.remove(indice);
  403. locaux.remove(indice);
  404. postes.remove(indice);
  405. }
  406. }
  407. public static void ajouter(String prenom, String nom, String courriel, String unite, String local, int poste) {
  408. prenoms.add(prenom);
  409. noms.add(nom);
  410. courriels.add(courriel);
  411. unites.add(unite);
  412. locaux.add(local);
  413. postes.add(Integer.valueOf(poste));
  414. }
  415. }

comments powered by Disqus