- Timestamp:
- 08/13/08 17:09:48 (16 years ago)
- Location:
- trunk/sources/HeuristicLab.CEDMA.Core
- Files:
-
- 1 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.CEDMA.Core/Agent.cs
r512 r513 96 96 foreach(IOperator op in opGraph.Operators) OperatorGraph.AddOperator(op); 97 97 OperatorGraph.InitialOperator = opGraph.InitialOperator; 98 PatchOperatorLinks(OperatorGraph);98 OperatorLinkPatcher.LinkDatabase(OperatorGraph, Database); 99 99 } 100 100 return new AgentView(this); 101 101 } 102 103 private void PatchOperatorLinks(IOperatorGraph opGraph) {104 foreach(IOperator op in opGraph.Operators) {105 PatchOperatorLinks(op);106 }107 }108 109 private void PatchOperatorLinks(IOperator op) {110 if(op is OperatorLink) {111 OperatorLink link = op as OperatorLink;112 link.Database = Database;113 //if(downloaded.ContainsKey(link.Id)) {114 // link.Operator = downloaded[link.Id];115 //} else {116 // OperatorEntry targetEntry = Database.GetOperator(link.Id);117 // IOperator target = (IOperator)PersistenceManager.RestoreFromGZip(targetEntry.RawData);118 // downloaded.Add(link.Id, target);119 // PatchOperatorLinks(target, downloaded);120 // link.Operator = target;121 //}122 } else if(op is CombinedOperator) {123 PatchOperatorLinks(((CombinedOperator)op).OperatorGraph);124 }125 // also patch operator links contained (indirectly) in variables126 foreach(VariableInfo varInfo in op.VariableInfos) {127 IVariable var = op.GetVariable(varInfo.ActualName);128 if(var != null && var.Value is IOperatorGraph) {129 PatchOperatorLinks((IOperatorGraph)var.Value);130 } else if(var != null && var.Value is IOperator) {131 PatchOperatorLinks((IOperator)var.Value);132 }133 }134 }135 102 } 136 103 } -
trunk/sources/HeuristicLab.CEDMA.Core/DatabaseOperatorLibrary.cs
r512 r513 85 85 } 86 86 87 // patch all OperatorLinks87 // set the DB source for each operator 88 88 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); 118 90 } 119 91 } -
trunk/sources/HeuristicLab.CEDMA.Core/HeuristicLab.CEDMA.Core.csproj
r418 r513 70 70 </Compile> 71 71 <Compile Include="OperatorLink.cs" /> 72 <Compile Include="OperatorLinkPatcher.cs" /> 72 73 <Compile Include="Result.cs" /> 73 74 <Compile Include="IResult.cs" /> -
trunk/sources/HeuristicLab.CEDMA.Core/OperatorLink.cs
r512 r513 73 73 OperatorEntry targetEntry = Database.GetOperator(Id); 74 74 IOperator target = (IOperator)PersistenceManager.RestoreFromGZip(targetEntry.RawData); 75 PatchOperatorLinks(target);75 OperatorLinkPatcher.LinkDatabase(target, Database); 76 76 Operator = target; 77 77 } … … 95 95 base.Populate(node, restoredObjects); 96 96 } 97 98 private void PatchOperatorLinks(IOperatorGraph opGraph) {99 foreach(IOperator op in opGraph.Operators) {100 PatchOperatorLinks(op);101 }102 }103 104 private void PatchOperatorLinks(IOperator op) {105 if(op is OperatorLink) {106 OperatorLink link = op as OperatorLink;107 link.Database = Database;108 //if(downloaded.ContainsKey(link.Id)) {109 // link.Operator = downloaded[link.Id];110 //} else {111 // OperatorEntry targetEntry = Database.GetOperator(link.Id);112 // IOperator target = (IOperator)PersistenceManager.RestoreFromGZip(targetEntry.RawData);113 // downloaded.Add(link.Id, target);114 // PatchOperatorLinks(target, downloaded);115 // link.Operator = target;116 //}117 } else if(op is CombinedOperator) {118 PatchOperatorLinks(((CombinedOperator)op).OperatorGraph);119 }120 // also patch operator links contained (indirectily) in variables121 foreach(VariableInfo varInfo in op.VariableInfos) {122 IVariable var = op.GetVariable(varInfo.ActualName);123 if(var != null && var.Value is IOperatorGraph) {124 PatchOperatorLinks((IOperatorGraph)var.Value);125 } else if(var != null && var.Value is IOperator) {126 PatchOperatorLinks((IOperator)var.Value);127 }128 }129 }130 97 } 131 98 }
Note: See TracChangeset
for help on using the changeset viewer.