Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
02/11/20 17:35:28 (4 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)
File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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  }
Note: See TracChangeset for help on using the changeset viewer.