Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
08/13/08 17:09:48 (16 years ago)
Author:
gkronber
Message:

Fixed the problem that sometimes an operator link was not patched before a view was created (which resulted in a NullException) by adding a property for the source database in OperatorLink! and updating this property recursively whenever an operator is loaded from the CEDMA DB.

The method for recursively setting the property is in static class OperatorLinkPatcher because the code is needed in Agent, DatabaseOperatorLibrary and OperatorLink.

(ticket #211)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.CEDMA.Core/DatabaseOperatorLibrary.cs

    r512 r513  
    8585      }
    8686
    87       // patch all OperatorLinks
     87      // set the DB source for each operator
    8888      foreach(IOperator op in group.Operators) {
    89         PatchLinks(op);
    90       }
    91     }
    92 
    93     private void PatchLinks(IOperatorGraph opGraph) {
    94       foreach(IOperator op in opGraph.Operators) {
    95         PatchLinks(op);
    96       }
    97     }
    98 
    99     private void PatchLinks(IOperator op) {
    100       if(op is OperatorLink) {
    101         OperatorLink link = op as OperatorLink;
    102         link.Database = Database;
    103       }
    104       else if(op is CombinedOperator) {
    105         CombinedOperator combinedOp = op as CombinedOperator;
    106         foreach(IOperator internalOp in combinedOp.OperatorGraph.Operators) {
    107           PatchLinks(internalOp);
    108         }
    109       }
    110       // also patch operator links contained (indirectly) in variables
    111       foreach(VariableInfo varInfo in op.VariableInfos) {
    112         IVariable var = op.GetVariable(varInfo.ActualName);
    113         if(var != null && var.Value is IOperatorGraph) {
    114           PatchLinks((IOperatorGraph)var.Value);
    115         } else if(var != null && var.Value is IOperator) {
    116           PatchLinks((IOperator)var.Value);
    117         }
     89        OperatorLinkPatcher.LinkDatabase(op, Database);
    11890      }
    11991    }
Note: See TracChangeset for help on using the changeset viewer.