Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
03/17/20 12:33:35 (4 years ago)
Author:
dpiringe
Message:

#3026:

  • refactored JsonTemplateInstantiator -> now returns a InstantiatorResult which contains the optimizer and an IEnumerable of IResultJsonItem
  • code cleanup in JCGenerator
  • relocated the serialization of json items into IJsonItem with method GenerateJObject (virtual base implementation in JsonItem)
    • this allows custom serialization for json items (example: ValueLookupJsonItem)
    • items of interface IIntervalRestrictedJsonItem have a custom implementation of GenerateJObject -> hides Minimum and Maximum if the values are the physically min/max of their type
  • code cleanup in BaseConverter
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/3026_IntegrationIntoSymSpace/Heuristiclab.ConfigStarter/Program.cs

    r17473 r17477  
    4747      IJsonItem root = JsonItemConverter.Extract(alg);
    4848      ActivateJsonItems(root);
    49       //var x = root.Children[0];
    50       //root.Children.Remove(x);
    51       //x.Parent = null;
    5249
    53 
    54       JCGenerator generator = new JCGenerator();
    55       generator.GenerateTemplate(@"C:\Workspace", "Template", alg, root);
    56       //JsonTemplateInstantiator.Instantiate(@"C:\Workspace\Template.json");
     50      JCGenerator.GenerateTemplate(@"C:\Workspace", "Template", alg, root);
    5751     
    5852      List<ICommandLineArgument> arguments = new List<ICommandLineArgument>();
    5953      arguments.Add(new StartArgument("JsonInterface"));
    6054      arguments.Add(new OpenArgument(@"C:\Workspace\Template.json"));
    61       arguments.Add(new OpenArgument(@"C:\Workspace\ConfigProto1.json"));
     55      arguments.Add(new OpenArgument(@"C:\Workspace\Config.json"));
    6256      arguments.Add(new StringArgument(@"C:\Workspace\Output.json"));
    6357
     
    6761
    6862    private static void ActivateJsonItems(IJsonItem item) {
    69       item.Active = true;
    70       if(item.Children != null) {
    71         foreach (var x in item.Children)
    72           ActivateJsonItems(x);
     63      foreach (var x in item) {
     64        x.Active = true;
     65        if (x is ValueLookupJsonItem i) {
     66          i.Active = true;
     67        }
    7368      }
    7469    }
Note: See TracChangeset for help on using the changeset viewer.