Advertisement
Guest User

Competicion.java

a guest
Oct 18th, 2017
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.17 KB | None | 0 0
  1. package ejercicio5;
  2.  
  3. import ejercicio4.Partido;
  4. import java.time.LocalDate;
  5. import java.util.ArrayList;
  6.  
  7. public class Competicion extends Torneo{
  8.  
  9. private ArrayList<String> contratodos = new ArrayList<String>();
  10. private ArrayList<ArrayList<String>> categorias = new ArrayList<ArrayList<String>>();
  11. private ArrayList<Partido> partidos;
  12.  
  13. public Competicion(String ubicacion, LocalDate fecha) {
  14. super(ubicacion, fecha);
  15. }
  16.  
  17. @Override
  18. public void inscribir(String equipo, tipotorneo tipo, int categoria){
  19. int j = 0;
  20. boolean esta = false;
  21.  
  22. if (tipo == tipotorneo.CONTRA_TODOS){
  23. if (this.contratodos.isEmpty())
  24. this.contratodos.add(equipo);
  25. else if (!this.contratodos.contains(equipo))
  26. this.contratodos.add(equipo);
  27. }
  28.  
  29. else if (tipo == tipotorneo.CATEGORIAS){
  30. if (this.categorias.isEmpty()){
  31. for (int i=0;i<5;i++)
  32. this.categorias.add(i, new ArrayList<String>());
  33. this.categorias.get(categoria).add(equipo);
  34. }
  35. else{
  36. while (j < this.categorias.size() && !esta){
  37. if (this.categorias.get(j).contains(equipo))
  38. esta = true;
  39. j++;
  40. }
  41. if (!esta)
  42. this.categorias.get(categoria).add(equipo);
  43. }
  44. }
  45. }
  46.  
  47. @Override
  48. public void generar(){
  49. /*int ran,len,i= 0,j = 0;
  50. Partido par;
  51. if (super.est == estado.EN_ESPERA){
  52. super.est = estado.EN_PROCESO;
  53. }
  54. else throw new IllegalArgumentException();
  55. while (this.inscripciones[i] != null){
  56. par = new Partido(super.ubicacion,super.fecha);
  57. par.fijarlocal(this.inscripciones.get(i));
  58. if (this.inscripciones[i+1]!= null)
  59. par.fijarvisitante(this.inscripciones[i+1]);
  60. else
  61. par.fijarvisitante("");
  62. this.partidos[j] = par;
  63. i = i+2;
  64. j++;
  65. } */
  66. }
  67. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement