我就是測試一下
阿新 • • 發佈:2018-03-21
package ring box eat urn iou mem 測試 ()
package com.xfcz.behaviour.memento.blankbox;
public class Originator {
private String state;
public IMemento createMemento(){
return new Memento(state);
}
public void restoreMemento(IMemento menmento){
this.setState(((Memento)menmento).getState());
}
public String getState() {
return state;
}
public void setState(String state) {
System.out.println("當前狀態:"+state);
this.state = state;
}
private class Memento implements IMemento{
private String state;
public Memento(String state){
setState(state);
}
public String getState() {
return state;
}
public void setState(String state) {
this.state = state;
}
}
}
我就是測試一下