Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
04/10/20 14:04:59 (5 years ago)
Author:
mkommend
Message:

#2971: Further minor refactorings and renaming of members.

Location:
branches/2971_named_intervals/HeuristicLab.Problems.DataAnalysis/3.4/Implementation
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/2971_named_intervals/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Interval/IntervalCollection.cs

    r17145 r17506  
    3333      get => HeuristicLab.Common.Resources.VSImageLibrary.Object;
    3434    }
    35     private IDictionary<string, Interval> VariableIntervals { get; } = new Dictionary<string, Interval>();
     35    private IDictionary<string, Interval> intervals { get; } = new Dictionary<string, Interval>();
    3636
    3737    [Storable(Name = "StorableIntervalInformation")]
     
    3939      get {
    4040        var l = new List<KeyValuePair<string, double[]>>();
    41         foreach (var varInt in VariableIntervals)
     41        foreach (var varInt in intervals)
    4242
    4343          l.Add(new KeyValuePair<string, double[]>(varInt.Key,
     
    4848      set {
    4949        foreach (var varInt in value)
    50           VariableIntervals.Add(varInt.Key, new Interval(varInt.Value[0], varInt.Value[1]));
     50          intervals.Add(varInt.Key, new Interval(varInt.Value[0], varInt.Value[1]));
    5151      }
    5252    }
     
    5757
    5858    protected IntervalCollection(IntervalCollection original, Cloner cloner) : base(original, cloner) {
    59       foreach (var keyValuePair in original.VariableIntervals) {
    60         VariableIntervals.Add(keyValuePair.Key, new Interval(keyValuePair.Value.LowerBound, keyValuePair.Value.UpperBound));
     59      foreach (var keyValuePair in original.intervals) {
     60        intervals.Add(keyValuePair.Key, new Interval(keyValuePair.Value.LowerBound, keyValuePair.Value.UpperBound));
    6161      }
    6262    }
     
    6565    }
    6666
    67     public IntervalCollection(IDictionary<string, Interval> variableIntervals) {
    68       this.VariableIntervals = variableIntervals;
     67    public IntervalCollection(IDictionary<string, Interval> intervals) {
     68      this.intervals = intervals;
    6969    }
    7070
    71     public Interval GetInterval(string variable) {
    72       if (!VariableIntervals.ContainsKey(variable)) throw new ArgumentException($"The given variable:{ variable } is not present!");
     71    public Interval GetInterval(string identifier) {
     72      if (!intervals.ContainsKey(identifier)) throw new ArgumentException($"The given identifier:{ identifier } is not present!");
    7373
    74       return VariableIntervals[variable];
     74      return intervals[identifier];
    7575    }
    7676
    77     public void SetInterval(string key, Interval interval) {
    78       VariableIntervals[key] = interval;
     77    public void SetInterval(string identifier, Interval interval) {
     78      intervals[identifier] = interval;
    7979    }
    8080
    81     public void AddInterval(string key, Interval interval) {
    82       VariableIntervals.Add(key, interval);
     81    public void AddInterval(string identifier, Interval interval) {
     82      intervals.Add(identifier, interval);
    8383    }
    8484
    85     public void DeleteInterval(string key) {
    86       VariableIntervals.Remove(key);
     85    public void DeleteInterval(string identifier) {
     86      intervals.Remove(identifier);
    8787    }
    8888
    8989    public IDictionary<string, Interval> GetIntervals() {
    90       return VariableIntervals;
     90      return intervals;
    9191    }
    9292  }
  • branches/2971_named_intervals/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Interval/IntervalConstraint.cs

    r17370 r17506  
    2020#endregion
    2121using System;
     22using HEAL.Attic;
    2223using HeuristicLab.Common;
    2324using HeuristicLab.Core;
    24 using HEAL.Attic;
    2525
    2626namespace HeuristicLab.Problems.DataAnalysis {
     
    6060    public string Target {
    6161      get => target;
    62       set {
     62      private set {
    6363        if (target == value) return;
    6464        target = value;
     
    6868    }
    6969
    70     public bool IsDerivation {
    71       get => numberOfDerivation > 0;
     70    public bool IsDerivative {
     71      get => NumberOfDerivations > 0;
    7272    }
    7373
    7474    [Storable]
    75     private int numberOfDerivation;
    76     public int NumberOfDerivation {
    77       get => numberOfDerivation;
     75    private int numberOfDerivations;
     76    public int NumberOfDerivations {
     77      get => numberOfDerivations;
    7878      set {
    7979        if (value < 0 || value > 3) throw new ArgumentException("Number of derivation has to be between 0 - 3.");
    80         if (numberOfDerivation == value) return;
    81         numberOfDerivation = value;
     80        if (numberOfDerivations == value) return;
     81        numberOfDerivations = value;
    8282        UpdateExpression();
    8383        OnChanged();
     
    111111    private IntervalConstraint(StorableConstructorFlag _) : base(_) { }
    112112
    113     public IntervalConstraint(string expression, string variable, string target, int numberOfDerivation, Interval interval, bool enabled) : base(){
     113    public IntervalConstraint(string expression, string variable, string target, int numberOfDerivations, Interval interval, bool enabled) : base(){
    114114      this.expression = expression;
    115115      this.variable = variable;
    116116      this.target = target;
    117       this.numberOfDerivation = numberOfDerivation;
     117      this.numberOfDerivations = numberOfDerivations;
    118118      this.interval = interval;
    119119      this.enabled = enabled;
     
    129129      this.Variable = original.Variable;
    130130      this.Target = original.Target;
    131       this.NumberOfDerivation = original.NumberOfDerivation;
     131      this.NumberOfDerivations = original.NumberOfDerivations;
    132132      this.Interval = original.Interval;
    133133      this.Enabled = original.Enabled;
     
    157157      var expression = "";
    158158
    159       if (!IsDerivation) {
     159      if (!IsDerivative) {
    160160        expression = string.Format("Target:{0} in {1}{2} .. {3}{4}",
    161161          Variable,
     
    174174        Interval?.UpperBound,
    175175        "]",
    176         GetDerivationString(numberOfDerivation));
     176        GetDerivationString(numberOfDerivations));
    177177        Expression = expression;
    178178    }
    179179
    180180    private string GetDefinitionString() {
    181       if (!IsDerivation) {
     181      if (!IsDerivative) {
    182182        return "Target " + Variable;
    183183      }
    184       var definition = $"∂{GetDerivationString(numberOfDerivation)}Target/∂{Variable}{GetDerivationString(numberOfDerivation)}";
     184      var definition = $"∂{GetDerivationString(numberOfDerivations)}Target/∂{Variable}{GetDerivationString(numberOfDerivations)}";
    185185      return definition;
    186186    }
  • branches/2971_named_intervals/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Regression/RegressionProblemData.cs

    r17210 r17506  
    2323using System.Collections.Generic;
    2424using System.Linq;
     25using HEAL.Attic;
    2526using HeuristicLab.Common;
    2627using HeuristicLab.Core;
    2728using HeuristicLab.Data;
    2829using HeuristicLab.Parameters;
    29 using HEAL.Attic;
    3030
    3131namespace HeuristicLab.Problems.DataAnalysis {
     
    9494      problemData.Parameters.Add(new ConstrainedValueParameter<StringValue>(TargetVariableParameterName, new ItemSet<StringValue>()));
    9595      problemData.Parameters.Add(new FixedValueParameter<IntervalCollection>(VariableRangesParameterName, "", new IntervalCollection()));
    96       problemData.Parameters.Add(new FixedValueParameter<ProblemDataConstraint>(IntervalConstraintsParameterName, "", new ProblemDataConstraint()));
     96      problemData.Parameters.Add(new FixedValueParameter<ProblemDataConstraint>(IntervalConstraintsParameterName, "", new ProblemDataConstraint(problemData)));
    9797      emptyProblemData = problemData;
    9898    }
Note: See TracChangeset for help on using the changeset viewer.