Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
02/05/15 19:35:34 (9 years ago)
Author:
bburlacu
Message:

#1772:

  • Removed unused code
  • Adapted genealogy graph according to the trunk changes to the directed graph
  • Adapted trace calculator and before/after operators
  • Introduced a CloneableCollection to help save node lists
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/Tracking/SymbolicDataAnalysisGenealogyGraphView.cs

    r11881 r11925  
    8585        // that will include just the individual and its ancestors
    8686        var graph = new GenealogyGraph<ISymbolicExpressionTree>();
    87         var ancestors = new[] { graphNode }.Concat(graphNode.Ancestors);
    88         var cloned = ancestors.ToDictionary(x => x, x => cloner.Clone(x));
    89         graph.AddVertices(cloned.Values);
    90         foreach (var arc in cloned.Keys.SelectMany(x => x.InArcs)) {
    91           graph.AddArc(cloner.Clone(arc));
    92         }
     87        var ancestors = new[] { graphNode }.Concat(graphNode.Ancestors).ToList();
     88        graph.AddVertices(ancestors.Select(cloner.Clone));
     89        graph.AddArcs(ancestors.SelectMany(x => x.InArcs).Select(cloner.Clone));
    9390        MainFormManager.MainForm.ShowContent(graph);
    9491      }
     
    185182    private void navigateRightButton_Click(object sender, EventArgs e) {
    186183      var graphNode = (IGenealogyGraphNode<ISymbolicExpressionTree>)genealogyGraphChart.SelectedGraphNode;
    187       var inArcs = (List<IArc>)((IVertex)graphNode).InArcs;
     184      var inArcs = graphNode.InArcs.ToList();
    188185      if (inArcs.Count > 0) {
    189186        var data = inArcs.Last().Data;
     
    205202          for (int i = 1; i < inArcs.Count; ++i) {
    206203            td = (TraceData)inArcs[i].Data;
    207             var f2 = ((ISymbolicExpressionTree)inArcs[i].Source.Data).NodeAt(td.SubtreeIndex);
     204            var f2 = ((IGenealogyGraphNode<ISymbolicExpressionTree>)inArcs[i].Source).Data.NodeAt(td.SubtreeIndex);
    208205            // if the subtrees are the same we have found a match
    209206            // note: this is not necessarily 100% correct if in the trace graph we have identical fragments on different arcs
     
    218215    }
    219216  }
    220 
    221217  public class SymbolicDataAnalysisGenealogyGraphViewDesignable : GenealogyGraphView<ISymbolicExpressionTree> { }
     218
     219  internal static class Util {
     220    internal static ISymbolicExpressionTreeNode NodeAt(this ISymbolicExpressionTree tree, int position) {
     221      return NodeAt(tree.Root, position);
     222    }
     223    internal static ISymbolicExpressionTreeNode NodeAt(this ISymbolicExpressionTreeNode root, int position) {
     224      return root.IterateNodesPrefix().ElementAt(position);
     225    }
     226  }
    222227}
Note: See TracChangeset for help on using the changeset viewer.