20 lines
571 B
Java
20 lines
571 B
Java
package learn.simple_memento;
|
|
|
|
public class Main {
|
|
public static void main(String[] args) {
|
|
Originator originator = new Originator();
|
|
CareTaker careTaker = new CareTaker();
|
|
|
|
originator.setState("blue");
|
|
originator.setState("red");
|
|
careTaker.save(originator.createMemento());
|
|
originator.setState("yellow");
|
|
careTaker.save(originator.createMemento());
|
|
originator.setState("white");
|
|
|
|
careTaker.revert(originator);
|
|
careTaker.revert(originator);
|
|
careTaker.revert(originator);
|
|
}
|
|
}
|