Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
10/29/12 14:30:35 (11 years ago)
Author:
sforsten
Message:

#1865: An additional property has been added, which contains all possible variable names. The old property "VariableNames" contains the variable names which can be used with a certain symbol (which are checked in the view).
The "AfterDeserialization" method makes sure that the new property is set.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/Variable.cs

    r8798 r8853  
    101101    }
    102102
     103    private List<string> allVariableNames;
     104    [Storable]
     105    public IEnumerable<string> AllVariableNames {
     106      get { return allVariableNames; }
     107      set {
     108        if (value == null) throw new ArgumentNullException();
     109        allVariableNames.Clear();
     110        allVariableNames.AddRange(value);
     111        VariableNames = value;
     112      }
     113    }
     114
    103115    public override bool Enabled {
    104116      get {
     
    123135    #endregion
    124136
     137    [StorableHook(HookType.AfterDeserialization)]
     138    private void AfterDeserialization() {
     139      if (allVariableNames == null || (allVariableNames.Count == 0 && variableNames.Count > 0)) {
     140        allVariableNames = variableNames;
     141      }
     142    }
     143
    125144    [StorableConstructor]
    126145    protected Variable(bool deserializing)
    127146      : base(deserializing) {
    128147      variableNames = new List<string>();
     148      allVariableNames = new List<string>();
    129149    }
    130150    protected Variable(Variable original, Cloner cloner)
     
    133153      weightSigma = original.weightSigma;
    134154      variableNames = new List<string>(original.variableNames);
     155      allVariableNames = new List<string>(original.allVariableNames);
    135156      weightManipulatorMu = original.weightManipulatorMu;
    136157      weightManipulatorSigma = original.weightManipulatorSigma;
     
    146167      multiplicativeWeightManipulatorSigma = 0.03;
    147168      variableNames = new List<string>();
     169      allVariableNames = new List<string>();
    148170    }
    149171
Note: See TracChangeset for help on using the changeset viewer.