Skip to content
Snippets Groups Projects
Commit 571b9143 authored by carmuno's avatar carmuno :tennis:
Browse files

Merge remote-tracking branch 'origin/master'

parents 05348526 d47dc0c7
No related branches found
No related tags found
No related merge requests found
......@@ -3,9 +3,9 @@ package Ordinario2015_16;
import java.util.ArrayList;
/*
*
* @author Carlos Noé Muñoz
* @author Sergio Gómez Conde.
* @version 1.0
* @version 1.2
*/
public class Buffer<E extends Prioridad> {//almacena objetos que esos objetos implementan esa interfaz, de ahi que
......@@ -15,31 +15,25 @@ public class Buffer<E extends Prioridad> {//almacena objetos que esos objetos i
public Buffer() {
lista = new ArrayList<>();
}
//ojo este metodo creoq eu esta correcto pq introduces con orden de prioridad pero
//tb mantienes dentro orden de llegada?
public void mete(E c) {
public void mete(E e) {
if (e.prioridad() == 0) {
lista.add(0, e);
} else if (e.prioridad() == 1) {
for (int i = 0; i < lista.size(); i++) {
if (lista.get(i).prioridad() == 1) {
lista.add(i, e);
}
}
} else {
for (int i = 0; i < lista.size(); i++) {
if (lista.get(i).prioridad() == 2) {
lista.add(i, e);
}
if(lista.get(0).isEmpty){throws new NullPointerException();}
for(int i = 0; i < arraybuffer.size(); i++) throw NullPointerException {
if((arraybuffer.get(i).getPrioridad()) < c.getPrioridad()) {
arraybuffer.add(i, c);
}
}
}
public E primero() {
public E atender() throw NullPointerException{
if(lista.get(0).isEmpty){throws new NullPointerException();}
return lista.get(0);
}
public void saca() {
public void saca() throw NullPointerException {
if(lista.get(0).isEmpty){throws new NullPointerException();}
lista.remove(0);
}
......
......@@ -48,32 +48,15 @@ public class Coleccion <E extends Play> {
}
public boolean listavacia() {
return lista.isEmpty();
}
public ArrayList<E> getLista(){
return (ArrayList<E>) lista.clone();
}
public Coleccion <E> concatenar(Coleccion<E> collecion){
Coleccion <E> newColeccion = new Coleccion<E>();
for(E play : lista) {
newColeccion.add(play);
}
for(E play : collecion.getLista()) {
newColeccion.add(play);
}
return newColeccion;
public void concatenaColeccion(Coleccion<E> c) {
coleccion.addAll(c.obtenerColeccion());
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment