Changeset 2834 for trunk/sources/HeuristicLab.Parameters
- Timestamp:
- 02/19/10 06:19:16 (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
r2818 r2834 74 74 IValueParameter valueParam = this as IValueParameter; 75 75 ILookupParameter lookupParam = this as ILookupParameter; 76 ExecutionContext current = ExecutionContext;76 IExecutionContext current = ExecutionContext; 77 77 78 78 name = Name; … … 82 82 83 83 current = current.Parent; 84 while ((current != null) && !current. Operator.Parameters.ContainsKey(name))84 while ((current != null) && !current.Parameters.ContainsKey(name)) 85 85 current = current.Parent; 86 86 87 87 if (current != null) { 88 valueParam = current. Operator.Parameters[name] as IValueParameter;89 lookupParam = current. Operator.Parameters[name] as ILookupParameter;88 valueParam = current.Parameters[name] as IValueParameter; 89 lookupParam = current.Parameters[name] as ILookupParameter; 90 90 if ((valueParam == null) && (lookupParam == null)) 91 91 throw new InvalidOperationException( … … 108 108 return scope != null ? scope.Variables[actualName] : null; 109 109 } 110 private IValueParameter GetProblemParameter(string name) {111 IValueParameter param = null;112 if (ExecutionContext.Problem.Parameters.ContainsKey(name)) {113 param = ExecutionContext.Problem.Parameters[name] as IValueParameter;114 if (param == null)115 throw new InvalidOperationException(116 string.Format("Parameter look-up chain broken. Parameter \"{0}\" is not an \"{1}\".",117 name,118 typeof(IValueParameter).GetPrettyName())119 );120 }121 return param;122 }110 //private IValueParameter GetProblemParameter(string name) { 111 // IValueParameter param = null; 112 // if (ExecutionContext.Problem.Parameters.ContainsKey(name)) { 113 // param = ExecutionContext.Problem.Parameters[name] as IValueParameter; 114 // if (param == null) 115 // throw new InvalidOperationException( 116 // string.Format("Parameter look-up chain broken. Parameter \"{0}\" is not an \"{1}\".", 117 // name, 118 // typeof(IValueParameter).GetPrettyName()) 119 // ); 120 // } 121 // return param; 122 //} 123 123 protected override IItem GetActualValue() { 124 124 string name; … … 141 141 142 142 // try to get value from problem 143 IValueParameter problemParam = GetProblemParameter(name);144 if (problemParam != null) return problemParam.Value;143 //IValueParameter problemParam = GetProblemParameter(name); 144 //if (problemParam != null) return problemParam.Value; 145 145 146 146 return null; … … 169 169 170 170 // try to set value in problem 171 IValueParameter problemParam = GetProblemParameter(name);172 if (problemParam != null) {173 problemParam.Value = val;174 return;175 }171 //IValueParameter problemParam = GetProblemParameter(name); 172 //if (problemParam != null) { 173 // problemParam.Value = val; 174 // return; 175 //} 176 176 177 177 // create new variable … … 186 186 } 187 187 188 public static string TranslateName(string name, ExecutionContext context) {188 public static string TranslateName(string name, IExecutionContext context) { 189 189 string currentName = name; 190 ExecutionContext currentContext = context;190 IExecutionContext currentContext = context; 191 191 IParameter param; 192 192 ILookupParameter lookupParam; 193 193 194 194 while (currentContext != null) { 195 currentContext. Operator.Parameters.TryGetValue(currentName, out param);195 currentContext.Parameters.TryGetValue(currentName, out param); 196 196 if (param != null) { 197 197 lookupParam = param as ILookupParameter; -
trunk/sources/HeuristicLab.Parameters/3.3/Parameter.cs
r2818 r2834 48 48 } 49 49 [Storable] 50 private ExecutionContext executionContext;51 public ExecutionContext ExecutionContext {50 private IExecutionContext executionContext; 51 public IExecutionContext ExecutionContext { 52 52 get { return executionContext; } 53 53 set { … … 77 77 Parameter clone = (Parameter)base.Clone(cloner); 78 78 clone.dataType = dataType; 79 clone.executionContext = ( ExecutionContext)cloner.Clone(executionContext);79 clone.executionContext = (IExecutionContext)cloner.Clone(executionContext); 80 80 return clone; 81 81 }
Note: See TracChangeset
for help on using the changeset viewer.