Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package ejercicio5;
- import ejercicio4.Partido;
- import java.time.LocalDate;
- import java.util.ArrayList;
- public class Competicion extends Torneo{
- private ArrayList<String> contratodos = new ArrayList<String>();
- private ArrayList<ArrayList<String>> categorias = new ArrayList<ArrayList<String>>();
- private ArrayList<Partido> partidos;
- public Competicion(String ubicacion, LocalDate fecha) {
- super(ubicacion, fecha);
- }
- @Override
- public void inscribir(String equipo, tipotorneo tipo, int categoria){
- int j = 0;
- boolean esta = false;
- if (tipo == tipotorneo.CONTRA_TODOS){
- if (this.contratodos.isEmpty())
- this.contratodos.add(equipo);
- else if (!this.contratodos.contains(equipo))
- this.contratodos.add(equipo);
- }
- else if (tipo == tipotorneo.CATEGORIAS){
- if (this.categorias.isEmpty()){
- for (int i=0;i<5;i++)
- this.categorias.add(i, new ArrayList<String>());
- this.categorias.get(categoria).add(equipo);
- }
- else{
- while (j < this.categorias.size() && !esta){
- if (this.categorias.get(j).contains(equipo))
- esta = true;
- j++;
- }
- if (!esta)
- this.categorias.get(categoria).add(equipo);
- }
- }
- }
- @Override
- public void generar(){
- /*int ran,len,i= 0,j = 0;
- Partido par;
- if (super.est == estado.EN_ESPERA){
- super.est = estado.EN_PROCESO;
- }
- else throw new IllegalArgumentException();
- while (this.inscripciones[i] != null){
- par = new Partido(super.ubicacion,super.fecha);
- par.fijarlocal(this.inscripciones.get(i));
- if (this.inscripciones[i+1]!= null)
- par.fijarvisitante(this.inscripciones[i+1]);
- else
- par.fijarvisitante("");
- this.partidos[j] = par;
- i = i+2;
- j++;
- } */
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement