Changeset 11490
- Timestamp:
- 10/24/14 05:05:47 (10 years ago)
- Location:
- branches/OptimizationNetworks/HeuristicLab.Optimization.Networks/3.3
- Files:
-
- 3 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/OptimizationNetworks/HeuristicLab.Optimization.Networks/3.3/HeuristicLab.Optimization.Networks-3.3.csproj
r11489 r11490 92 92 <Compile Include="ClientNode.cs" /> 93 93 <Compile Include="AlgorithmServiceNode.cs" /> 94 <Compile Include="IConnectedPort.cs" /> 94 95 <Compile Include="IGenericPort.cs" /> 95 96 <Compile Include="IMessage.cs" /> 96 97 <Compile Include="IMessageValue.cs" /> 98 <Compile Include="Message.cs" /> 97 99 <Compile Include="ParameterizedPort.cs" /> 98 100 <Compile Include="IClientNode.cs" /> … … 119 121 <Compile Include="ClientServicePort.cs" /> 120 122 <Compile Include="ClientPort.cs" /> 123 <Compile Include="GenericPort.cs" /> 121 124 <Compile Include="ServicePort.cs" /> 122 125 <Compile Include="Port.cs" /> -
branches/OptimizationNetworks/HeuristicLab.Optimization.Networks/3.3/IGenericPort.cs
r11489 r11490 27 27 namespace HeuristicLab.Optimization.Networks { 28 28 public interface IGenericPort : IParameterizedPort { 29 I GenericPort ConnectedPort { get; set; }29 IConnectedPort ConnectedPort { get; set; } 30 30 bool PortConnectionValid { get; } 31 31 … … 40 40 Task SendMessageAsync(IMessage message); 41 41 Task SendMessageAsync(IMessage message, CancellationToken token); 42 event EventHandler<EventArgs<IMessage, CancellationToken>> MessageSent;43 42 44 void ReceiveMessage(IMessage message);45 void ReceiveMessage(IMessage message, CancellationToken token);46 Task ReceiveMessageAsync(IMessage message);47 Task ReceiveMessageAsync(IMessage message, CancellationToken token);48 43 event EventHandler<EventArgs<IMessage, CancellationToken>> MessageReceived; 49 44 } -
branches/OptimizationNetworks/HeuristicLab.Optimization.Networks/3.3/IMessage.cs
r11489 r11490 20 20 #endregion 21 21 22 using HeuristicLab.Core; 22 23 23 24 namespace HeuristicLab.Optimization.Networks { 24 public interface IMessage {25 public interface IMessage : IItem { 25 26 MessageValueCollection Values { get; } 27 IItem this[string valueName] { get; } 26 28 } 27 29 } -
branches/OptimizationNetworks/HeuristicLab.Optimization.Networks/3.3/IPortParameter.cs
r11489 r11490 28 28 Type DataType { get; } 29 29 PortParameterType Type { get; set; } 30 IItem Value { get; set; }30 IItem DefaultValue { get; set; } 31 31 32 32 event EventHandler TypeChanged; 33 33 event EventHandler ValueChanged; 34 35 IMessageValue CreateMessageValue(); 34 36 } 35 37 36 38 public interface IPortParameter<T> : IPortParameter where T : class, IItem { 37 new T Value { get; set; } 39 new T DefaultValue { get; set; } 40 41 new IMessageValue<T> CreateMessageValue(); 38 42 } 39 43 } -
branches/OptimizationNetworks/HeuristicLab.Optimization.Networks/3.3/PortParameter.cs
r11489 r11490 63 63 } 64 64 [Storable] 65 protected T value;66 public T Value {67 get { return value; }65 protected T defaultValue; 66 public T DefaultValue { 67 get { return defaultValue; } 68 68 set { 69 if (value != this. value) {70 Deregister ValueEvents();71 this. value = value;72 Register ValueEvents();69 if (value != this.defaultValue) { 70 DeregisterDefaultValueEvents(); 71 this.defaultValue = value; 72 RegisterDefaultValueEvents(); 73 73 OnValueChanged(); 74 74 } 75 75 } 76 76 } 77 IItem IPortParameter. Value {78 get { return Value; }77 IItem IPortParameter.DefaultValue { 78 get { return DefaultValue; } 79 79 set { 80 80 T val = value as T; … … 84 84 typeof(T).GetPrettyName()) 85 85 ); 86 Value = val;86 DefaultValue = val; 87 87 } 88 88 } … … 93 93 : base(original, cloner) { 94 94 this.type = original.type; 95 this. value = cloner.Clone(original.value);96 Register ValueEvents();95 this.defaultValue = cloner.Clone(original.defaultValue); 96 RegisterDefaultValueEvents(); 97 97 } 98 98 public PortParameter() : base("PortParameter") { } … … 102 102 [StorableHook(HookType.AfterDeserialization)] 103 103 private void AfterDeserialization() { 104 Register ValueEvents();104 RegisterDefaultValueEvents(); 105 105 } 106 106 … … 111 111 public override string ToString() { 112 112 var s = base.ToString(); 113 if ( Value != null)114 s += ": " + Value.ToString();113 if (DefaultValue != null) 114 s += ": " + DefaultValue.ToString(); 115 115 return s; 116 116 } … … 129 129 OnToStringChanged(); 130 130 } 131 protected virtual void RegisterValueEvents() { 132 if (value != null) { 133 value.ToStringChanged += new EventHandler(Value_ToStringChanged); 131 132 public IMessageValue<T> CreateMessageValue() { 133 if (DefaultValue == null) 134 return new MessageValue<T>(Name); 135 else 136 return new MessageValue<T>(Name, (T)DefaultValue.Clone()); 137 } 138 IMessageValue IPortParameter.CreateMessageValue() { 139 return CreateMessageValue(); 140 } 141 142 #region DefaultValue Events 143 protected virtual void RegisterDefaultValueEvents() { 144 if (defaultValue != null) { 145 defaultValue.ToStringChanged += new EventHandler(DefaultValue_ToStringChanged); 134 146 } 135 147 } 136 protected virtual void Deregister ValueEvents() {137 if ( value != null) {138 value.ToStringChanged -= new EventHandler(Value_ToStringChanged);148 protected virtual void DeregisterDefaultValueEvents() { 149 if (defaultValue != null) { 150 defaultValue.ToStringChanged -= new EventHandler(DefaultValue_ToStringChanged); 139 151 } 140 152 } 141 private void Value_ToStringChanged(object sender, EventArgs e) {153 private void DefaultValue_ToStringChanged(object sender, EventArgs e) { 142 154 OnToStringChanged(); 143 155 } 156 #endregion 144 157 } 145 158 } -
branches/OptimizationNetworks/HeuristicLab.Optimization.Networks/3.3/PortParameterType.cs
r11489 r11490 20 20 #endregion 21 21 22 using System; 22 23 23 24 namespace HeuristicLab.Optimization.Networks { 25 [Flags] 24 26 public enum PortParameterType { 25 Input ,26 Output 27 Input = 1, 28 Output = 2 27 29 } 28 30 }
Note: See TracChangeset
for help on using the changeset viewer.