Diseño de aplicaciones orientadas a objetos
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
|
package patronMemento;
|
|
|
|
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
|
|
|
|
|
//es el Cuidador, el que almacena los mementos.
|
|
|
|
|
public class Conserje {
|
|
|
|
|
|
|
|
|
|
private ArrayList<Memento> mementos = new ArrayList<Memento>();
|
|
|
|
|
|
|
|
|
|
public void addMemento(Memento m) {
|
|
|
|
|
mementos.add(m);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//Recuperar el memento de una posici<EFBFBD>n.
|
|
|
|
|
public Memento getMemento(int i) {
|
|
|
|
|
return mementos.get(i);
|
|
|
|
|
}
|
|
|
|
|
}
|