- Timestamp:
- 12/10/08 17:33:27 (15 years ago)
- File:
-
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
branches/CEDMA-Refactoring-Ticket419/HeuristicLab.CEDMA.Core/DataSet.cs
r928 r957 30 30 31 31 namespace HeuristicLab.CEDMA.Core { 32 public class Agent : IAgent {33 public I Database Database { get; set; }32 public class DataSet { 33 public IStore Store { get; set; } 34 34 public long Id { get; set; } 35 35 public string Name { get; set; } 36 public ProcessStatus Status { get; set; } 37 public bool Terminated { get; set; } 38 private OperatorGraph operatorGraph; 36 private Problem problem; 39 37 40 public IOperatorGraph OperatorGraph{41 get { return operatorGraph; }38 public Problem Problem { 39 get { return problem; } 42 40 } 43 41 44 public Agent()42 public DataSet() 45 43 : base() { 46 operatorGraph = new OperatorGraph();44 problem = new Problem(); 47 45 } 48 46 49 public Agent(IDatabase database, long id)47 public DataSet(IStore store, long id) 50 48 : this() { 51 Database = database;49 Store = store; 52 50 Id = id; 53 51 } 54 52 55 53 public void Save() { 56 Database.UpdateAgent(Id, Name); 57 Database.UpdateAgent(Id, Status); 58 Database.UpdateAgent(Id, PersistenceManager.SaveToGZip(OperatorGraph)); 54 throw new NotImplementedException(); 59 55 } 60 56 61 public void Start() { 62 Status = ProcessStatus.Waiting; 63 Save(); 57 public void Activate() { 58 throw new NotImplementedException(); 64 59 } 65 60 66 public ICollection<IAgent> SubAgents { 67 get { 68 List<IAgent> agents = new List<IAgent>(); 69 foreach(AgentEntry entry in Database.GetSubAgents(Id)) { 70 Agent newAgent = new Agent(Database, entry.Id); 71 newAgent.Name = entry.Name; 72 newAgent.Status = entry.Status; 73 agents.Add(newAgent); 74 } 75 return agents; 76 } 77 } 78 79 public ICollection<IResult> Results { 80 get { 81 List<IResult> results = new List<IResult>(); 82 foreach(ResultEntry entry in Database.GetResults(Id)) { 83 Result result = new Result(Database, entry.Id); 84 result.Summary = entry.Summary; 85 result.Description = entry.Description; 86 results.Add(result); 87 } 88 return results; 89 } 61 private void UpdateDataSet(long Id, byte[] p) { 62 throw new NotImplementedException(); 90 63 } 91 64 92 65 public IView CreateView() { 93 if(OperatorGraph.Operators.Count == 0) { 94 byte[] rawData = Database.GetAgentRawData(Id); 95 IOperatorGraph opGraph = (IOperatorGraph)PersistenceManager.RestoreFromGZip(rawData); 96 foreach(IOperator op in opGraph.Operators) OperatorGraph.AddOperator(op); 97 OperatorGraph.InitialOperator = opGraph.InitialOperator; 98 OperatorLinkPatcher.LinkDatabase(OperatorGraph, Database); 99 } 100 return new AgentView(this); 66 return new DataSetView(this); 101 67 } 102 68 }
Note: See TracChangeset
for help on using the changeset viewer.