Changeset 8853
- Timestamp:
- 10/29/12 14:30:35 (12 years ago)
- Location:
- trunk/sources
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/Symbols/VariableConditionView.cs
r8103 r8853 124 124 RegisterVariableNamesViewContentEvents(); 125 125 } else { 126 var existingEntries = variableNamesView.Content.ToList();127 128 126 // temporarily deregister to prevent circular calling of events 129 127 DeregisterVariableNamesViewContentEvents(); 130 // add additional entries 131 foreach (var variableName in Content.VariableNames.Except(existingEntries.Select(x => x.Value))) 132 variableNamesView.Content.Add(new StringValue(variableName), true); 133 foreach (var oldEntry in existingEntries.Where(x => !Content.VariableNames.Contains(x.Value))) 134 variableNamesView.Content.Remove(oldEntry); 128 variableNamesView.Content.Clear(); 129 foreach (var variableName in Content.AllVariableNames) { 130 variableNamesView.Content.Add(new StringValue(variableName), Content.VariableNames.Contains(variableName)); 131 } 135 132 RegisterVariableNamesViewContentEvents(); 136 133 -
trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/Symbols/VariableView.cs
r8476 r8853 181 181 RegisterVariableNamesViewContentEvents(); 182 182 } else { 183 var existingEntries = variableNamesView.Content.ToList();184 185 183 // temporarily deregister to prevent circular calling of events 186 184 DeregisterVariableNamesViewContentEvents(); 187 // add additional entries 188 foreach (var variableName in Content.VariableNames.Except(existingEntries.Select(x => x.Value))) 189 variableNamesView.Content.Add(new StringValue(variableName), true); 190 foreach (var oldEntry in existingEntries.Where(x => !Content.VariableNames.Contains(x.Value))) 191 variableNamesView.Content.Remove(oldEntry); 185 variableNamesView.Content.Clear(); 186 foreach (var variableName in Content.AllVariableNames) { 187 variableNamesView.Content.Add(new StringValue(variableName), Content.VariableNames.Contains(variableName)); 188 } 192 189 RegisterVariableNamesViewContentEvents(); 193 190 -
trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/SymbolicDataAnalysisProblem.cs
r8666 r8853 211 211 SymbolicExpressionTreeGrammar.MaximumFunctionDefinitions = MaximumFunctionDefinitions.Value; 212 212 foreach (var varSymbol in SymbolicExpressionTreeGrammar.Symbols.OfType<HeuristicLab.Problems.DataAnalysis.Symbolic.Variable>()) { 213 if (!varSymbol.Fixed) varSymbol. VariableNames = ProblemData.AllowedInputVariables;213 if (!varSymbol.Fixed) varSymbol.AllVariableNames = ProblemData.AllowedInputVariables; 214 214 } 215 215 foreach (var varSymbol in SymbolicExpressionTreeGrammar.Symbols.OfType<HeuristicLab.Problems.DataAnalysis.Symbolic.VariableCondition>()) { 216 if (!varSymbol.Fixed) varSymbol. VariableNames = ProblemData.AllowedInputVariables;216 if (!varSymbol.Fixed) varSymbol.AllVariableNames = ProblemData.AllowedInputVariables; 217 217 } 218 218 } -
trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/Variable.cs
r8798 r8853 101 101 } 102 102 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 103 115 public override bool Enabled { 104 116 get { … … 123 135 #endregion 124 136 137 [StorableHook(HookType.AfterDeserialization)] 138 private void AfterDeserialization() { 139 if (allVariableNames == null || (allVariableNames.Count == 0 && variableNames.Count > 0)) { 140 allVariableNames = variableNames; 141 } 142 } 143 125 144 [StorableConstructor] 126 145 protected Variable(bool deserializing) 127 146 : base(deserializing) { 128 147 variableNames = new List<string>(); 148 allVariableNames = new List<string>(); 129 149 } 130 150 protected Variable(Variable original, Cloner cloner) … … 133 153 weightSigma = original.weightSigma; 134 154 variableNames = new List<string>(original.variableNames); 155 allVariableNames = new List<string>(original.allVariableNames); 135 156 weightManipulatorMu = original.weightManipulatorMu; 136 157 weightManipulatorSigma = original.weightManipulatorSigma; … … 146 167 multiplicativeWeightManipulatorSigma = 0.03; 147 168 variableNames = new List<string>(); 169 allVariableNames = new List<string>(); 148 170 } 149 171 -
trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/VariableCondition.cs
r8099 r8853 91 91 } 92 92 93 private List<string> allVariableNames; 94 [Storable] 95 public IEnumerable<string> AllVariableNames { 96 get { return allVariableNames; } 97 set { 98 if (value == null) throw new ArgumentNullException(); 99 allVariableNames.Clear(); 100 allVariableNames.AddRange(value); 101 VariableNames = value; 102 } 103 } 104 93 105 [Storable] 94 106 private double slopeInitializerMu; … … 151 163 152 164 #region persistence and cloning 165 [StorableHook(HookType.AfterDeserialization)] 166 private void AfterDeserialization() { 167 if (allVariableNames == null || (allVariableNames.Count == 0 && variableNames.Count > 0)) { 168 allVariableNames = variableNames; 169 } 170 } 171 153 172 [StorableConstructor] 154 173 private VariableCondition(bool deserializing) : base(deserializing) { } … … 161 180 162 181 variableNames = new List<string>(original.variableNames); 182 allVariableNames = new List<string>(original.allVariableNames); 163 183 164 184 slopeInitializerMu = original.slopeInitializerMu; … … 181 201 182 202 variableNames = new List<string>(); 203 allVariableNames = new List<string>(); 183 204 184 205 slopeInitializerMu = 0.0;
Note: See TracChangeset
for help on using the changeset viewer.