Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
08/04/21 17:19:05 (3 years ago)
Author:
dpiringe
Message:

#3026

  • added some test cases for JsonInterface
  • deleted the HeuristicLab namespace part in a lot of test classes (this caused a lot of compile errors)
  • enhanced the OS path logic for absolute and relative path in JsonTemplateGenerator and JsonTemplateInstantiator
  • fixed a bug in ValueParameterConverter -> the injection logic was not working correctly
  • changed the folder determination in Main.cs for the HeadlessRun method
  • added a new abstract type of JsonItem IntervalRestrictedJsonItem for JsonItems with a need of Minimum and Maximum bounds but without a specific value
    • changed in RangedJsonItem the base class from IntervalRestrictedValueJsonItem to IntervalRestrictedJsonItem
Location:
branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface
Files:
1 added
6 edited

Legend:

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

    r17843 r18040  
    1616      IParameter parameter = value as IParameter;
    1717
    18       if (parameter.ActualValue == null)
    19         parameter.ActualValue = Instantiate(parameter.DataType);
    20 
    21       if(parameter.ActualValue != null) {
    22           if (data.Children == null || data.Children.Count() == 0)
    23             root.Inject(parameter.ActualValue, data, root);
    24           else
    25             root.Inject(parameter.ActualValue, data, root);
    26          
     18      if (!(data is EmptyJsonItem)) {
     19        if (parameter.ActualValue == null)
     20          parameter.ActualValue = Instantiate(parameter.DataType);
     21        root.Inject(parameter.ActualValue, data, root);
    2722      }
    2823    }
  • branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface/HeuristicLab.JsonInterface.csproj

    r17924 r18040  
    9090    <Compile Include="JsonItems\EmptyJsonItem.cs" />
    9191    <Compile Include="JsonItems\IntervalRestrictedArrayJsonItem.cs" />
     92    <Compile Include="JsonItems\IntervalRestrictedJsonItem.cs" />
    9293    <Compile Include="JsonItems\IntervalRestrictedMatrixJsonItem.cs" />
    9394    <Compile Include="JsonItems\IntervalRestrictedValueJsonItem.cs" />
  • branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface/JsonItems/IntervalRestrictedValueJsonItem.cs

    r17828 r18040  
    33
    44namespace HeuristicLab.JsonInterface {
    5   public abstract class IntervalRestrictedValueJsonItem<T> : ValueJsonItem<T>, IIntervalRestrictedJsonItem<T>
     5  public abstract class IntervalRestrictedValueJsonItem<T> : ValueJsonItem<T>, IIntervalRestrictedJsonItem<T> // TODO: intervalrestriction before value?
    66    where T : IComparable {
    77    public T Minimum { get; set; }
  • branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface/JsonItems/RangedJsonItem.cs

    r18031 r18040  
    44
    55namespace HeuristicLab.JsonInterface {
    6   public abstract class RangedJsonItem<T> : IntervalRestrictedValueJsonItem<T>, IRangedJsonItem<T>
     6  public abstract class RangedJsonItem<T> : IntervalRestrictedJsonItem<T>, IRangedJsonItem<T>
    77    where T : IComparable {
    88    public T MinValue { get; set; }
     9   
    910    public T MaxValue { get; set; }
    1011
  • branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface/JsonTemplateGenerator.cs

    r18030 r18040  
    5050      serializer.Serialize(optimizer, hlFilePath);
    5151      // overwrite string for relative path
    52       hlFilePath = Path.Combine($".{Path.DirectorySeparatorChar}", $"{templateName}.hl");
     52      hlFilePath = Path.Combine($".", $"{templateName}.hl");
    5353      #endregion
    5454
  • branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface/JsonTemplateInstantiator.cs

    r18039 r18040  
    5050
    5151      #region Parse Files
     52      string templateFileFullPath = Path.GetFullPath(templateFile);
    5253      Template = JToken.Parse(File.ReadAllText(templateFile));
    5354      if(!string.IsNullOrEmpty(configFile))
    54         Config = JArray.Parse(File.ReadAllText(configFile));
     55        Config = JArray.Parse(File.ReadAllText(Path.GetFullPath(configFile)));
    5556      #endregion
    5657
     
    6162        relativePath = relativePath.Remove(0, 2); // remove first 2 chars -> indicates the current directory
    6263
    63       string hLFileLocation = $"{Path.GetDirectoryName(templateFile)}{Path.DirectorySeparatorChar}{relativePath}";
    64 
     64      string hLFileLocation = Path.Combine(Path.GetDirectoryName(templateFileFullPath), relativePath);
    6565      #region Deserialize HL File
    6666      ProtoBufSerializer serializer = new ProtoBufSerializer();
Note: See TracChangeset for help on using the changeset viewer.