Changeset 11530


Ignore:
Timestamp:
11/10/14 04:24:04 (8 years ago)
Author:
swagner
Message:

#2205: Implemented review comments

  • renamed GenericPort to MessagePort
  • refactored CanConnectToPort
  • refactored PrepareMessage
  • removed IConnectedPort

Additional changes:

  • added UserDefinedMessagePort
  • refactored CloneConnectedPortParameters to CloneParametersFromPort and moved it to ParameterizedPort
  • added ports to NetworkView
Location:
branches/OptimizationNetworks
Files:
4 added
1 deleted
16 edited
4 moved

Legend:

Unmodified
Added
Removed
  • branches/OptimizationNetworks/HeuristicLab.Optimization.Networks.Views/3.3/Core.Networks.Views/MessagePortView.Designer.cs

    r11527 r11530  
    2121
    2222namespace HeuristicLab.Core.Networks.Views {
    23   partial class GenericPortView {
     23  partial class MessagePortView {
    2424    /// <summary>
    2525    /// Required designer variable.
     
    190190      this.logMessagesCheckBox.CheckedChanged += new System.EventHandler(this.logMessagesCheckBox_CheckedChanged);
    191191      //
    192       // GenericPortView
     192      // MessagePortView
    193193      //
    194194      this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Inherit;
     
    197197      this.Controls.Add(this.connectedPortGroupBox);
    198198      this.Controls.Add(this.splitContainer);
    199       this.Name = "GenericPortView";
     199      this.Name = "MessagePortView";
    200200      this.Controls.SetChildIndex(this.splitContainer, 0);
    201201      this.Controls.SetChildIndex(this.nameLabel, 0);
  • branches/OptimizationNetworks/HeuristicLab.Optimization.Networks.Views/3.3/Core.Networks.Views/MessagePortView.cs

    r11529 r11530  
    2626
    2727namespace HeuristicLab.Core.Networks.Views {
    28   [View("GenericPort View")]
    29   [Content(typeof(GenericPort), true)]
    30   [Content(typeof(IGenericPort), false)]
    31   public partial class GenericPortView : PortView {
     28  [View("MessagePort View")]
     29  [Content(typeof(MessagePort), true)]
     30  [Content(typeof(IMessagePort), false)]
     31  public partial class MessagePortView : PortView {
    3232    protected NetworkItemSelectorDialog networkItemSelectorDialog;
    3333
    34     public new IGenericPort Content {
    35       get { return (IGenericPort)base.Content; }
     34    public new IMessagePort Content {
     35      get { return (IMessagePort)base.Content; }
    3636      set { base.Content = value; }
    3737    }
    3838
    39     public GenericPortView() {
     39    public MessagePortView() {
    4040      InitializeComponent();
    4141      errorProvider.SetIconAlignment(connectedPortView, ErrorIconAlignment.MiddleRight);
     
    128128          root,
    129129          Content.ConnectedPort,
    130           typeof(IConnectedPort)
     130          typeof(IMessagePort)
    131131        );
    132132
    133133        if (networkItemSelectorDialog.ShowDialog(this) == DialogResult.OK) {
    134           Content.ConnectedPort = networkItemSelectorDialog.NetworkItemSelector.SelectedNetworkItem as IConnectedPort;
     134          Content.ConnectedPort = networkItemSelectorDialog.NetworkItemSelector.SelectedNetworkItem as IMessagePort;
    135135        }
    136136      }
     
    145145    protected virtual void connectedPortView_DragEnterOver(object sender, DragEventArgs e) {
    146146      e.Effect = DragDropEffects.None;
    147       var data = e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat) as IConnectedPort;
     147      var data = e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat) as IMessagePort;
    148148
    149149      if (!ReadOnly && (data != null) && (Content.CanConnectToPort(data))) {
     
    153153    protected virtual void connectedPortView_DragDrop(object sender, DragEventArgs e) {
    154154      if (e.Effect != DragDropEffects.None) {
    155         var port = e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat) as IConnectedPort;
     155        var port = e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat) as IMessagePort;
    156156        Content.ConnectedPort = port;
    157157      }
    158158    }
    159159    protected virtual void cloneConnectedPortParametersButton_Click(object sender, EventArgs e) {
    160       Content.CloneConnectedPortParameters();
     160      Content.CloneParametersFromPort(Content.ConnectedPort);
    161161    }
    162162    protected virtual void logMessagesCheckBox_CheckedChanged(object sender, EventArgs e) {
  • branches/OptimizationNetworks/HeuristicLab.Optimization.Networks.Views/3.3/Core.Networks.Views/NetworkView.Designer.cs

    r11526 r11530  
    4646    private void InitializeComponent() {
    4747      this.nodeCollectionView = new HeuristicLab.Core.Networks.Views.NodeCollectionView();
     48      this.tabControl = new HeuristicLab.MainForm.WindowsForms.DragOverTabControl();
     49      this.nodesTabPage = new System.Windows.Forms.TabPage();
     50      this.portsTabPage = new System.Windows.Forms.TabPage();
     51      this.portCollectionView = new HeuristicLab.Core.Networks.Views.PortCollectionView();
    4852      ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).BeginInit();
     53      this.tabControl.SuspendLayout();
     54      this.nodesTabPage.SuspendLayout();
     55      this.portsTabPage.SuspendLayout();
    4956      this.SuspendLayout();
    5057      //
     
    5360      this.errorProvider.SetIconAlignment(this.nameTextBox, System.Windows.Forms.ErrorIconAlignment.MiddleLeft);
    5461      this.errorProvider.SetIconPadding(this.nameTextBox, 2);
    55       this.nameTextBox.Location = new System.Drawing.Point(69, 0);
    56       this.nameTextBox.Size = new System.Drawing.Size(551, 20);
    57       //
    58       // infoLabel
    59       //
    60       this.infoLabel.Location = new System.Drawing.Point(626, 3);
    6162      //
    6263      // nodeCollectionView
    6364      //
    64       this.nodeCollectionView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
    65             | System.Windows.Forms.AnchorStyles.Left)
    66             | System.Windows.Forms.AnchorStyles.Right)));
    6765      this.nodeCollectionView.Caption = "NodeCollection View";
    6866      this.nodeCollectionView.Content = null;
    69       this.nodeCollectionView.Location = new System.Drawing.Point(6, 26);
     67      this.nodeCollectionView.Dock = System.Windows.Forms.DockStyle.Fill;
     68      this.nodeCollectionView.Location = new System.Drawing.Point(3, 3);
    7069      this.nodeCollectionView.Name = "nodeCollectionView";
    7170      this.nodeCollectionView.ReadOnly = false;
    7271      this.nodeCollectionView.ShowDetails = true;
    73       this.nodeCollectionView.Size = new System.Drawing.Size(639, 491);
    74       this.nodeCollectionView.TabIndex = 3;
     72      this.nodeCollectionView.Size = new System.Drawing.Size(631, 459);
     73      this.nodeCollectionView.TabIndex = 0;
     74      //
     75      // tabControl
     76      //
     77      this.tabControl.AllowDrop = true;
     78      this.tabControl.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
     79            | System.Windows.Forms.AnchorStyles.Left)
     80            | System.Windows.Forms.AnchorStyles.Right)));
     81      this.tabControl.Controls.Add(this.nodesTabPage);
     82      this.tabControl.Controls.Add(this.portsTabPage);
     83      this.tabControl.Location = new System.Drawing.Point(0, 26);
     84      this.tabControl.Name = "tabControl";
     85      this.tabControl.SelectedIndex = 0;
     86      this.tabControl.Size = new System.Drawing.Size(645, 491);
     87      this.tabControl.TabIndex = 3;
     88      //
     89      // nodesTabPage
     90      //
     91      this.nodesTabPage.Controls.Add(this.nodeCollectionView);
     92      this.nodesTabPage.Location = new System.Drawing.Point(4, 22);
     93      this.nodesTabPage.Name = "nodesTabPage";
     94      this.nodesTabPage.Padding = new System.Windows.Forms.Padding(3);
     95      this.nodesTabPage.Size = new System.Drawing.Size(637, 465);
     96      this.nodesTabPage.TabIndex = 0;
     97      this.nodesTabPage.Text = "Nodes";
     98      this.nodesTabPage.UseVisualStyleBackColor = true;
     99      //
     100      // portsTabPage
     101      //
     102      this.portsTabPage.Controls.Add(this.portCollectionView);
     103      this.portsTabPage.Location = new System.Drawing.Point(4, 22);
     104      this.portsTabPage.Name = "portsTabPage";
     105      this.portsTabPage.Padding = new System.Windows.Forms.Padding(3);
     106      this.portsTabPage.Size = new System.Drawing.Size(637, 465);
     107      this.portsTabPage.TabIndex = 1;
     108      this.portsTabPage.Text = "Ports";
     109      this.portsTabPage.UseVisualStyleBackColor = true;
     110      //
     111      // portCollectionView
     112      //
     113      this.portCollectionView.Caption = "PortCollection View";
     114      this.portCollectionView.Content = null;
     115      this.portCollectionView.Dock = System.Windows.Forms.DockStyle.Fill;
     116      this.portCollectionView.Location = new System.Drawing.Point(3, 3);
     117      this.portCollectionView.Name = "portCollectionView";
     118      this.portCollectionView.ReadOnly = false;
     119      this.portCollectionView.ShowDetails = true;
     120      this.portCollectionView.Size = new System.Drawing.Size(631, 459);
     121      this.portCollectionView.TabIndex = 0;
    75122      //
    76123      // NetworkView
    77124      //
    78125      this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Inherit;
    79       this.Controls.Add(this.nodeCollectionView);
     126      this.Controls.Add(this.tabControl);
    80127      this.Name = "NetworkView";
    81       this.Size = new System.Drawing.Size(645, 517);
    82128      this.Controls.SetChildIndex(this.nameLabel, 0);
    83129      this.Controls.SetChildIndex(this.nameTextBox, 0);
    84130      this.Controls.SetChildIndex(this.infoLabel, 0);
    85       this.Controls.SetChildIndex(this.nodeCollectionView, 0);
     131      this.Controls.SetChildIndex(this.tabControl, 0);
    86132      ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).EndInit();
     133      this.tabControl.ResumeLayout(false);
     134      this.nodesTabPage.ResumeLayout(false);
     135      this.portsTabPage.ResumeLayout(false);
    87136      this.ResumeLayout(false);
    88137      this.PerformLayout();
     
    93142
    94143    protected NodeCollectionView nodeCollectionView;
     144    protected MainForm.WindowsForms.DragOverTabControl tabControl;
     145    protected System.Windows.Forms.TabPage nodesTabPage;
     146    protected System.Windows.Forms.TabPage portsTabPage;
     147    protected PortCollectionView portCollectionView;
    95148
    96149
  • branches/OptimizationNetworks/HeuristicLab.Optimization.Networks.Views/3.3/Core.Networks.Views/NetworkView.cs

    r11528 r11530  
    5050      base.OnContentChanged();
    5151      nodeCollectionView.Content = Content == null ? null : Content.Nodes;
     52      portCollectionView.Content = Content == null ? null : Content.Ports;
    5253    }
    5354
     
    5556      base.SetEnabledStateOfControls();
    5657      nodeCollectionView.Enabled = Content != null;
     58      portCollectionView.Enabled = Content != null;
    5759    }
    5860  }
  • branches/OptimizationNetworks/HeuristicLab.Optimization.Networks.Views/3.3/Core.Networks.Views/UserDefinedNetworkView.cs

    r11529 r11530  
    4040      base.OnContentChanged();
    4141      nodeCollectionView.Content = Content == null ? null : Content.Nodes;
     42      portCollectionView.Content = Content == null ? null : Content.Ports;
    4243    }
    4344  }
  • branches/OptimizationNetworks/HeuristicLab.Optimization.Networks.Views/3.3/HeuristicLab.Optimization.Networks.Views-3.3.csproj

    r11529 r11530  
    9191  </ItemGroup>
    9292  <ItemGroup>
    93     <Compile Include="Core.Networks.Views\GenericPortView.cs">
    94       <SubType>UserControl</SubType>
    95     </Compile>
    96     <Compile Include="Core.Networks.Views\GenericPortView.Designer.cs">
    97       <DependentUpon>GenericPortView.cs</DependentUpon>
    98     </Compile>
    9993    <Compile Include="Core.Networks.Views\MessageCollectionView.cs">
    10094      <SubType>UserControl</SubType>
     
    10397      <DependentUpon>MessageCollectionView.cs</DependentUpon>
    10498    </Compile>
     99    <Compile Include="Core.Networks.Views\MessagePortView.cs">
     100      <SubType>UserControl</SubType>
     101    </Compile>
     102    <Compile Include="Core.Networks.Views\MessagePortView.Designer.cs">
     103      <DependentUpon>MessagePortView.cs</DependentUpon>
     104    </Compile>
    105105    <Compile Include="Core.Networks.Views\MessageValueCollectionView.cs">
    106106      <SubType>UserControl</SubType>
     
    192192    <Compile Include="Core.Networks.Views\UserDefinedNetworkView.Designer.cs">
    193193      <DependentUpon>UserDefinedNetworkView.cs</DependentUpon>
     194    </Compile>
     195    <Compile Include="Core.Networks.Views\UserDefinedMessagePortView.cs">
     196      <SubType>UserControl</SubType>
     197    </Compile>
     198    <Compile Include="Core.Networks.Views\UserDefinedMessagePortView.Designer.cs">
     199      <DependentUpon>UserDefinedMessagePortView.cs</DependentUpon>
    194200    </Compile>
    195201    <Compile Include="Core.Networks.Views\UserDefinedNodeView.cs">
  • branches/OptimizationNetworks/HeuristicLab.Optimization.Networks.Views/3.3/Operators.Views/HookOperatorView.cs

    r11526 r11530  
    7676    protected virtual void portView_DragEnterOver(object sender, DragEventArgs e) {
    7777      e.Effect = DragDropEffects.None;
    78       var data = e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat) as IGenericPort;
     78      var data = e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat) as IMessagePort;
    7979
    8080      if (!ReadOnly && (data != null)) {
     
    8484    protected virtual void portView_DragDrop(object sender, DragEventArgs e) {
    8585      if (e.Effect != DragDropEffects.None) {
    86         var port = e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat) as IGenericPort;
     86        var port = e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat) as IMessagePort;
    8787        Content.Port = port;
    8888      }
  • branches/OptimizationNetworks/HeuristicLab.Optimization.Networks/3.3/Core.Networks/IMessagePort.cs

    r11529 r11530  
    2626
    2727namespace HeuristicLab.Core.Networks {
    28   public interface IGenericPort : IParameterizedPort {
    29     new PortParameterCollection Parameters { get; }
    30 
    31     IConnectedPort ConnectedPort { get; set; }
     28  public interface IMessagePort : IParameterizedPort {
     29    IMessagePort ConnectedPort { get; set; }
    3230    bool PortConnectionValid { get; }
    3331    bool LogMessages { get; set; }
    3432    MessageCollection Messages { get; }
    3533
     34    bool CanConnectToPort(IPort port);
     35
    3636    event EventHandler ConnectedPortChanged;
    3737    event EventHandler PortConnectionValidChanged;
    3838    event EventHandler LogMessagesChanged;
    39 
    40     bool CanConnectToPort(IPort port);
    41     void CloneConnectedPortParameters();
    4239
    4340    IMessage PrepareMessage();
     
    4643    Task SendMessageAsync(IMessage message);
    4744    Task SendMessageAsync(IMessage message, CancellationToken token);
     45    void ReceiveMessage(IMessage message, CancellationToken token);
    4846
     47    event EventHandler<EventArgs<IMessage, CancellationToken>> MessageSent;
    4948    event EventHandler<EventArgs<IMessage, CancellationToken>> MessageReceived;
    5049  }
  • branches/OptimizationNetworks/HeuristicLab.Optimization.Networks/3.3/Core.Networks/IParameterizedPort.cs

    r11529 r11530  
    2626    IKeyedItemCollection<string, IPortParameter> Parameters { get; }
    2727
     28    void CloneParametersFromPort(IParameterizedPort port);
     29
    2830    event EventHandler InterfaceChanged;
    2931  }
  • branches/OptimizationNetworks/HeuristicLab.Optimization.Networks/3.3/Core.Networks/MessagePort.cs

    r11529 r11530  
    2323using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    2424using System;
     25using System.Collections.Generic;
    2526using System.Drawing;
    2627using System.Linq;
     
    2930
    3031namespace HeuristicLab.Core.Networks {
    31   [Item("GenericPort", "A generic port of an optimization network node.")]
     32  [Item("MessagePort", "A port of a network node for sending and receiving messages.")]
    3233  [StorableClass]
    33   public class GenericPort : ParameterizedPort, IGenericPort, IConnectedPort {
     34  public class MessagePort : ParameterizedPort, IMessagePort {
    3435    public override Image ItemImage {
    3536      get {
     
    4445
    4546    [Storable]
    46     protected IConnectedPort connectedPort;
    47     public IConnectedPort ConnectedPort {
     47    protected IMessagePort connectedPort;
     48    public IMessagePort ConnectedPort {
    4849      get { return connectedPort; }
    4950      set {
     
    8788
    8889    [StorableConstructor]
    89     protected GenericPort(bool deserializing) : base(deserializing) { }
    90     protected GenericPort(GenericPort original, Cloner cloner)
     90    protected MessagePort(bool deserializing) : base(deserializing) { }
     91    protected MessagePort(MessagePort original, Cloner cloner)
    9192      : base(original, cloner) {
    9293      connectedPort = cloner.Clone(original.connectedPort);
     
    9697      RegisterConnectedPortEvents();
    9798    }
    98     public GenericPort()
    99       : base("GenericPort") {
     99    public MessagePort()
     100      : base("MessagePort") {
    100101      portConnectionValid = true;
    101102      logMessages = false;
    102103      messages = new MessageCollection();
    103104    }
    104     public GenericPort(string name)
     105    public MessagePort(string name)
    105106      : base(name) {
    106107      portConnectionValid = true;
     
    108109      messages = new MessageCollection();
    109110    }
    110     public GenericPort(string name, string description)
     111    public MessagePort(string name, string description)
    111112      : base(name, description) {
    112113      portConnectionValid = true;
     
    121122
    122123    public override IDeepCloneable Clone(Cloner cloner) {
    123       return new GenericPort(this, cloner);
     124      return new MessagePort(this, cloner);
    124125    }
    125126
     
    127128      if (port == null) return true;
    128129
    129       var cp = port as IConnectedPort;
    130       if (cp == null) return false;
    131 
    132       // check connected port input parameters
    133       foreach (var input in cp.Parameters.Where(p => p.Type.HasFlag(PortParameterType.Input))) {
    134         IPortParameter param;
    135         Parameters.TryGetValue(input.Name, out param);
    136         if ((param == null) && (input.DefaultValue == null)) return false;
    137         if (!param.Type.HasFlag(PortParameterType.Output)) return false;
    138         if (!input.DataType.IsAssignableFrom(param.DataType)) return false;
    139       }
    140       // check local port input parameters
    141       foreach (var input in Parameters.Where(p => p.Type.HasFlag(PortParameterType.Input))) {
    142         IPortParameter param;
    143         cp.Parameters.TryGetValue(input.Name, out param);
    144         if ((param == null) && (input.DefaultValue == null)) return false;
    145         if (!param.Type.HasFlag(PortParameterType.Output)) return false;
    146         if (!input.DataType.IsAssignableFrom(param.DataType)) return false;
    147       }
     130      var p = port as IMessagePort;
     131      if (p == null) return false;
     132
     133      // check if the local parameters are compatible to the input parameters of the port
     134      if (!ParametersCompatibleToTarget(Parameters, p.Parameters)) return false;
     135      // check if the parameters of the port are compatible to the local input parameters
     136      if (!ParametersCompatibleToTarget(p.Parameters, Parameters)) return false;
     137
    148138      return true;
    149     }
    150     public void CloneConnectedPortParameters() {
    151       Parameters.Clear();
    152       foreach (var p in connectedPort.Parameters) {
    153         var param = (IPortParameter)p.Clone();
    154         if (!(param.Type.HasFlag(PortParameterType.Input) && param.Type.HasFlag(PortParameterType.Output))) {
    155           param.Type = ~param.Type;  // bitwise negation: input -> output, output -> input
    156         }
    157         Parameters.Add(param);
    158       }
    159139    }
    160140
     
    163143      var message = new Message();
    164144
    165       // collect output parameters from local port
    166       message.Values.AddRange(
    167         Parameters
    168           .Where(p => p.Type.HasFlag(PortParameterType.Output))
    169           .Select(p => p.CreateMessageValue())
    170       );
    171 
    172       // collect remaining input parameters from connected port
     145      // collect parameters from local port
     146      message.Values.AddRange(Parameters.Select(p => p.CreateMessageValue()));
     147
     148      // collect remaining parameters from connected port
    173149      if (ConnectedPort != null) {
    174150        message.Values.AddRange(
    175151          ConnectedPort.Parameters
    176             .Where(p => p.Type.HasFlag(PortParameterType.Input) && !message.Values.ContainsKey(p.Name))
     152            .Where(p => !message.Values.ContainsKey(p.Name))
    177153            .Select(p => p.CreateMessageValue())
    178154        );
    179155      }
    180 
    181       // collect output parameters from connected port
    182       if (ConnectedPort != null) {
    183         message.Values.AddRange(
    184           ConnectedPort.Parameters
    185             .Where(p => p.Type.HasFlag(PortParameterType.Output) && !message.Values.ContainsKey(p.Name))
    186             .Select(p => p.CreateMessageValue())
    187         );
    188       }
    189 
    190       // collect remaining input parameters from local port
    191       message.Values.AddRange(
    192         Parameters
    193           .Where(p => p.Type.HasFlag(PortParameterType.Input) && !message.Values.ContainsKey(p.Name))
    194           .Select(p => p.CreateMessageValue())
    195       );
    196156
    197157      return message;
     
    270230    }
    271231    #endregion
     232
     233    #region Helpers
     234    protected virtual bool ParametersCompatibleToTarget(IEnumerable<IPortParameter> source, IEnumerable<IPortParameter> target) {
     235      // checks if the source parameters are compatible to the input parameters of the target
     236      foreach (var input in target.Where(p => p.Type.HasFlag(PortParameterType.Input))) {
     237        var param = source.Where(p => input.Name == p.Name).FirstOrDefault();
     238        if (param == null) {
     239          if (input.DefaultValue == null) return false;
     240        } else {
     241          if (!param.Type.HasFlag(PortParameterType.Output)) return false;
     242          if (!input.DataType.IsAssignableFrom(param.DataType)) return false;
     243        }
     244      }
     245      return true;
     246    }
     247    #endregion
    272248  }
    273249}
  • branches/OptimizationNetworks/HeuristicLab.Optimization.Networks/3.3/Core.Networks/ParameterizedPort.cs

    r11529 r11530  
    8383    }
    8484
     85    public virtual void CloneParametersFromPort(IParameterizedPort port) {
     86      Parameters.Clear();
     87      foreach (var p in port.Parameters) {
     88        var param = (IPortParameter)p.Clone();
     89        if (!(param.Type.HasFlag(PortParameterType.Input) && param.Type.HasFlag(PortParameterType.Output))) {
     90          param.Type = ~param.Type;  // bitwise negation: input -> output, output -> input
     91        }
     92        Parameters.Add(param);
     93      }
     94    }
     95
    8596    public event EventHandler InterfaceChanged;
    8697    protected virtual void OnInterfaceChanged() {
  • branches/OptimizationNetworks/HeuristicLab.Optimization.Networks/3.3/HeuristicLab.Optimization.Networks-3.3.csproj

    r11529 r11530  
    9090  </ItemGroup>
    9191  <ItemGroup>
     92    <Compile Include="Core.Networks\IUserDefinedMessagePort.cs" />
     93    <Compile Include="Core.Networks\IMessagePort.cs" />
    9294    <Compile Include="Core.Networks\IUserDefinedNetwork.cs" />
    9395    <Compile Include="Core.Networks\IUserDefinedNode.cs" />
     96    <Compile Include="Core.Networks\MessagePort.cs" />
    9497    <Compile Include="Core.Networks\UserDefinedNetwork.cs" />
    95     <Compile Include="Core.Networks\GenericPort.cs" />
    96     <Compile Include="Core.Networks\IConnectedPort.cs" />
    97     <Compile Include="Core.Networks\IGenericPort.cs" />
    9898    <Compile Include="Core.Networks\IMessage.cs" />
    9999    <Compile Include="Core.Networks\IMessageValue.cs" />
     
    118118    <Compile Include="Core.Networks\PortParameterCollection.cs" />
    119119    <Compile Include="Core.Networks\PortParameterType.cs" />
     120    <Compile Include="Core.Networks\UserDefinedMessagePort.cs" />
    120121    <Compile Include="Core.Networks\UserDefinedNode.cs" />
    121122    <Compile Include="Operators\HookOperator.cs" />
  • branches/OptimizationNetworks/HeuristicLab.Optimization.Networks/3.3/Operators/HookOperator.cs

    r11526 r11530  
    3636
    3737    [Storable]
    38     protected IGenericPort port;
    39     public IGenericPort Port {
     38    protected IMessagePort port;
     39    public IMessagePort Port {
    4040      get { return port; }
    4141      set {
  • branches/OptimizationNetworks/HeuristicLab.Optimization.Networks/3.3/Operators/IHookOperator.cs

    r11526 r11530  
    2727  public interface IHookOperator : IOperator {
    2828    new ParameterCollection Parameters { get; }
    29     IGenericPort Port { get; set; }
     29    IMessagePort Port { get; set; }
    3030
    3131    event EventHandler PortChanged;
  • branches/OptimizationNetworks/HeuristicLab.Optimization.Networks/3.3/Optimization.Networks.KSPTSP/KSPTSPConnector.cs

    r11526 r11530  
    6565
    6666    protected virtual void Initialize() {
    67       var parameters = new GenericPort("Parameters");
     67      var parameters = new MessagePort("Parameters");
    6868      Ports.Add(parameters);
    6969      parameters.Parameters.Add(new PortParameter<DoubleMatrix>("Cities") { Type = PortParameterType.Input });
    7070      parameters.Parameters.Add(new PortParameter<DoubleValue>("TransportCostsFactor") { Type = PortParameterType.Input });
    7171
    72       var ksp = new GenericPort("KSP Connector");
     72      var ksp = new MessagePort("KSP Connector");
    7373      Ports.Add(ksp);
    7474      ksp.Parameters.Add(new PortParameter<BinaryVector>("KnapsackSolution") { Type = PortParameterType.Input });
     
    7777      ksp.Parameters.Add(new PortParameter<PathTSPTour>("Route") { Type = PortParameterType.Output });
    7878
    79       var tsp = new GenericPort("TSP Connector");
     79      var tsp = new MessagePort("TSP Connector");
    8080      Ports.Add(tsp);
    8181      tsp.Parameters.Add(new PortParameter<DoubleMatrix>("Coordinates") { Type = PortParameterType.Output });
     
    8585
    8686    protected virtual void RegisterEvents() {
    87       var ksp = (IGenericPort)Ports["KSP Connector"];
     87      var ksp = (IMessagePort)Ports["KSP Connector"];
    8888      ksp.MessageReceived += Knapsack_MessageReceived;
    8989    }
     
    9191    protected virtual void Knapsack_MessageReceived(object sender, EventArgs<IMessage, System.Threading.CancellationToken> e) {
    9292      // get parameters
    93       var parametersPort = (IGenericPort)Ports["Parameters"];
     93      var parametersPort = (IMessagePort)Ports["Parameters"];
    9494      var parameters = parametersPort.PrepareMessage();
    9595      parametersPort.SendMessage(parameters, e.Value2);
     
    112112
    113113      // solve TSP
    114       var tspConnectorPort = (IGenericPort)Ports["TSP Connector"];
     114      var tspConnectorPort = (IMessagePort)Ports["TSP Connector"];
    115115      var tspMsg = tspConnectorPort.PrepareMessage();
    116116      tspMsg["Coordinates"] = coords;
  • branches/OptimizationNetworks/HeuristicLab.Optimization.Networks/3.3/Optimization.Networks.KSPTSP/KSPTSPNetwork.cs

    r11529 r11530  
    6363      Nodes.Add(paramsNode);
    6464
    65       var paramsPort = new GenericPort("Parameters");
     65      var paramsPort = new MessagePort("Parameters");
    6666      paramsNode.Ports.Add(paramsPort);
    6767
     
    111111      });
    112112
    113       var evaluatePort = new GenericPort("EvaluateRoute");
     113      var evaluatePort = new MessagePort("EvaluateRoute");
    114114      kspNode.Ports.Add(evaluatePort);
    115115
     
    175175      hook.Port = evaluatePort;
    176176      configPort.ConnectedPort = paramsPort;
    177       evaluatePort.ConnectedPort = (IConnectedPort)ksptspConnector.Ports["KSP Connector"];
    178       ((IGenericPort)ksptspConnector.Ports["Parameters"]).ConnectedPort = paramsPort;
    179       ((IGenericPort)ksptspConnector.Ports["TSP Connector"]).ConnectedPort = executePort;
     177      evaluatePort.ConnectedPort = (IMessagePort)ksptspConnector.Ports["KSP Connector"];
     178      ((IMessagePort)ksptspConnector.Ports["Parameters"]).ConnectedPort = paramsPort;
     179      ((IMessagePort)ksptspConnector.Ports["TSP Connector"]).ConnectedPort = executePort;
    180180
    181181      paramsPort.SendMessage(paramsPort.PrepareMessage());
  • branches/OptimizationNetworks/HeuristicLab.Optimization.Networks/3.3/Optimization.Networks/ConfigurationPort.cs

    r11526 r11530  
    2828  [Item("ConfigurationPort", "A port of an optimization network node which triggers configuration changes.")]
    2929  [StorableClass]
    30   public class ConfigurationPort : GenericPort, IConfigurationPort {
     30  public class ConfigurationPort : MessagePort, IConfigurationPort {
    3131    [StorableConstructor]
    3232    protected ConfigurationPort(bool deserializing) : base(deserializing) { }
  • branches/OptimizationNetworks/HeuristicLab.Optimization.Networks/3.3/Optimization.Networks/ExecutionPort.cs

    r11526 r11530  
    2828  [Item("ExecutionPort", "A port of an optimization network node which triggers execution.")]
    2929  [StorableClass]
    30   public class ExecutionPort : GenericPort, IExecutionPort {
     30  public class ExecutionPort : MessagePort, IExecutionPort {
    3131    [StorableConstructor]
    3232    protected ExecutionPort(bool deserializing) : base(deserializing) { }
  • branches/OptimizationNetworks/HeuristicLab.Optimization.Networks/3.3/Optimization.Networks/IConfigurationPort.cs

    r11526 r11530  
    2323
    2424namespace HeuristicLab.Optimization.Networks {
    25   public interface IConfigurationPort : IGenericPort { }
     25  public interface IConfigurationPort : IMessagePort { }
    2626}
  • branches/OptimizationNetworks/HeuristicLab.Optimization.Networks/3.3/Optimization.Networks/IExecutionPort.cs

    r11526 r11530  
    2323
    2424namespace HeuristicLab.Optimization.Networks {
    25   public interface IExecutionPort : IGenericPort { }
     25  public interface IExecutionPort : IMessagePort { }
    2626}
Note: See TracChangeset for help on using the changeset viewer.