Changeset 3687 for trunk/sources/HeuristicLab.Parameters
- Timestamp:
- 05/06/10 23:34:36 (15 years ago)
- Location:
- trunk/sources/HeuristicLab.Parameters/3.3
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Parameters/3.3/LookupParameter.cs
r3555 r3687 42 42 OnActualNameChanged(); 43 43 } 44 } 45 } 46 public string TranslatedName { 47 get { 48 string translatedName; 49 GetValueParameterAndTranslateName(out translatedName); 50 return translatedName; 44 51 } 45 52 } … … 168 175 OnToStringChanged(); 169 176 } 170 171 public static string TranslateName(string name, IExecutionContext context) {172 string currentName = name;173 IExecutionContext currentContext = context;174 IParameter param;175 ILookupParameter lookupParam;176 177 while (currentContext != null) {178 currentContext.Parameters.TryGetValue(currentName, out param);179 if (param != null) {180 lookupParam = param as ILookupParameter;181 if (lookupParam == null)182 throw new InvalidOperationException(183 string.Format("Parameter look-up chain broken. Parameter \"{0}\" is not an \"{1}\".",184 currentName,185 typeof(ILookupParameter).GetPrettyName())186 );187 currentName = lookupParam.ActualName;188 }189 currentContext = currentContext.Parent;190 }191 return currentName;192 }193 177 } 194 178 } -
trunk/sources/HeuristicLab.Parameters/3.3/ScopeTreeLookupParameter.cs
r3663 r3687 73 73 74 74 protected override IItem GetActualValue() { 75 string name = LookupParameter<ItemArray<T>>.TranslateName(Name, ExecutionContext);76 77 75 IEnumerable<IScope> scopes = new IScope[] { ExecutionContext.Scope }; 78 76 for (int i = 0; i < depth; i++) 79 77 scopes = scopes.Select(x => (IEnumerable<IScope>)x.SubScopes).Aggregate((a, b) => a.Concat(b)); 80 78 79 string name = TranslatedName; 81 80 List<T> values = new List<T>(); 82 81 IVariable var; … … 105 104 ); 106 105 107 string name = LookupParameter<ItemArray<T>>.TranslateName(Name, ExecutionContext);108 109 106 IEnumerable<IScope> scopes = new IScope[] { ExecutionContext.Scope }; 110 107 for (int i = 0; i < depth; i++) … … 113 110 if (scopes.Count() != values.Length) throw new InvalidOperationException("Number of values is not equal to number of scopes."); 114 111 112 string name = TranslatedName; 115 113 int j = 0; 116 114 IVariable var;
Note: See TracChangeset
for help on using the changeset viewer.