Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
10/01/19 12:58:25 (5 years ago)
Author:
dpiringe
Message:

#3026

  • renamed CustomWriter to CustomJsonWriter and extracted it into a separate file
  • removed property ParameterizedItems from Component
  • added helper methods for path generation in Component
  • reverted the single parameter array idea back to the FreeParameters and StaticParameters idea
  • now there hidden parameters are also handled
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/3026_IntegrationIntoSymSpace/HeuristicLab.Manufacture/Component.cs

    r17275 r17280  
    99
    1010namespace HeuristicLab.Manufacture {
     11  //JsonItem
    1112  public class Component {
    1213    private IList<object> range;
     
    2324      }
    2425    }
    25     public string Path { get; set; }
     26    public string Path { get; set; } = "";
    2627
    2728    public IList<object> Range {
     
    4344
    4445    [JsonIgnore]
    45     public IList<Component> ParameterizedItems { get; set; }
    46 
    47     [JsonIgnore]
    4846    public Component Reference { get; set; }
    4947   
     
    5654      target.Reference = from.Reference ?? target.Reference;
    5755      target.Parameters = from.Parameters ?? target.Parameters;
    58       target.ParameterizedItems = from.ParameterizedItems ?? target.ParameterizedItems;
    5956      target.Operators = from.Operators ?? target.Operators;
    6057    }
     
    7269      IsInNumericRange<double>(data.Default, data.Range[0], data.Range[1]));
    7370
     71
     72
     73    public void UpdatePaths() {
     74      if (Parameters != null) {
     75        foreach (var p in Parameters) {
     76          p.Path = Path + "." + p.Name;
     77        }
     78      }
     79
     80      if (Operators != null) {
     81        foreach (var p in Operators) {
     82          p.Path = Path + "." + p.Name;
     83        }
     84      }
     85    }
     86
     87    public void PrependPath(string str) {
     88      Path = $"{str}.{Path}";
     89      PrependPathHelper(Parameters, str);
     90      PrependPathHelper(Operators, str);
     91    }
     92
     93    private void PrependPathHelper(IEnumerable<Component> components, string str) {
     94      if (components != null) {
     95        foreach (var p in components)
     96          p.PrependPath(str);
     97      }
     98    }
     99
    74100    #region Helper
    75 
    76101    private static bool IsInRangeList(IEnumerable<object> list, object value) {
    77102      foreach (var x in list)
Note: See TracChangeset for help on using the changeset viewer.