Free cookie consent management tool by TermsFeed Policy Generator

Changeset 2687


Ignore:
Timestamp:
01/27/10 03:55:16 (15 years ago)
Author:
swagner
Message:

Operator architecture refactoring (#95)

  • implemented ideas which came up during today's presentation of HeuristicLab.Core and related plugins
Location:
trunk/sources
Files:
3 added
23 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Common.Resources/3.2/HeuristicLab.Common.Resources-3.2.csproj

    r2650 r2687  
    309309    <None Include="Resources\VS2008ImageLibrary\VS2008ImageLibrary_Actions_Undo.png" />
    310310  </ItemGroup>
     311  <ItemGroup>
     312    <None Include="Resources\VS2008ImageLibrary\VS2008ImageLibrary_Actions_Windows.png" />
     313  </ItemGroup>
    311314  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
    312315  <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
  • trunk/sources/HeuristicLab.Common.Resources/3.2/VS2008ImageLibrary.Designer.cs

    r2650 r2687  
    452452            }
    453453        }
     454       
     455        public static System.Drawing.Bitmap Windows {
     456            get {
     457                object obj = ResourceManager.GetObject("Windows", resourceCulture);
     458                return ((System.Drawing.Bitmap)(obj));
     459            }
     460        }
    454461    }
    455462}
  • trunk/sources/HeuristicLab.Common.Resources/3.2/VS2008ImageLibrary.resx

    r2650 r2687  
    287287    <value>Resources\VS2008ImageLibrary\VS2008ImageLibrary_Objects_ValueType.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
    288288  </data>
     289  <data name="Windows" type="System.Resources.ResXFileRef, System.Windows.Forms">
     290    <value>Resources\VS2008ImageLibrary\VS2008ImageLibrary_Actions_Windows.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
     291  </data>
    289292</root>
  • trunk/sources/HeuristicLab.Core.Views/3.3/EngineView.Designer.cs

    r2676 r2687  
    4848      this.executionTimeTextBox = new System.Windows.Forms.TextBox();
    4949      this.executionTimeLabel = new System.Windows.Forms.Label();
    50       this.splitContainer = new System.Windows.Forms.SplitContainer();
    5150      this.operatorGraphView = new HeuristicLab.Core.Views.OperatorGraphView();
    5251      this.scopeView = new HeuristicLab.Core.Views.ScopeView();
     
    5554      this.startButton = new System.Windows.Forms.Button();
    5655      this.toolTip = new System.Windows.Forms.ToolTip(this.components);
    57       this.splitContainer.Panel1.SuspendLayout();
    58       this.splitContainer.Panel2.SuspendLayout();
    59       this.splitContainer.SuspendLayout();
     56      this.tabControl = new System.Windows.Forms.TabControl();
     57      this.operatorGraphTabPage = new System.Windows.Forms.TabPage();
     58      this.globalScopeTabPage = new System.Windows.Forms.TabPage();
     59      this.tabControl.SuspendLayout();
     60      this.operatorGraphTabPage.SuspendLayout();
     61      this.globalScopeTabPage.SuspendLayout();
    6062      this.SuspendLayout();
    6163      //
     
    6365      //
    6466      this.executionTimeTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
    65       this.executionTimeTextBox.Location = new System.Drawing.Point(655, 620);
     67      this.executionTimeTextBox.Location = new System.Drawing.Point(661, 620);
    6668      this.executionTimeTextBox.Name = "executionTimeTextBox";
    6769      this.executionTimeTextBox.ReadOnly = true;
    6870      this.executionTimeTextBox.Size = new System.Drawing.Size(141, 20);
    69       this.executionTimeTextBox.TabIndex = 4;
     71      this.executionTimeTextBox.TabIndex = 5;
    7072      //
    7173      // executionTimeLabel
     
    7375      this.executionTimeLabel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
    7476      this.executionTimeLabel.AutoSize = true;
    75       this.executionTimeLabel.Location = new System.Drawing.Point(566, 623);
     77      this.executionTimeLabel.Location = new System.Drawing.Point(572, 623);
    7678      this.executionTimeLabel.Name = "executionTimeLabel";
    7779      this.executionTimeLabel.Size = new System.Drawing.Size(83, 13);
    78       this.executionTimeLabel.TabIndex = 3;
     80      this.executionTimeLabel.TabIndex = 4;
    7981      this.executionTimeLabel.Text = "&Execution Time:";
    80       //
    81       // splitContainer
    82       //
    83       this.splitContainer.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
    84                   | System.Windows.Forms.AnchorStyles.Left)
    85                   | System.Windows.Forms.AnchorStyles.Right)));
    86       this.splitContainer.Location = new System.Drawing.Point(0, 0);
    87       this.splitContainer.Name = "splitContainer";
    88       //
    89       // splitContainer.Panel1
    90       //
    91       this.splitContainer.Panel1.Controls.Add(this.operatorGraphView);
    92       //
    93       // splitContainer.Panel2
    94       //
    95       this.splitContainer.Panel2.Controls.Add(this.scopeView);
    96       this.splitContainer.Size = new System.Drawing.Size(802, 611);
    97       this.splitContainer.SplitterDistance = 401;
    98       this.splitContainer.TabIndex = 0;
    9982      //
    10083      // operatorGraphView
     
    10588      this.operatorGraphView.Caption = "Operator Graph";
    10689      this.operatorGraphView.Item = null;
    107       this.operatorGraphView.Location = new System.Drawing.Point(3, 3);
     90      this.operatorGraphView.Location = new System.Drawing.Point(6, 6);
    10891      this.operatorGraphView.Name = "operatorGraphView";
    10992      this.operatorGraphView.Object = null;
    11093      this.operatorGraphView.OperatorGraph = null;
    111       this.operatorGraphView.Size = new System.Drawing.Size(395, 605);
     94      this.operatorGraphView.Size = new System.Drawing.Size(782, 573);
    11295      this.operatorGraphView.TabIndex = 0;
    11396      //
     
    119102      this.scopeView.Caption = "Scope";
    120103      this.scopeView.Item = null;
    121       this.scopeView.Location = new System.Drawing.Point(3, 3);
     104      this.scopeView.Location = new System.Drawing.Point(6, 6);
    122105      this.scopeView.Name = "scopeView";
    123106      this.scopeView.Object = null;
    124107      this.scopeView.Scope = null;
    125       this.scopeView.Size = new System.Drawing.Size(391, 605);
     108      this.scopeView.Size = new System.Drawing.Size(782, 573);
    126109      this.scopeView.TabIndex = 0;
    127110      //
     
    130113      this.resetButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
    131114      this.resetButton.Image = HeuristicLab.Common.Resources.VS2008ImageLibrary.Restart;
    132       this.resetButton.Location = new System.Drawing.Point(63, 617);
     115      this.resetButton.Location = new System.Drawing.Point(58, 617);
    133116      this.resetButton.Name = "resetButton";
    134117      this.resetButton.Size = new System.Drawing.Size(23, 23);
    135       this.resetButton.TabIndex = 2;
     118      this.resetButton.TabIndex = 3;
    136119      this.toolTip.SetToolTip(this.resetButton, "Reset Engine");
    137120      this.resetButton.UseVisualStyleBackColor = true;
     
    143126      this.stopButton.Enabled = false;
    144127      this.stopButton.Image = HeuristicLab.Common.Resources.VS2008ImageLibrary.Stop;
    145       this.stopButton.Location = new System.Drawing.Point(34, 617);
     128      this.stopButton.Location = new System.Drawing.Point(29, 617);
    146129      this.stopButton.Name = "stopButton";
    147130      this.stopButton.Size = new System.Drawing.Size(23, 23);
    148       this.stopButton.TabIndex = 1;
     131      this.stopButton.TabIndex = 2;
    149132      this.toolTip.SetToolTip(this.stopButton, "Stop Engine");
    150133      this.stopButton.UseVisualStyleBackColor = true;
     
    155138      this.startButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
    156139      this.startButton.Image = HeuristicLab.Common.Resources.VS2008ImageLibrary.Play;
    157       this.startButton.Location = new System.Drawing.Point(5, 617);
     140      this.startButton.Location = new System.Drawing.Point(0, 617);
    158141      this.startButton.Name = "startButton";
    159142      this.startButton.Size = new System.Drawing.Size(23, 23);
    160       this.startButton.TabIndex = 0;
     143      this.startButton.TabIndex = 1;
    161144      this.toolTip.SetToolTip(this.startButton, "Start Engine");
    162145      this.startButton.UseVisualStyleBackColor = true;
    163146      this.startButton.Click += new System.EventHandler(this.startButton_Click);
    164147      //
     148      // tabControl
     149      //
     150      this.tabControl.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
     151                  | System.Windows.Forms.AnchorStyles.Left)
     152                  | System.Windows.Forms.AnchorStyles.Right)));
     153      this.tabControl.Controls.Add(this.operatorGraphTabPage);
     154      this.tabControl.Controls.Add(this.globalScopeTabPage);
     155      this.tabControl.Location = new System.Drawing.Point(0, 0);
     156      this.tabControl.Name = "tabControl";
     157      this.tabControl.SelectedIndex = 0;
     158      this.tabControl.Size = new System.Drawing.Size(802, 611);
     159      this.tabControl.TabIndex = 0;
     160      //
     161      // operatorGraphTabPage
     162      //
     163      this.operatorGraphTabPage.Controls.Add(this.operatorGraphView);
     164      this.operatorGraphTabPage.Location = new System.Drawing.Point(4, 22);
     165      this.operatorGraphTabPage.Name = "operatorGraphTabPage";
     166      this.operatorGraphTabPage.Padding = new System.Windows.Forms.Padding(3);
     167      this.operatorGraphTabPage.Size = new System.Drawing.Size(794, 585);
     168      this.operatorGraphTabPage.TabIndex = 0;
     169      this.operatorGraphTabPage.Text = "Operator Graph";
     170      this.operatorGraphTabPage.UseVisualStyleBackColor = true;
     171      //
     172      // globalScopeTabPage
     173      //
     174      this.globalScopeTabPage.Controls.Add(this.scopeView);
     175      this.globalScopeTabPage.Location = new System.Drawing.Point(4, 22);
     176      this.globalScopeTabPage.Name = "globalScopeTabPage";
     177      this.globalScopeTabPage.Padding = new System.Windows.Forms.Padding(3);
     178      this.globalScopeTabPage.Size = new System.Drawing.Size(794, 585);
     179      this.globalScopeTabPage.TabIndex = 1;
     180      this.globalScopeTabPage.Text = "Global Scope";
     181      this.globalScopeTabPage.UseVisualStyleBackColor = true;
     182      //
    165183      // EngineView
    166184      //
    167185      this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
    168186      this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
     187      this.Controls.Add(this.tabControl);
    169188      this.Controls.Add(this.executionTimeTextBox);
    170189      this.Controls.Add(this.stopButton);
    171190      this.Controls.Add(this.executionTimeLabel);
    172       this.Controls.Add(this.splitContainer);
    173191      this.Controls.Add(this.resetButton);
    174192      this.Controls.Add(this.startButton);
    175193      this.Name = "EngineView";
    176194      this.Size = new System.Drawing.Size(802, 640);
    177       this.splitContainer.Panel1.ResumeLayout(false);
    178       this.splitContainer.Panel2.ResumeLayout(false);
    179       this.splitContainer.ResumeLayout(false);
     195      this.tabControl.ResumeLayout(false);
     196      this.operatorGraphTabPage.ResumeLayout(false);
     197      this.globalScopeTabPage.ResumeLayout(false);
    180198      this.ResumeLayout(false);
    181199      this.PerformLayout();
     
    187205    protected System.Windows.Forms.TextBox executionTimeTextBox;
    188206    protected System.Windows.Forms.Label executionTimeLabel;
    189     protected System.Windows.Forms.SplitContainer splitContainer;
    190207    protected System.Windows.Forms.Button resetButton;
    191208    protected System.Windows.Forms.Button stopButton;
     
    194211    protected HeuristicLab.Core.Views.ScopeView scopeView;
    195212    protected System.Windows.Forms.ToolTip toolTip;
     213    protected System.Windows.Forms.TabControl tabControl;
     214    protected System.Windows.Forms.TabPage operatorGraphTabPage;
     215    protected System.Windows.Forms.TabPage globalScopeTabPage;
    196216
    197217  }
  • trunk/sources/HeuristicLab.Core.Views/3.3/ScopeListView.cs

    r2655 r2687  
    1212namespace HeuristicLab.Core.Views {
    1313  [Content(typeof(ScopeList), true)]
    14   [Content(typeof(IObservableList<Scope>), true)]
    15   public partial class ScopeListView : ItemListView<Scope> {
     14  [Content(typeof(IObservableList<IScope>), true)]
     15  public partial class ScopeListView : ItemListView<IScope> {
    1616    /// <summary>
    1717    /// Initializes a new instance of <see cref="VariablesScopeView"/> with caption "Variables Scope View".
     
    2828    /// <remarks>Calls <see cref="VariablesScopeView()"/>.</remarks>
    2929    /// <param name="scope">The scope whose variables should be represented visually.</param>
    30     public ScopeListView(IObservableList<Scope> scopeList)
     30    public ScopeListView(IObservableList<IScope> scopeList)
    3131      : this() {
    3232      ItemList = scopeList;
  • trunk/sources/HeuristicLab.Core.Views/3.3/ScopeView.cs

    r2676 r2687  
    3838  [Content(typeof(Scope), true)]
    3939  public sealed partial class ScopeView : ItemView {
    40     private Dictionary<Scope, TreeNode> scopeNodeTable;
    41     private Dictionary<ScopeList, Scope> subScopesScopeTable;
     40    private Dictionary<IScope, TreeNode> scopeNodeTable;
     41    private Dictionary<ScopeList, IScope> subScopesScopeTable;
    4242
    4343    /// <summary>
     
    4646    /// <remarks>Uses property <see cref="ViewBase.Item"/> of base class <see cref="ViewBase"/>.
    4747    /// No own data storage present.</remarks>
    48     public Scope Scope {
    49       get { return (Scope)Item; }
     48    public IScope Scope {
     49      get { return (IScope)Item; }
    5050      set { base.Item = value; }
    5151    }
     
    5858      InitializeComponent();
    5959      Caption = "Scope";
    60       scopeNodeTable = new Dictionary<Scope, TreeNode>();
    61       subScopesScopeTable = new Dictionary<ScopeList, Scope>();
     60      scopeNodeTable = new Dictionary<IScope, TreeNode>();
     61      subScopesScopeTable = new Dictionary<ScopeList, IScope>();
    6262
    6363    }
     
    6767    /// <remarks>Calls <see cref="ScopeView()"/>.</remarks>
    6868    /// <param name="scope">The scope to represent visually.</param>
    69     public ScopeView(Scope scope)
     69    public ScopeView(IScope scope)
    7070      : this() {
    7171      Scope = scope;
     
    9494    }
    9595
    96     private TreeNode CreateTreeNode(Scope scope) {
     96    private TreeNode CreateTreeNode(IScope scope) {
    9797      TreeNode node = new TreeNode();
    9898      node.Text = scope.Name;
     
    101101      scopeNodeTable.Add(scope, node);
    102102      scope.NameChanged += new EventHandler(Scope_NameChanged);
    103       scope.SubScopes.ItemsAdded += new CollectionItemsChangedEventHandler<IndexedItem<Scope>>(SubScopes_ItemsAdded);
    104       scope.SubScopes.ItemsRemoved += new CollectionItemsChangedEventHandler<IndexedItem<Scope>>(SubScopes_ItemsRemoved);
    105       scope.SubScopes.ItemsReplaced += new CollectionItemsChangedEventHandler<IndexedItem<Scope>>(SubScopes_ItemsReplaced);
    106       scope.SubScopes.ItemsMoved += new CollectionItemsChangedEventHandler<IndexedItem<Scope>>(SubScopes_ItemsMoved);
    107       scope.SubScopes.CollectionReset += new CollectionItemsChangedEventHandler<IndexedItem<Scope>>(SubScopes_CollectionReset);
     103      scope.SubScopes.ItemsAdded += new CollectionItemsChangedEventHandler<IndexedItem<IScope>>(SubScopes_ItemsAdded);
     104      scope.SubScopes.ItemsRemoved += new CollectionItemsChangedEventHandler<IndexedItem<IScope>>(SubScopes_ItemsRemoved);
     105      scope.SubScopes.ItemsReplaced += new CollectionItemsChangedEventHandler<IndexedItem<IScope>>(SubScopes_ItemsReplaced);
     106      scope.SubScopes.ItemsMoved += new CollectionItemsChangedEventHandler<IndexedItem<IScope>>(SubScopes_ItemsMoved);
     107      scope.SubScopes.CollectionReset += new CollectionItemsChangedEventHandler<IndexedItem<IScope>>(SubScopes_CollectionReset);
    108108      subScopesScopeTable.Add(scope.SubScopes, scope);
    109109      if (scope.SubScopes.Count > 0)
     
    116116        RemoveTreeNode(child);
    117117
    118       Scope scope = node.Tag as Scope;
     118      IScope scope = node.Tag as IScope;
    119119      if (scope != null) {
    120120        scopeNodeTable.Remove(scope);
    121121        scope.NameChanged -= new EventHandler(Scope_NameChanged);
    122         scope.SubScopes.ItemsAdded -= new CollectionItemsChangedEventHandler<IndexedItem<Scope>>(SubScopes_ItemsAdded);
    123         scope.SubScopes.ItemsRemoved -= new CollectionItemsChangedEventHandler<IndexedItem<Scope>>(SubScopes_ItemsRemoved);
    124         scope.SubScopes.ItemsReplaced -= new CollectionItemsChangedEventHandler<IndexedItem<Scope>>(SubScopes_ItemsReplaced);
    125         scope.SubScopes.ItemsMoved -= new CollectionItemsChangedEventHandler<IndexedItem<Scope>>(SubScopes_ItemsMoved);
    126         scope.SubScopes.CollectionReset -= new CollectionItemsChangedEventHandler<IndexedItem<Scope>>(SubScopes_CollectionReset);
     122        scope.SubScopes.ItemsAdded -= new CollectionItemsChangedEventHandler<IndexedItem<IScope>>(SubScopes_ItemsAdded);
     123        scope.SubScopes.ItemsRemoved -= new CollectionItemsChangedEventHandler<IndexedItem<IScope>>(SubScopes_ItemsRemoved);
     124        scope.SubScopes.ItemsReplaced -= new CollectionItemsChangedEventHandler<IndexedItem<IScope>>(SubScopes_ItemsReplaced);
     125        scope.SubScopes.ItemsMoved -= new CollectionItemsChangedEventHandler<IndexedItem<IScope>>(SubScopes_ItemsMoved);
     126        scope.SubScopes.CollectionReset -= new CollectionItemsChangedEventHandler<IndexedItem<IScope>>(SubScopes_CollectionReset);
    127127        subScopesScopeTable.Remove(scope.SubScopes);
    128128      }
     
    132132    private void scopesTreeView_MouseDown(object sender, MouseEventArgs e) {
    133133      TreeNode node = scopesTreeView.GetNodeAt(e.X, e.Y);
    134       if ((node != null) && (node.Tag is Scope)) {
    135         variableCollectionView.NamedItemCollection = ((Scope)node.Tag).Variables;
     134      if ((node != null) && (node.Tag is IScope)) {
     135        variableCollectionView.NamedItemCollection = ((IScope)node.Tag).Variables;
    136136        variableCollectionView.Enabled = true;
    137137      } else {
     
    143143    private void scopesTreeView_BeforeExpand(object sender, TreeViewCancelEventArgs e) {
    144144      TreeNode node = e.Node;
    145       Scope scope = (Scope)node.Tag;
     145      IScope scope = (IScope)node.Tag;
    146146
    147147      node.Nodes.Clear();
     
    151151    private void scopesTreeView_AfterCollapse(object sender, System.Windows.Forms.TreeViewEventArgs e) {
    152152      TreeNode node = e.Node;
    153       Scope scope = (Scope)node.Tag;
     153      IScope scope = (IScope)node.Tag;
    154154
    155155      if (node.Nodes.Count > 0) {
     
    162162    private void scopesTreeView_ItemDrag(object sender, ItemDragEventArgs e) {
    163163      TreeNode node = (TreeNode)e.Item;
    164       Scope scope = node.Tag as Scope;
     164      IScope scope = node.Tag as IScope;
    165165      if (scope != null) {
    166166        DataObject data = new DataObject();
     
    177177        Invoke(new EventHandler(Scope_NameChanged), sender, e);
    178178      else {
    179         Scope scope = (Scope)sender;
     179        IScope scope = (IScope)sender;
    180180        scopeNodeTable[scope].Text = scope.Name;
    181181      }
     
    184184
    185185    #region SubScopes Events
    186     private void SubScopes_ItemsAdded(object sender, CollectionItemsChangedEventArgs<IndexedItem<Scope>> e) {
    187       if (InvokeRequired)
    188         Invoke(new CollectionItemsChangedEventHandler<IndexedItem<Scope>>(SubScopes_ItemsAdded), sender, e);
    189       else {
    190         Scope parentScope = subScopesScopeTable[(ScopeList)sender];
    191         TreeNode parentNode = scopeNodeTable[parentScope];
    192         if (parentNode.IsExpanded) {
    193           foreach (IndexedItem<Scope> item in e.Items) {
     186    private void SubScopes_ItemsAdded(object sender, CollectionItemsChangedEventArgs<IndexedItem<IScope>> e) {
     187      if (InvokeRequired)
     188        Invoke(new CollectionItemsChangedEventHandler<IndexedItem<IScope>>(SubScopes_ItemsAdded), sender, e);
     189      else {
     190        IScope parentScope = subScopesScopeTable[(ScopeList)sender];
     191        TreeNode parentNode = scopeNodeTable[parentScope];
     192        if (parentNode.IsExpanded) {
     193          foreach (IndexedItem<IScope> item in e.Items) {
    194194            TreeNode node = CreateTreeNode(item.Value);
    195195            parentNode.Nodes.Insert(item.Index, node);
     
    200200      }
    201201    }
    202     private void SubScopes_ItemsRemoved(object sender, CollectionItemsChangedEventArgs<IndexedItem<Scope>> e) {
    203       if (InvokeRequired)
    204         Invoke(new CollectionItemsChangedEventHandler<IndexedItem<Scope>>(SubScopes_ItemsRemoved), sender, e);
    205       else {
    206         Scope parentScope = subScopesScopeTable[(ScopeList)sender];
    207         TreeNode parentNode = scopeNodeTable[parentScope];
    208         if (parentNode.IsExpanded) {
    209           foreach (IndexedItem<Scope> item in e.Items) {
     202    private void SubScopes_ItemsRemoved(object sender, CollectionItemsChangedEventArgs<IndexedItem<IScope>> e) {
     203      if (InvokeRequired)
     204        Invoke(new CollectionItemsChangedEventHandler<IndexedItem<IScope>>(SubScopes_ItemsRemoved), sender, e);
     205      else {
     206        IScope parentScope = subScopesScopeTable[(ScopeList)sender];
     207        TreeNode parentNode = scopeNodeTable[parentScope];
     208        if (parentNode.IsExpanded) {
     209          foreach (IndexedItem<IScope> item in e.Items) {
    210210            TreeNode node = scopeNodeTable[item.Value];
    211211            RemoveTreeNode(node);
     
    217217      }
    218218    }
    219     private void SubScopes_ItemsReplaced(object sender, CollectionItemsChangedEventArgs<IndexedItem<Scope>> e) {
    220       if (InvokeRequired)
    221         Invoke(new CollectionItemsChangedEventHandler<IndexedItem<Scope>>(SubScopes_ItemsReplaced), sender, e);
    222       else {
    223         Scope parentScope = subScopesScopeTable[(ScopeList)sender];
    224         TreeNode parentNode = scopeNodeTable[parentScope];
    225         if (parentNode.IsExpanded) {
    226           foreach (IndexedItem<Scope> item in e.Items) {
     219    private void SubScopes_ItemsReplaced(object sender, CollectionItemsChangedEventArgs<IndexedItem<IScope>> e) {
     220      if (InvokeRequired)
     221        Invoke(new CollectionItemsChangedEventHandler<IndexedItem<IScope>>(SubScopes_ItemsReplaced), sender, e);
     222      else {
     223        IScope parentScope = subScopesScopeTable[(ScopeList)sender];
     224        TreeNode parentNode = scopeNodeTable[parentScope];
     225        if (parentNode.IsExpanded) {
     226          foreach (IndexedItem<IScope> item in e.Items) {
    227227            TreeNode node = parentNode.Nodes[item.Index];
    228228            RemoveTreeNode(node);
     
    234234      }
    235235    }
    236     private void SubScopes_ItemsMoved(object sender, CollectionItemsChangedEventArgs<IndexedItem<Scope>> e) {
    237       if (InvokeRequired)
    238         Invoke(new CollectionItemsChangedEventHandler<IndexedItem<Scope>>(SubScopes_ItemsMoved), sender, e);
    239       else {
    240         Scope parentScope = subScopesScopeTable[(ScopeList)sender];
    241         TreeNode parentNode = scopeNodeTable[parentScope];
    242         if (parentNode.IsExpanded) {
    243           parentNode.Nodes.Clear();
    244           foreach (IndexedItem<Scope> item in e.Items)
     236    private void SubScopes_ItemsMoved(object sender, CollectionItemsChangedEventArgs<IndexedItem<IScope>> e) {
     237      if (InvokeRequired)
     238        Invoke(new CollectionItemsChangedEventHandler<IndexedItem<IScope>>(SubScopes_ItemsMoved), sender, e);
     239      else {
     240        IScope parentScope = subScopesScopeTable[(ScopeList)sender];
     241        TreeNode parentNode = scopeNodeTable[parentScope];
     242        if (parentNode.IsExpanded) {
     243          parentNode.Nodes.Clear();
     244          foreach (IndexedItem<IScope> item in e.Items)
    245245            parentNode.Nodes.Insert(item.Index, scopeNodeTable[item.Value]);
    246246        }
    247247      }
    248248    }
    249     private void SubScopes_CollectionReset(object sender, CollectionItemsChangedEventArgs<IndexedItem<Scope>> e) {
    250       if (InvokeRequired)
    251         Invoke(new CollectionItemsChangedEventHandler<IndexedItem<Scope>>(SubScopes_CollectionReset), sender, e);
    252       else {
    253         Scope parentScope = subScopesScopeTable[(ScopeList)sender];
     249    private void SubScopes_CollectionReset(object sender, CollectionItemsChangedEventArgs<IndexedItem<IScope>> e) {
     250      if (InvokeRequired)
     251        Invoke(new CollectionItemsChangedEventHandler<IndexedItem<IScope>>(SubScopes_CollectionReset), sender, e);
     252      else {
     253        IScope parentScope = subScopesScopeTable[(ScopeList)sender];
    254254        TreeNode parentNode = scopeNodeTable[parentScope];
    255255        if (parentNode.IsExpanded) {
     
    257257            RemoveTreeNode(node);
    258258          parentNode.Nodes.Clear();
    259           foreach (IndexedItem<Scope> item in e.Items) {
     259          foreach (IndexedItem<IScope> item in e.Items) {
    260260            TreeNode node = CreateTreeNode(item.Value);
    261261            parentNode.Nodes.Insert(item.Index, node);
  • trunk/sources/HeuristicLab.Core.Views/3.3/VariableCollectionView.cs

    r2655 r2687  
    1212namespace HeuristicLab.Core.Views {
    1313  [Content(typeof(VariableCollection), true)]
    14   [Content(typeof(IObservableKeyedCollection<string, Variable>), true)]
    15   public partial class VariableCollectionView : NamedItemCollectionView<Variable> {
     14  [Content(typeof(IObservableKeyedCollection<string, IVariable>), true)]
     15  public partial class VariableCollectionView : NamedItemCollectionView<IVariable> {
    1616    /// <summary>
    1717    /// Initializes a new instance of <see cref="VariablesScopeView"/> with caption "Variables Scope View".
     
    2828    /// <remarks>Calls <see cref="VariablesScopeView()"/>.</remarks>
    2929    /// <param name="scope">The scope whose variables should be represented visually.</param>
    30     public VariableCollectionView(IObservableKeyedCollection<string, Variable> variableCollection)
     30    public VariableCollectionView(IObservableKeyedCollection<string, IVariable> variableCollection)
    3131      : this() {
    3232      NamedItemCollection = variableCollection;
    3333    }
     34
     35    protected override IVariable CreateItem() {
     36      IVariable item = new Variable();
     37      item.Name = GetUniqueName(item.Name);
     38      return item;
     39    }
    3440  }
    3541}
  • trunk/sources/HeuristicLab.Core.Views/3.3/VariableView.cs

    r2676 r2687  
    6565
    6666    /// <summary>
    67     /// Removes the eventhandlers from the underlying <see cref="IVariable"/>.
     67    /// Removes the eventhandlers from the underlying <see cref="Variable"/>.
    6868    /// </summary>
    6969    /// <remarks>Calls <see cref="ViewBase.RemoveItemEvents"/> of base class <see cref="ViewBase"/>.</remarks>
     
    7474
    7575    /// <summary>
    76     /// Adds eventhandlers to the underlying <see cref="IVariable"/>.
     76    /// Adds eventhandlers to the underlying <see cref="Variable"/>.
    7777    /// </summary>
    7878    /// <remarks>Calls <see cref="ViewBase.AddItemEvents"/> of base class <see cref="ViewBase"/>.</remarks>
  • trunk/sources/HeuristicLab.Core.Views/3.3/ViewHost.Designer.cs

    r2676 r2687  
    4545    /// </summary>
    4646    private void InitializeComponent() {
     47      this.components = new System.ComponentModel.Container();
    4748      this.viewPanel = new System.Windows.Forms.Panel();
    4849      this.messageLabel = new System.Windows.Forms.Label();
    49       this.viewLabel = new System.Windows.Forms.Label();
    50       this.viewComboBox = new System.Windows.Forms.ComboBox();
     50      this.viewsLabel = new System.Windows.Forms.Label();
     51      this.contextMenuStrip = new System.Windows.Forms.ContextMenuStrip(this.components);
    5152      this.SuspendLayout();
    5253      //
     
    5657                  | System.Windows.Forms.AnchorStyles.Left)
    5758                  | System.Windows.Forms.AnchorStyles.Right)));
    58       this.viewPanel.Location = new System.Drawing.Point(0, 27);
     59      this.viewPanel.Location = new System.Drawing.Point(0, 0);
    5960      this.viewPanel.Name = "viewPanel";
    60       this.viewPanel.Size = new System.Drawing.Size(227, 157);
     61      this.viewPanel.Size = new System.Drawing.Size(205, 184);
    6162      this.viewPanel.TabIndex = 2;
    6263      //
     
    7172      this.messageLabel.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
    7273      //
    73       // viewLabel
     74      // viewsLabel
    7475      //
    75       this.viewLabel.AutoSize = true;
    76       this.viewLabel.Location = new System.Drawing.Point(3, 3);
    77       this.viewLabel.Name = "viewLabel";
    78       this.viewLabel.Size = new System.Drawing.Size(33, 13);
    79       this.viewLabel.TabIndex = 0;
    80       this.viewLabel.Text = "&View:";
     76      this.viewsLabel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
     77      this.viewsLabel.ContextMenuStrip = this.contextMenuStrip;
     78      this.viewsLabel.Image = HeuristicLab.Common.Resources.VS2008ImageLibrary.Windows;
     79      this.viewsLabel.Location = new System.Drawing.Point(211, 0);
     80      this.viewsLabel.Name = "viewsLabel";
     81      this.viewsLabel.Size = new System.Drawing.Size(16, 16);
     82      this.viewsLabel.TabIndex = 0;
    8183      //
    82       // viewComboBox
     84      // contextMenuStrip
    8385      //
    84       this.viewComboBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
    85                   | System.Windows.Forms.AnchorStyles.Right)));
    86       this.viewComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
    87       this.viewComboBox.FormattingEnabled = true;
    88       this.viewComboBox.Location = new System.Drawing.Point(42, 0);
    89       this.viewComboBox.Name = "viewComboBox";
    90       this.viewComboBox.Size = new System.Drawing.Size(185, 21);
    91       this.viewComboBox.TabIndex = 1;
    92       this.viewComboBox.SelectedIndexChanged += new System.EventHandler(this.viewComboBox_SelectedIndexChanged);
     86      this.contextMenuStrip.Name = "contextMenuStrip";
     87      this.contextMenuStrip.ShowCheckMargin = true;
     88      this.contextMenuStrip.ShowImageMargin = false;
     89      this.contextMenuStrip.Size = new System.Drawing.Size(61, 4);
     90      this.contextMenuStrip.ItemClicked += new System.Windows.Forms.ToolStripItemClickedEventHandler(this.contextMenuStrip_ItemClicked);
    9391      //
    9492      // ViewHost
     
    9694      this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
    9795      this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
    98       this.Controls.Add(this.viewComboBox);
    99       this.Controls.Add(this.viewLabel);
    10096      this.Controls.Add(this.viewPanel);
     97      this.Controls.Add(this.viewsLabel);
    10198      this.Controls.Add(this.messageLabel);
    10299      this.Name = "ViewHost";
    103100      this.Size = new System.Drawing.Size(227, 184);
    104101      this.ResumeLayout(false);
    105       this.PerformLayout();
    106102
    107103    }
     
    110106
    111107    protected System.Windows.Forms.Panel viewPanel;
    112     protected System.Windows.Forms.Label viewLabel;
    113     protected System.Windows.Forms.ComboBox viewComboBox;
     108    protected System.Windows.Forms.Label viewsLabel;
    114109    protected System.Windows.Forms.Label messageLabel;
     110    protected System.Windows.Forms.ContextMenuStrip contextMenuStrip;
    115111
    116112  }
  • trunk/sources/HeuristicLab.Core.Views/3.3/ViewHost.cs

    r2684 r2687  
    3232namespace HeuristicLab.Core.Views {
    3333  public partial class ViewHost : UserControl {
     34    private Dictionary<Type, ToolStripMenuItem> typeMenuItemTable;
     35
    3436    private object obj;
    3537    public object Object {
     
    4446
    4547    public ViewHost() {
     48      typeMenuItemTable = new Dictionary<Type, ToolStripMenuItem>();
    4649      InitializeComponent();
    4750      Initialize();
     
    4952
    5053    protected virtual void Initialize() {
    51       viewLabel.Visible = false;
    52       viewComboBox.Items.Clear();
    53       viewComboBox.Enabled = false;
    54       viewComboBox.Visible = false;
     54      viewsLabel.Enabled = false;
     55      viewsLabel.Visible = false;
     56      typeMenuItemTable.Clear();
     57      contextMenuStrip.Items.Clear();
     58      contextMenuStrip.Enabled = false;
    5559      messageLabel.Visible = false;
    5660      if (viewPanel.Controls.Count > 0) viewPanel.Controls[0].Dispose();
     
    6367                        orderby t.Name ascending
    6468                        select t;
    65         foreach (Type viewType in viewTypes)
    66           viewComboBox.Items.Add(viewType);
    67         if (viewComboBox.Items.Count == 0) {
     69        foreach (Type viewType in viewTypes) {
     70          ToolStripMenuItem item = new ToolStripMenuItem(viewType.Name);
     71          item.Name = viewType.FullName;
     72          item.ToolTipText = viewType.FullName;
     73          item.Tag = viewType;
     74          contextMenuStrip.Items.Add(item);
     75          typeMenuItemTable.Add(viewType, item);
     76        }
     77        if (contextMenuStrip.Items.Count == 0) {
    6878          messageLabel.Visible = true;
    6979        } else {
    70           viewLabel.Visible = true;
    71           viewComboBox.Enabled = true;
    72           viewComboBox.Visible = true;
     80          viewsLabel.Enabled = true;
     81          viewsLabel.Visible = true;
     82          contextMenuStrip.Enabled = true;
    7383          messageLabel.Visible = false;
    7484        }
     
    8191          viewPanel.Enabled = true;
    8292          viewPanel.Visible = true;
    83           viewComboBox.SelectedItem = view.GetType();
     93          typeMenuItemTable[view.GetType()].Checked = true;
     94          typeMenuItemTable[view.GetType()].Enabled = false;
    8495        }
    8596      }
    8697    }
    8798
    88     protected virtual void viewComboBox_SelectedIndexChanged(object sender, EventArgs e) {
    89       if (viewComboBox.SelectedItem != viewPanel.Tag) {
    90         if (viewPanel.Controls.Count > 0) viewPanel.Controls[0].Dispose();
    91         viewPanel.Controls.Clear();
    92         Control view = (Control)MainFormManager.CreateView((Type)viewComboBox.SelectedItem, Object);
    93         viewPanel.Controls.Add(view);
    94         viewPanel.Tag = view;
    95         view.Dock = DockStyle.Fill;
     99    protected void contextMenuStrip_ItemClicked(object sender, ToolStripItemClickedEventArgs e) {
     100      Type viewType = (Type)e.ClickedItem.Tag;
     101      foreach (ToolStripMenuItem item in typeMenuItemTable.Values) {
     102        item.Checked = false;
     103        item.Enabled = true;
    96104      }
     105      typeMenuItemTable[viewType].Checked = true;
     106      typeMenuItemTable[viewType].Enabled = false;
     107
     108      if (viewPanel.Controls.Count > 0) viewPanel.Controls[0].Dispose();
     109      viewPanel.Controls.Clear();
     110      Control view = (Control)MainFormManager.CreateView(viewType, Object);
     111      viewPanel.Controls.Add(view);
     112      viewPanel.Tag = view;
     113      view.Dock = DockStyle.Fill;
    97114    }
    98115  }
  • trunk/sources/HeuristicLab.Core/3.3/Engine.cs

    r2664 r2687  
    7171    /// Gets the current global scope.
    7272    /// </summary>
    73     public Scope GlobalScope {
     73    public IScope GlobalScope {
    7474      get { return globalScope; }
    7575    }
     
    167167      canceled = false;
    168168      running = false;
    169       GlobalScope.Clear();
     169      globalScope.Clear();
    170170      ExecutionTime = new TimeSpan();
    171171      executionStack.Clear();
  • trunk/sources/HeuristicLab.Core/3.3/ExecutionContext.cs

    r2664 r2687  
    4040
    4141    [Storable]
    42     private Scope scope;
    43     public Scope Scope {
     42    private IScope scope;
     43    public IScope Scope {
    4444      get { return scope; }
    4545    }
     
    5050      scope = null;
    5151    }
    52     public ExecutionContext(ExecutionContext parent, IOperator op, Scope scope) {
     52    public ExecutionContext(ExecutionContext parent, IOperator op, IScope scope) {
    5353      if ((op == null) || (scope == null)) throw new ArgumentNullException();
    5454      this.parent = parent;
     
    6262      clone.parent = (ExecutionContext)cloner.Clone(parent);
    6363      clone.op = (IOperator)cloner.Clone(op);
    64       clone.scope = (Scope)cloner.Clone(scope);
     64      clone.scope = (IScope)cloner.Clone(scope);
    6565      return clone;
    6666    }
  • trunk/sources/HeuristicLab.Core/3.3/HeuristicLab.Core-3.3.csproj

    r2664 r2687  
    106106    <Compile Include="Engine.cs" />
    107107    <Compile Include="Interfaces\IOperatorParameter.cs" />
     108    <Compile Include="Interfaces\IScope.cs" />
     109    <Compile Include="Interfaces\IVariable.cs" />
    108110    <Compile Include="Item.cs" />
    109111    <Compile Include="ItemParameter.cs" />
  • trunk/sources/HeuristicLab.Core/3.3/Interfaces/IEngine.cs

    r2653 r2687  
    3939    /// Gets the global scope of the current instance.
    4040    /// </summary>
    41     Scope GlobalScope { get; }
     41    IScope GlobalScope { get; }
    4242
    4343    /// <summary>
  • trunk/sources/HeuristicLab.Core/3.3/Interfaces/IParameter.cs

    r2684 r2687  
    3131
    3232    IItem GetValue(ExecutionContext context);
    33     IItem GetValue(ExecutionContext context, bool throwOnError);
    3433  }
    3534}
  • trunk/sources/HeuristicLab.Core/3.3/ItemCollection.cs

    r2684 r2687  
    8787      foreach (T item in items)
    8888        if (item != null) item.Changed += new ChangedEventHandler(Item_Changed);
    89       IEnumerable<IEngine> i = (IEnumerable<IEngine>)items;
    9089      base.OnItemsAdded(items);
    9190    }
  • trunk/sources/HeuristicLab.Core/3.3/ItemParameter.cs

    r2685 r2687  
    8484
    8585    public override IItem GetValue(ExecutionContext context) {
    86       return GetValue(context, true);
    87     }
    88     public override IItem GetValue(ExecutionContext context, bool throwOnError) {
    89       if (Value != null) return Value;
    90 
    91       ExecutionContext current, child;
    92       IParameter parameter = null;
    93       child = context;
    94       current = context.Parent;
    95       while ((current != null) && (parameter == null)) {
    96         current.Operator.Parameters.TryGetValue(ActualName, out parameter);
    97         child = current;
     86      ItemParameter param = this;
     87      ExecutionContext current = context;
     88      string actualName = null;
     89      while (param != null) {
     90        if (param.Value != null) return param.Value;
     91        actualName = param.ActualName;
    9892        current = current.Parent;
     93        while ((current != null) && !current.Operator.Parameters.ContainsKey(actualName))
     94          current = current.Parent;
     95        if (current != null)
     96          param = (ItemParameter)current.Operator.Parameters[actualName];
     97        else
     98          param = null;
    9999      }
    100100
    101       if (parameter != null) return parameter.GetValue(child, throwOnError);
    102       else {
    103         Variable variable = context.Scope.Lookup(ActualName, true, throwOnError);
    104         return variable == null ? null : variable.Value;
    105       }
     101      IScope scope = context.Scope;
     102      while ((scope != null) && !scope.Variables.ContainsKey(actualName))
     103        scope = scope.Parent;
     104      return scope != null ? scope.Variables[actualName].Value : null;
    106105    }
    107106
     
    157156
    158157    public new T GetValue(ExecutionContext context) {
    159       return GetValue(context, true);
    160     }
    161     public new T GetValue(ExecutionContext context, bool throwOnError) {
    162       return (T)base.GetValue(context, throwOnError);
     158      return (T)base.GetValue(context);
    163159    }
    164160  }
  • trunk/sources/HeuristicLab.Core/3.3/Parameter.cs

    r2684 r2687  
    5757
    5858    public abstract IItem GetValue(ExecutionContext context);
    59     public abstract IItem GetValue(ExecutionContext context, bool throwOnError);
    6059
    6160    public override IDeepCloneable Clone(Cloner cloner) {
  • trunk/sources/HeuristicLab.Core/3.3/Scope.cs

    r2664 r2687  
    3333  [Item("Scope", "A scope which contains variables and sub-scopes.")]
    3434  [Creatable("Test")]
    35   public class Scope : NamedItem {
     35  public sealed class Scope : NamedItem, IScope {
    3636    [Storable]
    37     private Scope parent;
     37    private IScope parent;
     38    public IScope Parent {
     39      get { return parent; }
     40      set {
     41        if (parent != null) parent.SubScopes.Remove(this);
     42        parent = value;
     43        if ((parent != null) && !parent.SubScopes.Contains(this)) parent.SubScopes.Add(this);
     44      }
     45    }
    3846
    3947    private VariableCollection variables;
     
    7987    }
    8088
    81     public Variable Lookup(string name, bool recursive) {
    82       return Lookup(name, recursive, true);
    83     }
    84     public Variable Lookup(string name, bool recursive, bool throwOnError) {
    85       Variable variable;
    86 
    87       if (this.variables.TryGetValue(name, out variable)) {
    88         return variable;
    89       } else if (recursive) {
    90         Scope scope = this.parent;
    91         while (scope != null) {
    92           if (scope.variables.TryGetValue(name, out variable))
    93             return variable;
    94           scope = scope.parent;
    95         }
    96       }
    97       if (throwOnError)
    98         throw new ArgumentException("Variable " + name + " not found");
    99       else
    100         return null;
    101     }
    102 
    10389    /// <inheritdoc/>
    10490    public void Clear() {
     
    10995    /// <inheritdoc/>
    11096    public override IDeepCloneable Clone(Cloner cloner) {
    111       Scope clone = (Scope)base.Clone(cloner);
    112       clone.parent = (Scope)cloner.Clone(parent);
     97      Scope clone = new Scope();
     98      cloner.RegisterClonedObject(this, clone);
     99      clone.name = name;
     100      clone.description = description;
     101      clone.parent = (IScope)cloner.Clone(parent);
    113102      clone.Variables = (VariableCollection)cloner.Clone(variables);
    114103      clone.SubScopes = (ScopeList)cloner.Clone(subScopes);
     
    119108    private void RegisterSubScopesEvents() {
    120109      if (subScopes != null) {
    121         subScopes.ItemsAdded += new CollectionItemsChangedEventHandler<IndexedItem<Scope>>(SubScopes_ItemsAdded);
    122         subScopes.ItemsRemoved += new CollectionItemsChangedEventHandler<IndexedItem<Scope>>(SubScopes_ItemsRemoved);
    123         subScopes.ItemsReplaced += new CollectionItemsChangedEventHandler<IndexedItem<Scope>>(SubScopes_ItemsReplaced);
    124         subScopes.CollectionReset += new CollectionItemsChangedEventHandler<IndexedItem<Scope>>(SubScopes_CollectionReset);
     110        subScopes.ItemsAdded += new CollectionItemsChangedEventHandler<IndexedItem<IScope>>(SubScopes_ItemsAdded);
     111        subScopes.ItemsRemoved += new CollectionItemsChangedEventHandler<IndexedItem<IScope>>(SubScopes_ItemsRemoved);
     112        subScopes.ItemsReplaced += new CollectionItemsChangedEventHandler<IndexedItem<IScope>>(SubScopes_ItemsReplaced);
     113        subScopes.CollectionReset += new CollectionItemsChangedEventHandler<IndexedItem<IScope>>(SubScopes_CollectionReset);
    125114        subScopes.Changed += new ChangedEventHandler(SubScopes_Changed);
    126115      }
     
    128117    private void DeregisterSubScopesEvents() {
    129118      if (subScopes != null) {
    130         subScopes.ItemsAdded -= new CollectionItemsChangedEventHandler<IndexedItem<Scope>>(SubScopes_ItemsAdded);
    131         subScopes.ItemsRemoved -= new CollectionItemsChangedEventHandler<IndexedItem<Scope>>(SubScopes_ItemsRemoved);
    132         subScopes.ItemsReplaced -= new CollectionItemsChangedEventHandler<IndexedItem<Scope>>(SubScopes_ItemsReplaced);
    133         subScopes.CollectionReset -= new CollectionItemsChangedEventHandler<IndexedItem<Scope>>(SubScopes_CollectionReset);
     119        subScopes.ItemsAdded -= new CollectionItemsChangedEventHandler<IndexedItem<IScope>>(SubScopes_ItemsAdded);
     120        subScopes.ItemsRemoved -= new CollectionItemsChangedEventHandler<IndexedItem<IScope>>(SubScopes_ItemsRemoved);
     121        subScopes.ItemsReplaced -= new CollectionItemsChangedEventHandler<IndexedItem<IScope>>(SubScopes_ItemsReplaced);
     122        subScopes.CollectionReset -= new CollectionItemsChangedEventHandler<IndexedItem<IScope>>(SubScopes_CollectionReset);
    134123        subScopes.Changed -= new ChangedEventHandler(SubScopes_Changed);
    135124      }
    136125    }
    137     private void SubScopes_ItemsAdded(object sender, CollectionItemsChangedEventArgs<IndexedItem<Scope>> e) {
    138       foreach (IndexedItem<Scope> item in e.Items)
    139         item.Value.parent = this;
     126    private void SubScopes_ItemsAdded(object sender, CollectionItemsChangedEventArgs<IndexedItem<IScope>> e) {
     127      foreach (IndexedItem<IScope> item in e.Items)
     128        item.Value.Parent = this;
    140129    }
    141     private void SubScopes_ItemsRemoved(object sender, CollectionItemsChangedEventArgs<IndexedItem<Scope>> e) {
    142       foreach (IndexedItem<Scope> item in e.Items)
    143         item.Value.parent = null;
     130    private void SubScopes_ItemsRemoved(object sender, CollectionItemsChangedEventArgs<IndexedItem<IScope>> e) {
     131      foreach (IndexedItem<IScope> item in e.Items)
     132        item.Value.Parent = null;
    144133    }
    145     private void SubScopes_ItemsReplaced(object sender, CollectionItemsChangedEventArgs<IndexedItem<Scope>> e) {
    146       foreach (IndexedItem<Scope> oldItem in e.OldItems)
    147         oldItem.Value.parent = null;
    148       foreach (IndexedItem<Scope> item in e.Items)
    149         item.Value.parent = this;
     134    private void SubScopes_ItemsReplaced(object sender, CollectionItemsChangedEventArgs<IndexedItem<IScope>> e) {
     135      foreach (IndexedItem<IScope> oldItem in e.OldItems)
     136        oldItem.Value.Parent = null;
     137      foreach (IndexedItem<IScope> item in e.Items)
     138        item.Value.Parent = this;
    150139    }
    151     private void SubScopes_CollectionReset(object sender, CollectionItemsChangedEventArgs<IndexedItem<Scope>> e) {
    152       foreach (IndexedItem<Scope> oldItem in e.OldItems)
    153         oldItem.Value.parent = null;
    154       foreach (IndexedItem<Scope> item in e.Items)
    155         item.Value.parent = this;
     140    private void SubScopes_CollectionReset(object sender, CollectionItemsChangedEventArgs<IndexedItem<IScope>> e) {
     141      foreach (IndexedItem<IScope> oldItem in e.OldItems)
     142        oldItem.Value.Parent = null;
     143      foreach (IndexedItem<IScope> item in e.Items)
     144        item.Value.Parent = this;
    156145    }
    157146    private void SubScopes_Changed(object sender, ChangedEventArgs e) {
  • trunk/sources/HeuristicLab.Core/3.3/ScopeList.cs

    r2653 r2687  
    3434  [Item("ScopeList", "Represents a list of scopes.")]
    3535  [Creatable("Test")]
    36   public class ScopeList : ItemList<Scope> {
     36  public class ScopeList : ItemList<IScope> {
    3737    public ScopeList() : base() { }
    3838    public ScopeList(int capacity) : base(capacity) { }
    39     public ScopeList(IEnumerable<Scope> collection) : base(collection) { }
     39    public ScopeList(IEnumerable<IScope> collection) : base(collection) { }
    4040  }
    4141}
  • trunk/sources/HeuristicLab.Core/3.3/Variable.cs

    r2664 r2687  
    3333  [Item("Variable", "A variable which has a name and holds an IItem.")]
    3434  [Creatable("Test")]
    35   public sealed class Variable : NamedItem {
     35  public sealed class Variable : NamedItem, IVariable {
    3636    private IItem value;
    3737    /// <inheritdoc/>
     
    6767      : base(name) {
    6868      Value = value;
    69     }
    70 
    71     /// <inheritdoc cref="IVariable.GetValue&lt;T&gt;"/>
    72     public T GetValue<T>() where T : class, IItem {
    73       return (T)Value;
    7469    }
    7570
  • trunk/sources/HeuristicLab.Core/3.3/VariableCollection.cs

    r2653 r2687  
    3333  [Item("VariableCollection", "Represents a collection of variables.")]
    3434  [Creatable("Test")]
    35   public class VariableCollection : NamedItemCollection<Variable>, IItem {
     35  public class VariableCollection : NamedItemCollection<IVariable>, IItem {
    3636    public virtual string ItemName {
    3737      get { return ItemAttribute.GetName(this.GetType()); }
     
    4646    public VariableCollection() : base() { }
    4747    public VariableCollection(int capacity) : base(capacity) { }
    48     public VariableCollection(IEnumerable<Variable> collection) : base(collection) { }
     48    public VariableCollection(IEnumerable<IVariable> collection) : base(collection) { }
    4949
    5050    public override string ToString() {
  • trunk/sources/HeuristicLab.Operators/3.3/StandardOperator.cs

    r2684 r2687  
    4545
    4646    public override ExecutionContextCollection Apply(ExecutionContext context) {
    47       IOperator successor = Successor.GetValue(context, false);
     47      IOperator successor = Successor.GetValue(context);
    4848      if (successor != null)
    4949        return new ExecutionContextCollection(new ExecutionContext(context.Parent, successor, context.Scope));
Note: See TracChangeset for help on using the changeset viewer.