Free cookie consent management tool by TermsFeed Policy Generator

source: branches/HeuristicLab.Problems.GrammaticalOptimization/DynamicDataDisplay/Common/UndoSystem/LambdaUndoAction.cs @ 12503

Last change on this file since 12503 was 12503, checked in by aballeit, 9 years ago

#2283 added GUI and charts; fixed MCTS

File size: 719 bytes
Line 
1using System;
2using System.Collections.Generic;
3using System.Linq;
4using System.Text;
5
6namespace Microsoft.Research.DynamicDataDisplay.Common.UndoSystem
7{
8  public sealed class LambdaUndoAction : UndoAction
9  {
10    private readonly Action doAction;
11    private readonly Action undoAction;
12
13    public LambdaUndoAction(Action doAction, Action undoAction)
14    {
15      if (doAction == null)
16        throw new ArgumentNullException("doHander");
17      if (undoAction == null)
18        throw new ArgumentNullException("undoAction");
19
20      this.doAction = doAction;
21      this.undoAction = undoAction;
22    }
23
24    public override void Do()
25    {
26      doAction();
27    }
28
29    public override void Undo()
30    {
31      undoAction();
32    }
33  }
34}
Note: See TracBrowser for help on using the repository browser.