Exemplo 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()
                ));
 }
Exemplo 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>()
                ));
 }
Exemplo 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()
                       ));
        }