Exemplo n.º 1
0
        private void PopChoice()
        {
            CurrentStates[0].ClearState();
            CurrentStates.Clear();
            if (_statesStack.Count == 0)
            {
                throw new Exception("Choice stack is empty. Unable to fallback to another state.");
            }

            StateMemento memento = _statesStack.Pop();

            _inx  = memento.TokenIndex;
            _move = memento.Move + 1;
            CurrentStates.Add(memento.State);
        }
Exemplo n.º 2
0
        public void Memento(StateMemento state)
        {
            switch (state)
            {
            case StateMemento.Clean:
                Clean = true;
                break;

            case StateMemento.Creating:
                Creating = true;
                break;

            case StateMemento.Dirty:
                Dirty = true;
                break;

            case StateMemento.Hollow:
                Hollow = true;
                break;
            }

            #endregion
        }
Exemplo n.º 3
0
 public void Load(StateMemento stateMemento)
 {
     _state       = stateMemento.State;
     _hiddenState = stateMemento.HiddenState;
 }