public void setMemento(Memento memento) => state = memento.state;
// Restores original state public void SetMemento(Memento memento) { Console.WriteLine("Restoring state..."); State = memento.State; }
public Memento SaveMemento() { var memento = new Memento(); return memento.Serialize(this); }
public void RestoreMemento(Memento memento) { Originator s = (Originator)memento.Deserialize(); this.state = s.state; }
public void GetStateFromMemento(Memento memento) { state = memento.GetState(); }
public void Revert(Memento m) { Tokens = m.Tokens.ToList(); }