Changeset 14875 for branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problems.ProgramSynthesis/Push/Configuration
- Timestamp:
- 04/18/17 01:15:25 (8 years ago)
- Location:
- branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problems.ProgramSynthesis/Push/Configuration
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problems.ProgramSynthesis/Push/Configuration/IReadonlyPushConfiguration.cs
r14834 r14875 3 3 4 4 using HeuristicLab.Common; 5 using HeuristicLab.Problems.ProgramSynthesis. Push.Erc.Interfaces;5 using HeuristicLab.Problems.ProgramSynthesis.Base.Erc.Interfaces; 6 6 using HeuristicLab.Problems.ProgramSynthesis.Push.Stack; 7 7 -
branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problems.ProgramSynthesis/Push/Configuration/PushConfiguration.cs
r14834 r14875 4 4 using System.Linq; 5 5 using Attributes; 6 using Base.Erc; 7 using Base.Erc.Interfaces; 6 8 using Common; 7 9 using Core; 8 using Erc;9 using Erc.Interfaces;10 10 using Expressions; 11 11 using Persistence.Default.CompositeSerializers.Storable; … … 21 21 22 22 enabledExpressions = ExpressionTable.ExpressionNames.ToList(); 23 EnabledStacks = new Dictionary<StackTypes, bool>();23 enabledStacks = new Dictionary<StackTypes, bool>(); 24 24 25 25 ErcOptions = new ErcOptions(); … … 38 38 private void InitEnabledStacks(bool state = true) { 39 39 foreach (StackTypes type in Enum.GetValues(typeof(StackTypes))) { 40 if (! EnabledStacks.ContainsKey(type))41 EnabledStacks.Add(type, state);40 if (!enabledStacks.ContainsKey(type)) 41 enabledStacks.Add(type, state); 42 42 } 43 43 } … … 50 50 public PushConfiguration(PushConfiguration origin, Cloner cloner) : base(origin, cloner) { 51 51 enabledExpressions = origin.EnabledExpressions.ToList(); 52 EnabledStacks = origin.EnabledStacks.ToDictionary(x => x.Key, x => x.Value);52 enabledStacks = origin.EnabledStacks.ToDictionary(x => x.Key, x => x.Value); 53 53 54 54 ErcOptions = cloner.Clone(origin.ErcOptions); … … 70 70 } 71 71 72 [Storable] 73 public IDictionary<StackTypes, bool> EnabledStacks { get; set; } 74 75 IReadOnlyDictionary<StackTypes, bool> IReadOnlyPushConfiguration.EnabledStacks { get { return EnabledStacks as IReadOnlyDictionary<StackTypes, bool>; } } 72 73 [Storable] 74 private Dictionary<StackTypes, bool> enabledStacks; 75 76 public IReadOnlyDictionary<StackTypes, bool> EnabledStacks { get { return enabledStacks; } } 76 77 77 78 public event EventHandler<EnabledExpressionsChangedEventArgs> EnabledExpressionsChanged; … … 95 96 } 96 97 97 IReadOnlyList<string> IReadOnlyPushConfiguration.EnabledExpressions { get { return EnabledExpressions as IReadOnlyList<string>; } }98 IReadOnlyList<string> IReadOnlyPushConfiguration.EnabledExpressions { get { return enabledExpressions; } } 98 99 99 100 [Storable] … … 189 190 var type = ExpressionTable.TypeToNameTable.Single(x => x.Value == name).Key; 190 191 var attribute = ExpressionTable.TypeToAttributeTable[type]; 191 EnabledStacks[attribute.StackType] = true;192 enabledStacks[attribute.StackType] = true; 192 193 } 193 194 … … 207 208 var type = ExpressionTable.TypeToNameTable.Single(x => x.Value == name).Key; 208 209 var attribute = ExpressionTable.TypeToAttributeTable[type]; 209 EnabledStacks[attribute.StackType] = false;210 enabledStacks[attribute.StackType] = false; 210 211 } 211 212 … … 238 239 239 240 public void EnableStack(StackTypes type, bool enableExpressions = false) { 240 EnabledStacks[type] = true;241 enabledStacks[type] = true; 241 242 242 243 if (enableExpressions) … … 245 246 246 247 public void DisableStack(StackTypes type, bool disableExpressions = false) { 247 EnabledStacks[type] = false;248 enabledStacks[type] = false; 248 249 249 250 if (disableExpressions)
Note: See TracChangeset
for help on using the changeset viewer.