Esempio n. 1
0
 private static State Redo(State state, Command.AddCircle command)
 {
     return(new State(
                state.Circles.Concat(new[] { command.Circle }).ToArray(),
                command.Circle,
                new[] { command }.Concat(state.UndoStack).ToArray(),
                state.RedoStack.Except(new [] { command }).ToArray()
                ));
 }
Esempio n. 2
0
 private static State Apply(State state, Command.AddCircle command)
 {
     return(new State(
                state.Circles.Concat(new[] { command.Circle }).ToArray(),
                command.Circle,
                new[] { command }.Concat(state.UndoStack).ToArray(),
                Enumerable.Empty <ICommand>()
                ));
 }
Esempio n. 3
0
        private static State Undo(State state, Command.AddCircle command)
        {
            var circle = state.Circles.Where(c => c.Equals(command.Circle)).First();

            return(new State(
                       state.Circles.Except(new[] { circle }).ToArray(),
                       null,
                       state.UndoStack.Except(new[] { command }).ToArray(),
                       new[] { command }.Concat(state.RedoStack).ToArray()
                       ));
        }