Changeset 2687 for trunk/sources/HeuristicLab.Core/3.3/ItemParameter.cs
- Timestamp:
- 01/27/10 03:55:16 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Core/3.3/ItemParameter.cs
r2685 r2687 84 84 85 85 public override IItem GetValue(ExecutionContext context) { 86 return GetValue(context, true); 87 } 88 public override IItem GetValue(ExecutionContext context, bool throwOnError) { 89 if (Value != null) return Value; 90 91 ExecutionContext current, child; 92 IParameter parameter = null; 93 child = context; 94 current = context.Parent; 95 while ((current != null) && (parameter == null)) { 96 current.Operator.Parameters.TryGetValue(ActualName, out parameter); 97 child = current; 86 ItemParameter param = this; 87 ExecutionContext current = context; 88 string actualName = null; 89 while (param != null) { 90 if (param.Value != null) return param.Value; 91 actualName = param.ActualName; 98 92 current = current.Parent; 93 while ((current != null) && !current.Operator.Parameters.ContainsKey(actualName)) 94 current = current.Parent; 95 if (current != null) 96 param = (ItemParameter)current.Operator.Parameters[actualName]; 97 else 98 param = null; 99 99 } 100 100 101 if (parameter != null) return parameter.GetValue(child, throwOnError); 102 else { 103 Variable variable = context.Scope.Lookup(ActualName, true, throwOnError); 104 return variable == null ? null : variable.Value; 105 } 101 IScope scope = context.Scope; 102 while ((scope != null) && !scope.Variables.ContainsKey(actualName)) 103 scope = scope.Parent; 104 return scope != null ? scope.Variables[actualName].Value : null; 106 105 } 107 106 … … 157 156 158 157 public new T GetValue(ExecutionContext context) { 159 return GetValue(context, true); 160 } 161 public new T GetValue(ExecutionContext context, bool throwOnError) { 162 return (T)base.GetValue(context, throwOnError); 158 return (T)base.GetValue(context); 163 159 } 164 160 }
Note: See TracChangeset
for help on using the changeset viewer.