class Originator {
private String state;
public void SetState(String state) {
this.state = state;
}
public String GetState() {
return state;
}
public Memento CreateMemento() {
return (
new Memento(state));
}
public void SetMemento(Memento memento) {
state = memento.GetState();
}
public void Show() {
System.out.println("State = " + state);
}
}