Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
02/20/20 16:58:03 (4 years ago)
Author:
dpiringe
Message:

#3026:

  • made interfaces for array/matrix JsonItems and for their VMs aswell (IArrayJsonItem, IArrayJsonItemVM, IMatrixJsonItem, IMatrixJsonItemVM), incl. base classes (ArrayJsonItemBase, ArrayValueVM, MatrixJsonItemBase, MatrixValueVM)
  • changed inheritance structure for already existing array/matrix JsonItems -> they inherit now from new base array/matrix base classes
  • added input elements to configure the size of an matrix or array in JsonItemMultiValueControl (incl. VM binding and validation)
  • splitted file JsonItems.cs into separate files for their corresponding types (IntJsonItems.cs, DoubleJsonItems.cs, BoolJsonItems.cs, StringJsonItem.cs, DateTimeJsonItem.cs)
  • changed location of deserialization of json values from JsonTemplateInstantiator into IJsonItem (implemented in JsonItem and set to virtual, overridden in MatrixJsonItemBase and ArrayJsonItemBase)
  • added new CLI argument StringArgument
  • some little UI improvements (location fixes, anchor fixes, ...)
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface/JsonTemplateInstantiator.cs

    r17442 r17446  
    5151
    5252      // extract metadata information
    53       string optimizerName = instData.Template[Constants.Metadata][Constants.TemplateName].ToString();
    5453      string hLFileLocation = Path.GetFullPath(instData.Template[Constants.Metadata][Constants.HLFileLocation].ToString());
    5554
     
    7877
    7978    #region Helper
    80 
    81     private static object GetValueFromJObject(JObject obj) =>
    82       obj[nameof(IJsonItem.Value)]?.ToObject<object>();
    83 
    8479    private static IEnumerable<string> CollectResults(InstData instData) {
    8580      IList<string> res = new List<string>();
     
    107102          else old = tmp;
    108103        }
    109         tmp.Value = GetValueFromJObject(obj);
    110         tmp.Range = obj[nameof(IJsonItem.Range)]?.ToObject<object[]>();
    111         tmp.ActualName = obj[nameof(IJsonItem.ActualName)]?.ToString();
     104        tmp.SetFromJObject(obj);
    112105        instData.Objects.Add(tmp.Path, tmp);
    113106      }
     
    120113        // override default value
    121114        if (instData.Objects.TryGetValue(path, out IJsonItem param)) {
    122           param.Value = GetValueFromJObject(obj);
    123           // override ActualName (for LookupParameters)
    124           if (param.ActualName != null)
    125             param.ActualName = obj[nameof(IJsonItem.ActualName)]?.ToString();
     115          // save range from template
     116          IEnumerable<object> tmpRange = param.Range;
     117          param.SetFromJObject(obj);
     118          // set range from template
     119          param.Range = tmpRange;
    126120        } else throw new InvalidDataException($"No parameter with path='{path}' defined!");
    127121      }
Note: See TracChangeset for help on using the changeset viewer.