Free cookie consent management tool by TermsFeed Policy Generator

Changeset 17435


Ignore:
Timestamp:
02/11/20 17:35:28 (5 years ago)
Author:
dpiringe
Message:

#3026:

  • set read-only to false for name input (in JsonItemBaseControl)
  • result items now can be selected/deselected in export dialog
  • removed metadata.problem property and renamed metadata.optimizer property to TemplateName in json template
  • fixed bug with wrong description for result items in AlgorithmConverter
  • refactored a lot of code in JCGenerator and added the need for a directory path (location for the template files)
  • fixed a null reference bug in JsonItemValidator (cannot try to iterate through possible null referenced collections)
Location:
branches/3026_IntegrationIntoSymSpace
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface.OptimizerIntegration/Shared/JsonItemBaseControl.Designer.cs

    r17433 r17435  
    7979      this.textBoxName.Location = new System.Drawing.Point(92, 23);
    8080      this.textBoxName.Name = "textBoxName";
    81       this.textBoxName.ReadOnly = true;
    8281      this.textBoxName.Size = new System.Drawing.Size(404, 20);
    8382      this.textBoxName.TabIndex = 10;
  • branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface.OptimizerIntegration/Views/ExportJsonDialog.Designer.cs

    r17406 r17435  
    3131      this.panel = new System.Windows.Forms.Panel();
    3232      this.jsonItemBindingSource = new System.Windows.Forms.BindingSource(this.components);
     33      this.resultItems = new System.Windows.Forms.CheckedListBox();
     34      this.groupBox2 = new System.Windows.Forms.GroupBox();
     35      this.groupBox3 = new System.Windows.Forms.GroupBox();
     36      this.splitContainer1 = new System.Windows.Forms.SplitContainer();
     37      this.splitContainer2 = new System.Windows.Forms.SplitContainer();
    3338      this.groupBoxDetails.SuspendLayout();
    3439      ((System.ComponentModel.ISupportInitialize)(this.jsonItemBindingSource)).BeginInit();
     40      this.groupBox2.SuspendLayout();
     41      this.groupBox3.SuspendLayout();
     42      ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
     43      this.splitContainer1.Panel1.SuspendLayout();
     44      this.splitContainer1.Panel2.SuspendLayout();
     45      this.splitContainer1.SuspendLayout();
     46      ((System.ComponentModel.ISupportInitialize)(this.splitContainer2)).BeginInit();
     47      this.splitContainer2.Panel1.SuspendLayout();
     48      this.splitContainer2.Panel2.SuspendLayout();
     49      this.splitContainer2.SuspendLayout();
    3550      this.SuspendLayout();
    3651      //
     
    4358      // exportButton
    4459      //
    45       this.exportButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
    46       this.exportButton.Location = new System.Drawing.Point(801, 687);
     60      this.exportButton.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
     61            | System.Windows.Forms.AnchorStyles.Right)));
     62      this.exportButton.Location = new System.Drawing.Point(3, 570);
    4763      this.exportButton.Name = "exportButton";
    48       this.exportButton.Size = new System.Drawing.Size(121, 34);
     64      this.exportButton.Size = new System.Drawing.Size(422, 29);
    4965      this.exportButton.TabIndex = 1;
    5066      this.exportButton.Text = "Export";
     
    5470      // treeView
    5571      //
    56       this.treeView.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
    57             | System.Windows.Forms.AnchorStyles.Left)));
    58       this.treeView.Location = new System.Drawing.Point(12, 12);
     72      this.treeView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
     73            | System.Windows.Forms.AnchorStyles.Left)
     74            | System.Windows.Forms.AnchorStyles.Right)));
     75      this.treeView.Location = new System.Drawing.Point(6, 19);
    5976      this.treeView.Name = "treeView";
    60       this.treeView.Size = new System.Drawing.Size(342, 669);
     77      this.treeView.Size = new System.Drawing.Size(353, 327);
    6178      this.treeView.TabIndex = 3;
    6279      this.treeView.AfterSelect += new System.Windows.Forms.TreeViewEventHandler(this.treeView_AfterSelect);
     
    6885            | System.Windows.Forms.AnchorStyles.Right)));
    6986      this.groupBoxDetails.Controls.Add(this.panel);
    70       this.groupBoxDetails.Location = new System.Drawing.Point(360, 12);
     87      this.groupBoxDetails.Location = new System.Drawing.Point(3, 3);
    7188      this.groupBoxDetails.Name = "groupBoxDetails";
    72       this.groupBoxDetails.Size = new System.Drawing.Size(562, 669);
     89      this.groupBoxDetails.Size = new System.Drawing.Size(422, 561);
    7390      this.groupBoxDetails.TabIndex = 4;
    7491      this.groupBoxDetails.TabStop = false;
     
    83100      this.panel.Location = new System.Drawing.Point(7, 20);
    84101      this.panel.Name = "panel";
    85       this.panel.Size = new System.Drawing.Size(549, 643);
     102      this.panel.Size = new System.Drawing.Size(409, 535);
    86103      this.panel.TabIndex = 0;
    87104      //
     
    89106      //
    90107      this.jsonItemBindingSource.DataSource = typeof(HeuristicLab.JsonInterface.IJsonItem);
     108      //
     109      // resultItems
     110      //
     111      this.resultItems.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
     112            | System.Windows.Forms.AnchorStyles.Left)
     113            | System.Windows.Forms.AnchorStyles.Right)));
     114      this.resultItems.FormattingEnabled = true;
     115      this.resultItems.Location = new System.Drawing.Point(6, 19);
     116      this.resultItems.Name = "resultItems";
     117      this.resultItems.Size = new System.Drawing.Size(353, 199);
     118      this.resultItems.TabIndex = 5;
     119      //
     120      // groupBox2
     121      //
     122      this.groupBox2.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
     123            | System.Windows.Forms.AnchorStyles.Left)
     124            | System.Windows.Forms.AnchorStyles.Right)));
     125      this.groupBox2.Controls.Add(this.treeView);
     126      this.groupBox2.Location = new System.Drawing.Point(3, 3);
     127      this.groupBox2.Name = "groupBox2";
     128      this.groupBox2.Size = new System.Drawing.Size(365, 352);
     129      this.groupBox2.TabIndex = 6;
     130      this.groupBox2.TabStop = false;
     131      this.groupBox2.Text = "Elements";
     132      //
     133      // groupBox3
     134      //
     135      this.groupBox3.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
     136            | System.Windows.Forms.AnchorStyles.Left)
     137            | System.Windows.Forms.AnchorStyles.Right)));
     138      this.groupBox3.Controls.Add(this.resultItems);
     139      this.groupBox3.Location = new System.Drawing.Point(3, 3);
     140      this.groupBox3.Name = "groupBox3";
     141      this.groupBox3.Size = new System.Drawing.Size(365, 231);
     142      this.groupBox3.TabIndex = 7;
     143      this.groupBox3.TabStop = false;
     144      this.groupBox3.Text = "Result Elements";
     145      //
     146      // splitContainer1
     147      //
     148      this.splitContainer1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
     149            | System.Windows.Forms.AnchorStyles.Left)
     150            | System.Windows.Forms.AnchorStyles.Right)));
     151      this.splitContainer1.Location = new System.Drawing.Point(3, 3);
     152      this.splitContainer1.Name = "splitContainer1";
     153      this.splitContainer1.Orientation = System.Windows.Forms.Orientation.Horizontal;
     154      //
     155      // splitContainer1.Panel1
     156      //
     157      this.splitContainer1.Panel1.Controls.Add(this.groupBox2);
     158      //
     159      // splitContainer1.Panel2
     160      //
     161      this.splitContainer1.Panel2.Controls.Add(this.groupBox3);
     162      this.splitContainer1.Size = new System.Drawing.Size(371, 599);
     163      this.splitContainer1.SplitterDistance = 358;
     164      this.splitContainer1.TabIndex = 8;
     165      //
     166      // splitContainer2
     167      //
     168      this.splitContainer2.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
     169            | System.Windows.Forms.AnchorStyles.Left)
     170            | System.Windows.Forms.AnchorStyles.Right)));
     171      this.splitContainer2.Location = new System.Drawing.Point(12, 12);
     172      this.splitContainer2.Name = "splitContainer2";
     173      //
     174      // splitContainer2.Panel1
     175      //
     176      this.splitContainer2.Panel1.Controls.Add(this.splitContainer1);
     177      //
     178      // splitContainer2.Panel2
     179      //
     180      this.splitContainer2.Panel2.Controls.Add(this.groupBoxDetails);
     181      this.splitContainer2.Panel2.Controls.Add(this.exportButton);
     182      this.splitContainer2.Size = new System.Drawing.Size(809, 605);
     183      this.splitContainer2.SplitterDistance = 377;
     184      this.splitContainer2.TabIndex = 9;
    91185      //
    92186      // ExportJsonDialog
     
    94188      this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
    95189      this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
    96       this.ClientSize = new System.Drawing.Size(934, 733);
    97       this.Controls.Add(this.groupBoxDetails);
    98       this.Controls.Add(this.treeView);
    99       this.Controls.Add(this.exportButton);
     190      this.ClientSize = new System.Drawing.Size(833, 629);
     191      this.Controls.Add(this.splitContainer2);
    100192      this.Name = "ExportJsonDialog";
    101193      this.RightToLeft = System.Windows.Forms.RightToLeft.No;
     
    104196      this.groupBoxDetails.ResumeLayout(false);
    105197      ((System.ComponentModel.ISupportInitialize)(this.jsonItemBindingSource)).EndInit();
     198      this.groupBox2.ResumeLayout(false);
     199      this.groupBox3.ResumeLayout(false);
     200      this.splitContainer1.Panel1.ResumeLayout(false);
     201      this.splitContainer1.Panel2.ResumeLayout(false);
     202      ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit();
     203      this.splitContainer1.ResumeLayout(false);
     204      this.splitContainer2.Panel1.ResumeLayout(false);
     205      this.splitContainer2.Panel2.ResumeLayout(false);
     206      ((System.ComponentModel.ISupportInitialize)(this.splitContainer2)).EndInit();
     207      this.splitContainer2.ResumeLayout(false);
    106208      this.ResumeLayout(false);
    107209
     
    117219    private System.Windows.Forms.GroupBox groupBoxDetails;
    118220    private System.Windows.Forms.Panel panel;
     221    private System.Windows.Forms.CheckedListBox resultItems;
     222    private System.Windows.Forms.GroupBox groupBox2;
     223    private System.Windows.Forms.GroupBox groupBox3;
     224    private System.Windows.Forms.SplitContainer splitContainer1;
     225    private System.Windows.Forms.SplitContainer splitContainer2;
    119226  }
    120227}
  • branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface.OptimizerIntegration/Views/ExportJsonDialog.cs

    r17432 r17435  
    2222    private IList<JsonItemVMBase> VMs { get; set; }
    2323    private JCGenerator Generator { get; set; } = new JCGenerator();
     24    private IDictionary<string, IJsonItem> ResultItems = new Dictionary<string, IJsonItem>();
    2425
    2526    private IContent content;
     
    3132        VMs = new List<JsonItemVMBase>();
    3233        treeView.Nodes.Clear();
     34        ResultItems.Clear();
    3335       
    3436        Optimizer = content as IOptimizer;
    3537        Root = JsonItemConverter.Extract(Optimizer);
    3638        TreeNode parent = new TreeNode(Root.Name);
    37      
     39
    3840        BuildTreeNode(parent, Root);
    3941        treeView.Nodes.Add(parent);
     
    6365          x.Item.Parent.Children.Remove(x.Item);
    6466        }
     67      }
     68
     69      foreach(var x in ResultItems.Values) {
     70        x.Parent.Children.Remove(x);
     71      }
     72
     73      foreach(var x in resultItems.CheckedItems) {
     74        if(ResultItems.TryGetValue((string)x, out IJsonItem item)) {
     75          Root.AddChildren(item);
     76        }
     77      }
     78
     79      IList<IJsonItem> faultyItems = new List<IJsonItem>();
     80      if(!Root.GetValidator().Validate(ref faultyItems)) {
     81        //print faultyItems
    6582      }
    6683
     
    95112            if (IsDrawableItem(c)) {
    96113              if (c is ResultItem) {
    97 
     114                resultItems.Items.Add(c.Name, true);
     115                ResultItems.Add(c.Name, c);
    98116              } else {
    99117                TreeNode childNode = new TreeNode(c.Name);
  • branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface/Constants.cs

    r17405 r17435  
    1212
    1313    internal const string Metadata = "Metadata";
    14     internal const string Optimizer = "Optimizer";
    15     internal const string Problem = "Problem";
     14    internal const string TemplateName = "TemplateName";
    1615    internal const string HLFileLocation = "HLFileLocation";
    1716    internal const string Parameters = "Parameters";
     
    2019    internal const string Template = @"{
    2120      '" + Metadata + @"': {
    22         '" + Optimizer + @"':'',
    23         '" + Problem + @"':'',
     21        '" + TemplateName + @"':'',
    2422        '" + HLFileLocation + @"':''
    2523      },
  • branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface/Converters/AlgorithmConverter.cs

    r17433 r17435  
    77using HeuristicLab.Optimization;
    88
    9 namespace HeuristicLab.JsonInterface.Converters {
     9namespace HeuristicLab.JsonInterface {
    1010  public class AlgorithmConverter : ParameterizedItemConverter {
    1111    public override int Priority => 30;
     
    2727        item.AddChildren(new ResultItem() {
    2828          Name = res.Name,
    29           Description = value.ItemDescription,
     29          Description = res.Description,
    3030          Value = true,
    3131          Range = new object[] { true, false }
  • branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface/JCGenerator.cs

    r17410 r17435  
    99using Newtonsoft.Json.Linq;
    1010using HEAL.Attic;
     11using System.IO;
    1112
    1213namespace HeuristicLab.JsonInterface {
     
    1516  /// </summary>
    1617  public class JCGenerator {
    17     private JObject Template { get; set; } = JObject.Parse(Constants.Template);
    18     private JArray JArrayItems { get; set; }
    19     private IList<IJsonItem> JsonItems { get; set; }
    20     private IOptimizer Optimizer { get; set; }
    2118
    22    
    23     public string GenerateTemplate(IOptimizer optimizer) {
    24       // data container
    25       JArrayItems = new JArray();
    26       JArray ResultItems = new JArray();
    27       JsonItems = new List<IJsonItem>();
     19    public void GenerateTemplate(string path, IOptimizer optimizer) =>
     20      GenerateTemplate(path, optimizer.Name, optimizer);
    2821
     22    public void GenerateTemplate(string path, string templateName, IOptimizer optimizer) =>
     23      GenerateTemplate(path, templateName, optimizer, JsonItemConverter.Extract(optimizer));
     24
     25    public void GenerateTemplate(string path, string templateName, IOptimizer optimizer, IJsonItem rootItem) {
     26      // init
     27      JObject template = JObject.Parse(Constants.Template);
     28      JArray parameterItems = new JArray();
     29      JArray resultItems = new JArray();
     30      IList<IJsonItem> jsonItems = new List<IJsonItem>();
     31      string fullPath = Path.GetDirectoryName(Path.GetFullPath(path));
     32     
     33      // recursively filter items with values/ranges/actualNames
     34      PopulateJsonItems(rootItem, jsonItems);
     35
     36      // serialize hl file
    2937      ProtoBufSerializer serializer = new ProtoBufSerializer();
    30       serializer.Serialize(optimizer, @"C:\Workspace\template.hl");
    31       Template[Constants.Metadata][Constants.HLFileLocation] = @"C:\Workspace\template.hl";
     38      string hlFilePath = fullPath + @"\" + templateName + ".hl";
     39      serializer.Serialize(optimizer, hlFilePath);
    3240
    33       // extract JsonItem, save the name in the metadata section of the
    34       // template and save it an JArray incl. all parameters of the JsonItem,
    35       // which have parameters aswell
    36       AddIItem(optimizer);
    37       // save the JArray with JsonItems (= IParameterizedItems)
     41      // filter result items
     42      foreach (var item in jsonItems) {
     43        if (item is ResultItem)
     44          resultItems.Add(Serialize(item));
     45        else
     46          parameterItems.Add(Serialize(item));
     47      }
     48     
     49      // set template data
     50      template[Constants.Metadata][Constants.TemplateName] = templateName;
     51      template[Constants.Metadata][Constants.HLFileLocation] = hlFilePath;
     52      template[Constants.Parameters] = parameterItems;
     53      template[Constants.ActivatedResults] = resultItems;
    3854
    39       JArrayItems = new JArray();
    40       foreach (var item in JsonItems) {
    41         if (item is ResultItem)
    42           ResultItems.Add(Serialize(item));
    43         else
    44           JArrayItems.Add(Serialize(item));
    45       }
    46       Template[Constants.Parameters] = JArrayItems;
    47       Template[Constants.ActivatedResults] = ResultItems;
    48       // serialize template and return string
    49       return SingleLineArrayJsonWriter.Serialize(Template);
     55      // serialize template and write file
     56      File.WriteAllText(fullPath + @"\" + templateName + ".json", SingleLineArrayJsonWriter.Serialize(template));
    5057    }
    5158
    52     public string GenerateTemplate(IEnumerable<IJsonItem> items) {
    53       ProtoBufSerializer serializer = new ProtoBufSerializer();
    54       serializer.Serialize(Optimizer, @"C:\Workspace\template.hl");
    55       Template[Constants.Metadata][Constants.HLFileLocation] = @"C:\Workspace\template.hl";
    56 
    57       JArray ResultItems = new JArray();
    58 
    59       JArrayItems = new JArray();
    60       foreach (var item in items) {
    61         if (item is ResultItem)
    62           ResultItems.Add(Serialize(item));
    63         else
    64           JArrayItems.Add(Serialize(item));
    65       }
    66       Template[Constants.Parameters] = JArrayItems;
    67       Template[Constants.ActivatedResults] = ResultItems;
    68 
    69       // serialize template and return string
    70       return SingleLineArrayJsonWriter.Serialize(Template);
    71     }
    72 
    73     public string GenerateTemplate(IJsonItem rootItem, IOptimizer optimizer) {
    74       // data container
    75       Template = JObject.Parse(Constants.Template);
    76       JsonItems = new List<IJsonItem>();
    77 
    78       // extract JsonItem, save the name in the metadata section of the
    79       // template and save it an JArray incl. all parameters of the JsonItem,
    80       // which have parameters aswell
    81       Template[Constants.Metadata][Constants.Optimizer] = optimizer.Name;
    82       PopulateJsonItems(rootItem);
    83 
    84       ProtoBufSerializer serializer = new ProtoBufSerializer();
    85       serializer.Serialize(Optimizer, @"C:\Workspace\template.hl");
    86       Template[Constants.Metadata][Constants.HLFileLocation] = @"C:\Workspace\template.hl";
    87 
    88       JArray ResultItems = new JArray();
    89 
    90       JArrayItems = new JArray();
    91       foreach (var item in JsonItems) {
    92         if (item is ResultItem)
    93           ResultItems.Add(Serialize(item));
    94         else
    95           JArrayItems.Add(Serialize(item));
    96       }
    97       Template[Constants.Parameters] = JArrayItems;
    98       Template[Constants.ActivatedResults] = ResultItems;
    99 
    100       // serialize template and return string
    101       return SingleLineArrayJsonWriter.Serialize(Template);
    102     }
    103 
    104     public IEnumerable<IJsonItem> FetchJsonItems(IOptimizer optimizer) {
    105       // data container
    106       Template = JObject.Parse(Constants.Template);
    107       JsonItems = new List<IJsonItem>();
    108       Optimizer = optimizer;
    109 
    110       // extract JsonItem, save the name in the metadata section of the
    111       // template and save it an JArray incl. all parameters of the JsonItem,
    112       // which have parameters aswell
    113       AddIItem(optimizer);
    114 
    115       // serialize template and return string
    116       return JsonItems;
    117     }
    118    
    119     #region Helper
    120 
    121     private void AddIItem(IItem item) {
    122       IJsonItem jsonItem = JsonItemConverter.Extract(item);
    123       Template[Constants.Metadata][Constants.Optimizer] = item.ItemName;
    124       PopulateJsonItems(jsonItem);
    125     }
    126 
     59    #region Helper   
    12760    // serializes ParameterizedItems and saves them in list "JsonItems".
    128     private void PopulateJsonItems(IJsonItem item) {
     61    private void PopulateJsonItems(IJsonItem item, IList<IJsonItem> jsonItems) {
    12962      IEnumerable<IJsonItem> tmpParameter = item.Children;
    13063     
    13164      if (item.Value != null || item.Range != null || item is ResultItem || item.ActualName != null) {
    132         JsonItems.Add(item);
     65        jsonItems.Add(item);
    13366      }
    13467
    13568      if (tmpParameter != null) {
    13669        foreach (var p in tmpParameter) {
    137           PopulateJsonItems(p);
     70          PopulateJsonItems(p, jsonItems);
    13871        }
    13972      }
  • branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface/JsonTemplateInstantiator.cs

    r17417 r17435  
    4242
    4343      // extract metadata information
    44       string optimizerName = instData.Template[Constants.Metadata][Constants.Optimizer].ToString();
    45       string hLFileLocation = instData.Template[Constants.Metadata][Constants.HLFileLocation].ToString();
     44      string optimizerName = instData.Template[Constants.Metadata][Constants.TemplateName].ToString();
     45      string hLFileLocation = Path.GetFullPath(instData.Template[Constants.Metadata][Constants.HLFileLocation].ToString());
    4646
    4747      // deserialize hl file
     
    7272
    7373    private static void CollectParameterizedItems(InstData instData) {
    74       //JCGenerator generator = new JCGenerator();
    75       //IEnumerable<IJsonItem> items = generator.FetchJsonItems(instData.Optimizer);
    7674      IJsonItem root = JsonItemConverter.Extract(instData.Optimizer);
    7775      instData.Objects.Add(root.Path, root);
     
    9593        instData.Objects.Add(tmp.Path, tmp);
    9694      }
    97 
    98 
    99       /*
    100       foreach (JObject item in instData.Template[Constants.Parameters]) {
    101         string[] pathParts = item.Property("Path").Value.ToString().Split('.');
    102        
    103         // rebuilds object tree
    104         IJsonItem parent = null;
    105         StringBuilder partialPath = new StringBuilder();
    106         for(int i = 0; i < pathParts.Length-1; ++i) {
    107           partialPath.Append(pathParts[i]);
    108           IJsonItem tmp = null;
    109           if (instData.Objects.TryGetValue(partialPath.ToString(), out IJsonItem value)) {
    110             tmp = value;
    111           } else {
    112             tmp = new JsonItem() { Name = pathParts[i] };
    113             if (parent != null) parent.AddChilds(tmp);
    114             instData.Objects.Add(partialPath.ToString(), tmp);
    115           }
    116           partialPath.Append(".");
    117           parent = tmp;
    118         }
    119 
    120         IJsonItem data = JsonItem.BuildJsonItem(item);
    121         parent.AddChilds(data);
    122         instData.Objects.Add(data.Path, data);
    123       }*/
    12495    }
    12596   
     
    12798      foreach (JObject obj in instData.Config) {
    12899        // build item from config object
    129         //IJsonItem item = JsonItem.BuildJsonItem(obj);
    130100        string path = obj.Property("Path").Value.ToString();
    131101        // override default value
     
    138108      }
    139109    }
    140 
    141     private static IJsonItem GetData(string key, InstData instData)
    142     {
    143       if (instData.Objects.TryGetValue(key, out IJsonItem value))
    144         return value;
    145       else
    146         throw new InvalidDataException($"Type of item '{key}' is not defined!");
    147     }
    148110    #endregion
    149111  }
  • branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface/Models/JsonItem.cs

    r17433 r17435  
    3434        if (!res) faultyItems.Add(item);
    3535        Cache.Add(hash, res);
    36         foreach (var child in item.Children)
    37           res = res && ValidateHelper(child as JsonItem, ref faultyItems);
     36        if(item.Children != null)
     37          foreach (var child in item.Children)
     38            res = res && ValidateHelper(child as JsonItem, ref faultyItems);
    3839        return res;
    3940      }
Note: See TracChangeset for help on using the changeset viewer.