Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
02/19/10 06:19:16 (14 years ago)
Author:
swagner
Message:

Operator architecture refactoring (#95)

  • worked on operators, engines, and optimization
Location:
trunk/sources/HeuristicLab.Parameters/3.3
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Parameters/3.3/LookupParameter.cs

    r2818 r2834  
    7474      IValueParameter valueParam = this as IValueParameter;
    7575      ILookupParameter lookupParam = this as ILookupParameter;
    76       ExecutionContext current = ExecutionContext;
     76      IExecutionContext current = ExecutionContext;
    7777
    7878      name = Name;
     
    8282
    8383        current = current.Parent;
    84         while ((current != null) && !current.Operator.Parameters.ContainsKey(name))
     84        while ((current != null) && !current.Parameters.ContainsKey(name))
    8585          current = current.Parent;
    8686
    8787        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;
    9090          if ((valueParam == null) && (lookupParam == null))
    9191            throw new InvalidOperationException(
     
    108108      return scope != null ? scope.Variables[actualName] : null;
    109109    }
    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    //}
    123123    protected override IItem GetActualValue() {
    124124      string name;
     
    141141
    142142      // 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;
    145145
    146146      return null;
     
    169169
    170170      // 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      //}
    176176
    177177      // create new variable
     
    186186    }
    187187
    188     public static string TranslateName(string name, ExecutionContext context) {
     188    public static string TranslateName(string name, IExecutionContext context) {
    189189      string currentName = name;
    190       ExecutionContext currentContext = context;
     190      IExecutionContext currentContext = context;
    191191      IParameter param;
    192192      ILookupParameter lookupParam;
    193193
    194194      while (currentContext != null) {
    195         currentContext.Operator.Parameters.TryGetValue(currentName, out param);
     195        currentContext.Parameters.TryGetValue(currentName, out param);
    196196        if (param != null) {
    197197          lookupParam = param as ILookupParameter;
  • trunk/sources/HeuristicLab.Parameters/3.3/Parameter.cs

    r2818 r2834  
    4848    }
    4949    [Storable]
    50     private ExecutionContext executionContext;
    51     public ExecutionContext ExecutionContext {
     50    private IExecutionContext executionContext;
     51    public IExecutionContext ExecutionContext {
    5252      get { return executionContext; }
    5353      set {
     
    7777      Parameter clone = (Parameter)base.Clone(cloner);
    7878      clone.dataType = dataType;
    79       clone.executionContext = (ExecutionContext)cloner.Clone(executionContext);
     79      clone.executionContext = (IExecutionContext)cloner.Clone(executionContext);
    8080      return clone;
    8181    }
Note: See TracChangeset for help on using the changeset viewer.