Free cookie consent management tool by TermsFeed Policy Generator

Changeset 11563


Ignore:
Timestamp:
11/22/14 04:50:37 (9 years ago)
Author:
swagner
Message:

#2205: Continued working on programmable network items

  • implemented view and some refactoring
Location:
branches/OptimizationNetworks
Files:
3 added
7 edited

Legend:

Unmodified
Added
Removed
  • branches/OptimizationNetworks/HeuristicLab.Optimization.Networks.Views/3.3/HeuristicLab.Optimization.Networks.Views-3.3.csproj

    r11530 r11563  
    187187      <DependentUpon>PortView.cs</DependentUpon>
    188188    </Compile>
     189    <Compile Include="Core.Networks.Views\ProgrammableNetworkItemView.cs">
     190      <SubType>UserControl</SubType>
     191    </Compile>
     192    <Compile Include="Core.Networks.Views\ProgrammableNetworkItemView.Designer.cs">
     193      <DependentUpon>ProgrammableNetworkItemView.cs</DependentUpon>
     194    </Compile>
    189195    <Compile Include="Core.Networks.Views\UserDefinedNetworkView.cs">
    190196      <SubType>UserControl</SubType>
     
    226232  </ItemGroup>
    227233  <ItemGroup>
     234    <ProjectReference Include="..\..\HeuristicLab.CodeEditor\3.3\HeuristicLab.CodeEditor-3.3.csproj">
     235      <Project>{489cfe09-fdf7-4c89-bab5-bd09cadd61ad}</Project>
     236      <Name>HeuristicLab.CodeEditor-3.3</Name>
     237      <Private>False</Private>
     238    </ProjectReference>
    228239    <ProjectReference Include="..\..\HeuristicLab.Collections\3.3\HeuristicLab.Collections-3.3.csproj">
    229240      <Project>{958b43bc-cc5c-4fa2-8628-2b3b01d890b6}</Project>
    230241      <Name>HeuristicLab.Collections-3.3</Name>
     242      <Private>False</Private>
    231243    </ProjectReference>
    232244    <ProjectReference Include="..\..\HeuristicLab.Common.Resources\3.3\HeuristicLab.Common.Resources-3.3.csproj">
    233245      <Project>{0e27a536-1c4a-4624-a65e-dc4f4f23e3e1}</Project>
    234246      <Name>HeuristicLab.Common.Resources-3.3</Name>
     247      <Private>False</Private>
    235248    </ProjectReference>
    236249    <ProjectReference Include="..\..\HeuristicLab.Common\3.3\HeuristicLab.Common-3.3.csproj">
    237250      <Project>{a9ad58b9-3ef9-4cc1-97e5-8d909039ff5c}</Project>
    238251      <Name>HeuristicLab.Common-3.3</Name>
     252      <Private>False</Private>
    239253    </ProjectReference>
    240254    <ProjectReference Include="..\..\HeuristicLab.Core.Views\3.3\HeuristicLab.Core.Views-3.3.csproj">
    241255      <Project>{e226881d-315f-423d-b419-a766fe0d8685}</Project>
    242256      <Name>HeuristicLab.Core.Views-3.3</Name>
     257      <Private>False</Private>
    243258    </ProjectReference>
    244259    <ProjectReference Include="..\..\HeuristicLab.Core\3.3\HeuristicLab.Core-3.3.csproj">
    245260      <Project>{c36bd924-a541-4a00-afa8-41701378ddc5}</Project>
    246261      <Name>HeuristicLab.Core-3.3</Name>
     262      <Private>False</Private>
    247263    </ProjectReference>
    248264    <ProjectReference Include="..\..\HeuristicLab.Data\3.3\HeuristicLab.Data-3.3.csproj">
    249265      <Project>{bbab9df5-5ef3-4ba8-ade9-b36e82114937}</Project>
    250266      <Name>HeuristicLab.Data-3.3</Name>
     267      <Private>False</Private>
    251268    </ProjectReference>
    252269    <ProjectReference Include="..\..\HeuristicLab.MainForm.WindowsForms\3.3\HeuristicLab.MainForm.WindowsForms-3.3.csproj">
    253270      <Project>{ab687bbe-1bfe-476b-906d-44237135431d}</Project>
    254271      <Name>HeuristicLab.MainForm.WindowsForms-3.3</Name>
     272      <Private>False</Private>
    255273    </ProjectReference>
    256274    <ProjectReference Include="..\..\HeuristicLab.MainForm\3.3\HeuristicLab.MainForm-3.3.csproj">
    257275      <Project>{3bd61258-31da-4b09-89c0-4f71fef5f05a}</Project>
    258276      <Name>HeuristicLab.MainForm-3.3</Name>
     277      <Private>False</Private>
    259278    </ProjectReference>
    260279    <ProjectReference Include="..\..\HeuristicLab.Operators.Views\3.3\HeuristicLab.Operators.Views-3.3.csproj">
    261280      <Project>{c49cb749-8b24-4628-8003-e86475749410}</Project>
    262281      <Name>HeuristicLab.Operators.Views-3.3</Name>
     282      <Private>False</Private>
    263283    </ProjectReference>
    264284    <ProjectReference Include="..\..\HeuristicLab.Operators\3.3\HeuristicLab.Operators-3.3.csproj">
    265285      <Project>{23da7ff4-d5b8-41b6-aa96-f0561d24f3ee}</Project>
    266286      <Name>HeuristicLab.Operators-3.3</Name>
     287      <Private>False</Private>
    267288    </ProjectReference>
    268289    <ProjectReference Include="..\..\HeuristicLab.Optimization.Networks\3.3\HeuristicLab.Optimization.Networks-3.3.csproj">
    269290      <Project>{7cf51332-0e37-447c-8017-82a258c59ef2}</Project>
    270291      <Name>HeuristicLab.Optimization.Networks-3.3</Name>
     292      <Private>False</Private>
    271293    </ProjectReference>
    272294    <ProjectReference Include="..\..\HeuristicLab.Optimization.Views\3.3\HeuristicLab.Optimization.Views-3.3.csproj">
    273295      <Project>{662b4b15-8f4d-4ae5-b3eb-d91c215f5af2}</Project>
    274296      <Name>HeuristicLab.Optimization.Views-3.3</Name>
     297      <Private>False</Private>
    275298    </ProjectReference>
    276299    <ProjectReference Include="..\..\HeuristicLab.Optimization\3.3\HeuristicLab.Optimization-3.3.csproj">
    277300      <Project>{14ab8d24-25bc-400c-a846-4627aa945192}</Project>
    278301      <Name>HeuristicLab.Optimization-3.3</Name>
     302      <Private>False</Private>
    279303    </ProjectReference>
    280304    <ProjectReference Include="..\..\HeuristicLab.PluginInfrastructure\3.3\HeuristicLab.PluginInfrastructure-3.3.csproj">
  • branches/OptimizationNetworks/HeuristicLab.Optimization.Networks.Views/3.3/Plugin.cs.frame

    r11519 r11563  
    2828  [Plugin("HeuristicLab.Optimization.Networks.Views", "3.3.11.$WCREV$")]
    2929  [PluginFile("HeuristicLab.Optimization.Networks.Views-3.3.dll", PluginFileType.Assembly)]
     30  [PluginDependency("HeuristicLab.CodeEditor", "3.3")]
    3031  [PluginDependency("HeuristicLab.Collections", "3.3")]
    3132  [PluginDependency("HeuristicLab.Common", "3.3")]
  • branches/OptimizationNetworks/HeuristicLab.Optimization.Networks/3.3/Core.Networks/ProgrammableNetworkItem.cs

    r11562 r11563  
    2424using Microsoft.CSharp;
    2525using System;
    26 using System.CodeDom;
    2726using System.CodeDom.Compiler;
    2827using System.Collections.Generic;
     
    3635  [Item("ProgrammableNetworkItem", "Abstract base class for programmable items of a network.")]
    3736  [StorableClass]
    38   public abstract class ProgrammableNetworkItem : NetworkItem {
     37  public abstract class ProgrammableNetworkItem : NetworkItem, IProgrammableNetworkItem {
    3938    #region Item Properties
    4039    public static new Image StaticItemImage {
     
    6261
    6362    protected virtual string CodeTemplate {
    64       get { return ReadCodeTemplate("ProgrammableNetworkItemTemplate.cs"); }
     63      get { return ReadCodeTemplate("HeuristicLab.Optimization.Networks.Core.Networks.ProgrammableNetworkItemTemplate.cs"); }
    6564    }
    6665
     
    8887    private INetworkItem compiledNetworkItem;
    8988    protected INetworkItem CompiledNetworkItem {
    90       get { return compiledNetworkItem; }
     89      get {
     90        if (compiledNetworkItem == null) {
     91          Compile();
     92        }
     93        return compiledNetworkItem;
     94      }
    9195      set {
    9296        if (compiledNetworkItem != value) {
     
    152156            .AppendLine(error.ErrorText);
    153157        }
    154         throw new Exception(string.Format("Compilation of \"{0}\" failed:{1}{2}",
     158        throw new InvalidOperationException(string.Format("Compilation of \"{0}\" failed:{1}{2}",
    155159          Name, Environment.NewLine, sb.ToString()));
    156160      }
    157       var assembly = results.CompiledAssembly;
    158       compiledNetworkItem = (INetworkItem)Activator.CreateInstance(assembly.GetTypes().Single(x => typeof(CompiledProgrammableNetworkItem).IsAssignableFrom(x)), this);
     161      CompiledNetworkItem = (INetworkItem)Activator.CreateInstance(
     162        results.CompiledAssembly.GetTypes()
     163          .Single(x => typeof(CompiledProgrammableNetworkItem)
     164          .IsAssignableFrom(x)),
     165        this);
     166    }
     167    public virtual IEnumerable<Assembly> GetAssemblies() {
     168      return AppDomain.CurrentDomain.GetAssemblies().Where(a => !a.IsDynamic && File.Exists(a.Location));
    159169    }
    160170    #endregion
     
    293303
    294304    #region Helpers
    295     protected virtual IEnumerable<Assembly> GetAssemblies() {
    296       foreach (var a in AppDomain.CurrentDomain.GetAssemblies()) {
    297         bool valid = false;
    298         try {
    299           valid = File.Exists(a.Location);
    300         }
    301         catch (NotSupportedException) {
    302           // NotSupportedException is thrown while accessing
    303           // the Location property of the anonymously hosted
    304           // dynamic methods assembly, which is related to
    305           // LINQ queries
    306         }
    307         if (valid) yield return a;
    308       }
    309     }
    310305    protected string ReadCodeTemplate(string templateName) {
    311306      using (var stream = Assembly.GetExecutingAssembly().GetManifestResourceStream(templateName))
  • branches/OptimizationNetworks/HeuristicLab.Optimization.Networks/3.3/Core.Networks/ProgrammableNetworkItemTemplate.cs

    r11562 r11563  
    1 #region License Information
    2 /* HeuristicLab
    3  * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    4  *
    5  * This file is part of HeuristicLab.
    6  *
    7  * HeuristicLab is free software: you can redistribute it and/or modify
    8  * it under the terms of the GNU General Public License as published by
    9  * the Free Software Foundation, either version 3 of the License, or
    10  * (at your option) any later version.
    11  *
    12  * HeuristicLab is distributed in the hope that it will be useful,
    13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
    14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    15  * GNU General Public License for more details.
    16  *
    17  * You should have received a copy of the GNU General Public License
    18  * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
    19  */
    20 #endregion
    21 
    221using HeuristicLab.Common;
    232using System;
     
    276  public class MyProgrammableNetworkItem : ProgrammableNetworkItem.CompiledProgrammableNetworkItem {
    287    protected MyProgrammableNetworkItem(MyProgrammableNetworkItem original, Cloner cloner) : base(original, cloner) { }
    29     protected MyProgrammableNetworkItem(ProgrammableNetworkItem context) : base(context) { }
     8    public MyProgrammableNetworkItem(ProgrammableNetworkItem context) : base(context) { }
    309
    3110    public override IDeepCloneable Clone(Cloner cloner) {
  • branches/OptimizationNetworks/HeuristicLab.Optimization.Networks/3.3/Core.Networks/ProgrammableNode.cs

    r11562 r11563  
    3131  public class ProgrammableNode : ProgrammableNetworkItem, INode {
    3232    protected override string CodeTemplate {
    33       get { return ReadCodeTemplate("ProgrammableNodeTemplate.cs"); }
     33      get { return ReadCodeTemplate("HeuristicLab.Optimization.Networks.Core.Networks.ProgrammableNodeTemplate.cs"); }
    3434    }
    3535
  • branches/OptimizationNetworks/HeuristicLab.Optimization.Networks/3.3/Core.Networks/ProgrammableNodeTemplate.cs

    r11562 r11563  
    1 #region License Information
    2 /* HeuristicLab
    3  * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    4  *
    5  * This file is part of HeuristicLab.
    6  *
    7  * HeuristicLab is free software: you can redistribute it and/or modify
    8  * it under the terms of the GNU General Public License as published by
    9  * the Free Software Foundation, either version 3 of the License, or
    10  * (at your option) any later version.
    11  *
    12  * HeuristicLab is distributed in the hope that it will be useful,
    13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
    14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    15  * GNU General Public License for more details.
    16  *
    17  * You should have received a copy of the GNU General Public License
    18  * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
    19  */
    20 #endregion
    21 
    221using HeuristicLab.Common;
    232using System;
     
    287  public class MyProgrammableNode : ProgrammableNode.CompiledProgrammableNode {
    298    protected MyProgrammableNode(MyProgrammableNode original, Cloner cloner) : base(original, cloner) { }
    30     protected MyProgrammableNode(ProgrammableNode context) : base(context) { }
     9    public MyProgrammableNode(ProgrammableNode context) : base(context) { }
    3110
    3211    public override IDeepCloneable Clone(Cloner cloner) {
  • branches/OptimizationNetworks/HeuristicLab.Optimization.Networks/3.3/HeuristicLab.Optimization.Networks-3.3.csproj

    r11562 r11563  
    9191  <ItemGroup>
    9292    <Compile Include="Core.Networks\IConnectablePort.cs" />
     93    <Compile Include="Core.Networks\IProgrammableNetworkItem.cs" />
    9394    <Compile Include="Core.Networks\IUserDefinedMessagePort.cs" />
    9495    <Compile Include="Core.Networks\IMessagePort.cs" />
     
    148149      <Project>{a51da44f-cb35-4f6f-99f5-2a2e904ab93b}</Project>
    149150      <Name>HeuristicLab.Algorithms.GeneticAlgorithm-3.3</Name>
     151      <Private>False</Private>
    150152    </ProjectReference>
    151153    <ProjectReference Include="..\..\HeuristicLab.Collections\3.3\HeuristicLab.Collections-3.3.csproj">
    152154      <Project>{958b43bc-cc5c-4fa2-8628-2b3b01d890b6}</Project>
    153155      <Name>HeuristicLab.Collections-3.3</Name>
     156      <Private>False</Private>
    154157    </ProjectReference>
    155158    <ProjectReference Include="..\..\HeuristicLab.Common.Resources\3.3\HeuristicLab.Common.Resources-3.3.csproj">
    156159      <Project>{0e27a536-1c4a-4624-a65e-dc4f4f23e3e1}</Project>
    157160      <Name>HeuristicLab.Common.Resources-3.3</Name>
     161      <Private>False</Private>
    158162    </ProjectReference>
    159163    <ProjectReference Include="..\..\HeuristicLab.Common\3.3\HeuristicLab.Common-3.3.csproj">
    160164      <Project>{a9ad58b9-3ef9-4cc1-97e5-8d909039ff5c}</Project>
    161165      <Name>HeuristicLab.Common-3.3</Name>
     166      <Private>False</Private>
    162167    </ProjectReference>
    163168    <ProjectReference Include="..\..\HeuristicLab.Core\3.3\HeuristicLab.Core-3.3.csproj">
    164169      <Project>{c36bd924-a541-4a00-afa8-41701378ddc5}</Project>
    165170      <Name>HeuristicLab.Core-3.3</Name>
     171      <Private>False</Private>
    166172    </ProjectReference>
    167173    <ProjectReference Include="..\..\HeuristicLab.Data\3.3\HeuristicLab.Data-3.3.csproj">
    168174      <Project>{bbab9df5-5ef3-4ba8-ade9-b36e82114937}</Project>
    169175      <Name>HeuristicLab.Data-3.3</Name>
     176      <Private>False</Private>
    170177    </ProjectReference>
    171178    <ProjectReference Include="..\..\HeuristicLab.Encodings.BinaryVectorEncoding\3.3\HeuristicLab.Encodings.BinaryVectorEncoding-3.3.csproj">
    172179      <Project>{66d249c3-a01d-42a8-82a2-919bc8ec3d83}</Project>
    173180      <Name>HeuristicLab.Encodings.BinaryVectorEncoding-3.3</Name>
     181      <Private>False</Private>
    174182    </ProjectReference>
    175183    <ProjectReference Include="..\..\HeuristicLab.Encodings.PermutationEncoding\3.3\HeuristicLab.Encodings.PermutationEncoding-3.3.csproj">
    176184      <Project>{dbecb8b0-b166-4133-baf1-ed67c3fd7fca}</Project>
    177185      <Name>HeuristicLab.Encodings.PermutationEncoding-3.3</Name>
     186      <Private>False</Private>
    178187    </ProjectReference>
    179188    <ProjectReference Include="..\..\HeuristicLab.Operators\3.3\HeuristicLab.Operators-3.3.csproj">
    180189      <Project>{23da7ff4-d5b8-41b6-aa96-f0561d24f3ee}</Project>
    181190      <Name>HeuristicLab.Operators-3.3</Name>
     191      <Private>False</Private>
    182192    </ProjectReference>
    183193    <ProjectReference Include="..\..\HeuristicLab.Optimization\3.3\HeuristicLab.Optimization-3.3.csproj">
    184194      <Project>{14ab8d24-25bc-400c-a846-4627aa945192}</Project>
    185195      <Name>HeuristicLab.Optimization-3.3</Name>
     196      <Private>False</Private>
    186197    </ProjectReference>
    187198    <ProjectReference Include="..\..\HeuristicLab.Parameters\3.3\HeuristicLab.Parameters-3.3.csproj">
    188199      <Project>{56f9106a-079f-4c61-92f6-86a84c2d84b7}</Project>
    189200      <Name>HeuristicLab.Parameters-3.3</Name>
     201      <Private>False</Private>
    190202    </ProjectReference>
    191203    <ProjectReference Include="..\..\HeuristicLab.Persistence\3.3\HeuristicLab.Persistence-3.3.csproj">
    192204      <Project>{102bc7d3-0ef9-439c-8f6d-96ff0fdb8e1b}</Project>
    193205      <Name>HeuristicLab.Persistence-3.3</Name>
     206      <Private>False</Private>
    194207    </ProjectReference>
    195208    <ProjectReference Include="..\..\HeuristicLab.PluginInfrastructure\3.3\HeuristicLab.PluginInfrastructure-3.3.csproj">
     
    201214      <Project>{3540e29e-4793-49e7-8ee2-fea7f61c3994}</Project>
    202215      <Name>HeuristicLab.Problems.Instances-3.3</Name>
     216      <Private>False</Private>
    203217    </ProjectReference>
    204218    <ProjectReference Include="..\..\HeuristicLab.Problems.Knapsack\3.3\HeuristicLab.Problems.Knapsack-3.3.csproj">
    205219      <Project>{e10f395f-c8a6-48ad-b470-9aa7a1f43809}</Project>
    206220      <Name>HeuristicLab.Problems.Knapsack-3.3</Name>
     221      <Private>False</Private>
    207222    </ProjectReference>
    208223    <ProjectReference Include="..\..\HeuristicLab.Problems.TravelingSalesman\3.3\HeuristicLab.Problems.TravelingSalesman-3.3.csproj">
    209224      <Project>{d767c38d-8014-46b0-9a32-03a3aecce34a}</Project>
    210225      <Name>HeuristicLab.Problems.TravelingSalesman-3.3</Name>
     226      <Private>False</Private>
    211227    </ProjectReference>
    212228  </ItemGroup>
Note: See TracChangeset for help on using the changeset viewer.