Changeset 420 for trunk/sources/HeuristicLab.CEDMA.Core
- Timestamp:
- 08/01/08 21:35:35 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.CEDMA.Core/AgentList.cs
r403 r420 30 30 using System.Runtime.Serialization; 31 31 using System.IO; 32 using HeuristicLab.Operators; 32 33 33 34 namespace HeuristicLab.CEDMA.Core { … … 50 51 newAgent.Status = a.Status; 51 52 IOperatorGraph opGraph = (IOperatorGraph)PersistenceManager.RestoreFromGZip(a.RawData); 52 foreach(IOperator op in opGraph.Operators) newAgent.OperatorGraph.AddOperator(op); 53 54 DownloadOperators(opGraph, new Dictionary<long, IOperator>()); 55 56 foreach(IOperator op in opGraph.Operators) { 57 newAgent.OperatorGraph.AddOperator(op); 58 } 53 59 newAgent.OperatorGraph.InitialOperator = opGraph.InitialOperator; 54 60 agentList.Add(newAgent); … … 80 86 } 81 87 88 private void DownloadOperators(IOperatorGraph opGraph, Dictionary<long, IOperator> downloaded) { 89 foreach(IOperator op in opGraph.Operators) { 90 DownloadOperators(op, downloaded); 91 } 92 } 93 94 private void DownloadOperators(IOperator op, Dictionary<long, IOperator> downloaded) { 95 if(op is OperatorLink) { 96 OperatorLink link = op as OperatorLink; 97 if(downloaded.ContainsKey(link.Id)) { 98 link.Operator = downloaded[link.Id]; 99 } else { 100 OperatorEntry targetEntry = database.GetOperator(link.Id); 101 IOperator target = (IOperator)PersistenceManager.RestoreFromGZip(targetEntry.RawData); 102 downloaded.Add(link.Id, target); 103 DownloadOperators(target, downloaded); 104 link.Operator = target; 105 } 106 } else if(op is CombinedOperator) { 107 DownloadOperators(((CombinedOperator)op).OperatorGraph, downloaded); 108 } 109 } 110 82 111 public override IView CreateView() { 83 112 return new AgentListView(this);
Note: See TracChangeset
for help on using the changeset viewer.