Free cookie consent management tool by TermsFeed Policy Generator

Changeset 394


Ignore:
Timestamp:
07/23/08 00:28:11 (16 years ago)
Author:
gkronber
Message:
  • implemented operator to store a whole scope as an result item into the cedma-db.
  • worked on AgentListView to display results as sub-nodes of agents.

(ticket #191)

Location:
trunk/sources
Files:
1 added
6 edited

Legend:

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

    r393 r394  
    8383        foreach(ResultEntry entry in Database.GetResults(Id)) {
    8484          Result result = (Result)DbPersistenceManager.Restore(entry.RawData);
     85          result.Database = Database;
     86          result.Id = entry.Id;
     87          result.Summary = entry.Summary;
     88          result.Description = entry.Description;
     89          results.Add(result);
    8590        }
    8691        return results;
  • trunk/sources/HeuristicLab.CEDMA.Core/AgentListView.cs

    r393 r394  
    7979    private void agentTreeView_BeforeExpand(object sender, TreeViewCancelEventArgs e) {
    8080      e.Node.Nodes.Clear();
    81       IAgent agent = (IAgent)e.Node.Tag;
    82       foreach(IAgent subAgent in agent.SubAgents) {
    83         TreeNode node = new TreeNode();
    84         node.Text = subAgent.Name;
    85         node.Tag = subAgent;
    86         node.Nodes.Add("dummy");
    87         e.Node.Nodes.Add(node);
    88       }
    89       foreach(IResult result in agent.Results) {
    90         TreeNode node = new TreeNode();
    91         node.Text = result.Summary;
    92         node.Tag = result;
    93         node.Nodes.Add("dummy");
    94         e.Node.Nodes.Add(node);
     81      if(e.Node.Tag is IAgent) {
     82        IAgent agent = (IAgent)e.Node.Tag;
     83        foreach(IAgent subAgent in agent.SubAgents) {
     84          TreeNode node = new TreeNode();
     85          node.Text = subAgent.Name;
     86          node.Tag = subAgent;
     87          node.Nodes.Add("dummy");
     88          e.Node.Nodes.Add(node);
     89        }
     90        foreach(IResult result in agent.Results) {
     91          TreeNode node = new TreeNode();
     92          node.Text = result.Summary;
     93          node.Tag = result;
     94          node.Nodes.Add("dummy");
     95          e.Node.Nodes.Add(node);
     96        }
     97      } else if(e.Node.Tag is IResult) {
     98        IResult result = (IResult)e.Node.Tag;
     99        foreach(IResult subResult in result.SubResults) {
     100          TreeNode node = new TreeNode();
     101          node.Text = subResult.Summary;
     102          node.Tag = subResult;
     103          node.Nodes.Add("dummy");
     104          e.Node.Nodes.Add(node);
     105        }
    95106      }
    96107    }
  • trunk/sources/HeuristicLab.CEDMA.Core/Result.cs

    r393 r394  
    3434    public string Summary { get; set; }
    3535    public string Description { get; set; }
    36     public IItem result;
     36    public IItem Item { get; set; }
    3737    public Result()
    3838      : base() {
     
    5151        foreach(ResultEntry entry in Database.GetSubResults(Id)) {
    5252          Result result = (Result)DbPersistenceManager.Restore(entry.RawData);
     53          result.Database = Database;
     54          result.Id = entry.Id;
     55          result.Summary = entry.Summary;
     56          result.Description = entry.Description;
     57          results.Add(result);
    5358        }
    5459        return results;
     
    5964    public override XmlNode GetXmlNode(string name, XmlDocument document, IDictionary<Guid, IStorable> persistedObjects) {
    6065      XmlNode node = base.GetXmlNode(name, document, persistedObjects);
    61       node.AppendChild(PersistenceManager.Persist("Result", result, document, persistedObjects));
     66      node.AppendChild(PersistenceManager.Persist("Item", Item, document, persistedObjects));
    6267      return node;
    6368    }
     
    6570    public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) {
    6671      base.Populate(node, restoredObjects);
    67       result = (IItem)PersistenceManager.Restore(node.SelectSingleNode("Result"), restoredObjects);
     72      Item = (IItem)PersistenceManager.Restore(node.SelectSingleNode("Item"), restoredObjects);
    6873    }
    6974    #endregion
    7075
    71     // TASK: create class ResultView
    72     //public override IView CreateView() {
    73     //  return new ResultView(this);
    74     //}
     76    public override IView CreateView() {
     77      return Item.CreateView();
     78    }
    7579  }
    7680}
  • trunk/sources/HeuristicLab.CEDMA.DB/Database.cs

    r393 r394  
    323323          cnn.Open();
    324324          using(DbCommand c = cnn.CreateCommand()) {
    325             c.CommandText = "Select id, ParentAgentId, name, status, ControllerAgent, rawdata from Agent";
     325            c.CommandText = "Select id, name, status, ControllerAgent, rawdata from Agent where ParentAgentId isnull";
    326326            using(DbDataReader r = c.ExecuteReader()) {
    327327              while(r.Read()) {
    328328                AgentEntry agent = new AgentEntry();
     329                agent.ParentAgentId = null;
    329330                agent.Id = r.GetInt32(0);
    330                 agent.ParentAgentId = r.IsDBNull(1) ? null : new Nullable<long>(r.GetInt32(1));
    331                 agent.Name = r.IsDBNull(2)?"-":r.GetString(2);
    332                 agent.Status = (ProcessStatus)Enum.Parse(typeof(ProcessStatus), r.GetString(3));
    333                 agent.ControllerAgent = r.GetBoolean(4);
    334                 agent.RawData = (byte[])r.GetValue(5);
     331                agent.Name = r.IsDBNull(1)?"-":r.GetString(1);
     332                agent.Status = (ProcessStatus)Enum.Parse(typeof(ProcessStatus), r.GetString(2));
     333                agent.ControllerAgent = r.GetBoolean(3);
     334                agent.RawData = (byte[])r.GetValue(4);
    335335                agents.Add(agent);
    336336              }
  • trunk/sources/HeuristicLab.CEDMA.Operators/HeuristicLab.CEDMA.Operators.csproj

    r382 r394  
    5454  </ItemGroup>
    5555  <ItemGroup>
     56    <Compile Include="ScopeResultWriter.cs" />
    5657    <Compile Include="HeuristicLabCedmaOperatorsPlugin.cs" />
    5758    <Compile Include="OnGridProcessor.cs" />
  • trunk/sources/HeuristicLab.CEDMA.Operators/OnGridProcessor.cs

    r393 r394  
    4444
    4545    public override IOperation Apply(IScope scope) {
    46      
    4746      IOperatorGraph operatorGraph = scope.GetVariableValue<IOperatorGraph>("OperatorGraph", false);
    4847      string serverUrl = scope.GetVariableValue<StringData>("CedmaServerUri", true).Data;
Note: See TracChangeset for help on using the changeset viewer.