Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
01/26/10 05:14:51 (14 years ago)
Author:
swagner
Message:

Operator architecture refactoring (#95)

  • continued work on adapting and refactoring HeuristicLab.Data according to the changes in HeuristicLab.Core
  • started work on adapting and refactoring HeuristicLab.Operators according to changes in HeuristicLab.Core
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Core/3.3/ItemParameter.cs

    r2664 r2684  
    3131  /// Represents a parameter.
    3232  /// </summary>
    33   [Item("Item Parameter", "A parameter which represents an IItem.")]
     33  [Item("ItemParameter", "A parameter which represents an IItem.")]
    3434  [Creatable("Test")]
    3535  public class ItemParameter : Parameter {
     
    8484
    8585    public override IItem GetValue(ExecutionContext context) {
     86      return GetValue(context, true);
     87    }
     88    public override IItem GetValue(ExecutionContext context, bool throwOnError) {
    8689      if (Value != null) return Value;
    8790      ExecutionContext parent = context.Parent;
     
    9497
    9598      if (parameter != null) return parameter.GetValue(context);
    96       else return context.Scope.Lookup(ActualName, true).Value;
     99      else {
     100        Variable variable = context.Scope.Lookup(ActualName, true, throwOnError);
     101        return variable == null ? null : variable.Value;
     102      }
    97103    }
    98104
     
    126132  }
    127133
    128   [Item("Parameter<T>", "A generic parameter which represents an instance of type T.")]
     134  [Item("ItemParameter<T>", "A generic parameter which represents an instance of type T.")]
    129135  [EmptyStorableClass]
    130136  public class ItemParameter<T> : ItemParameter where T : class, IItem {
     
    148154
    149155    public new T GetValue(ExecutionContext context) {
    150       return (T)base.GetValue(context);
     156      return GetValue(context, true);
     157    }
     158    public new T GetValue(ExecutionContext context, bool throwOnError) {
     159      return (T)base.GetValue(context, throwOnError);
    151160    }
    152161  }
Note: See TracChangeset for help on using the changeset viewer.