Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
07/30/14 02:01:41 (10 years ago)
Author:
bburlacu
Message:

#2215: Updated tests project. Fixed a couple of bugs when adding arcs to a vertex. Removed useless events from the directed graph. Worked around invalid operation exception when removing arcs.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.BottomUpTreeDistance/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/DirectedGraph/DirectedGraph.cs

    r11229 r11234  
    9494      vertex.ArcAdded += OnArcAdded;
    9595      vertex.ArcRemoved += OnArcRemoved;
    96       OnVertexAdded(this, EventArgs.Empty);
    9796    }
    9897
     
    10099      vertices.Remove(vertex);
    101100      // remove connections to/from the removed vertex
    102       foreach (var arc in vertex.InArcs.Concat(vertex.OutArcs))
     101      var arcList = vertex.InArcs.Concat(vertex.OutArcs).ToList();
     102      foreach (var arc in arcList)
    103103        RemoveArc(arc);
    104104      // deregister event handlers
     
    106106      vertex.ArcRemoved -= OnArcRemoved;
    107107      vertex.Changed -= OnVertexChanged;
    108       OnVertexRemoved(this, EventArgs.Empty);
    109108    }
    110109
     
    131130    }
    132131
    133     public event EventHandler VertexAdded;
    134     protected virtual void OnVertexAdded(object sender, EventArgs args) {
    135       var added = VertexAdded;
    136       if (added != null)
    137         added(sender, args);
    138     }
    139 
    140     public event EventHandler VertexChanged;
    141     protected virtual void OnVertexChanged(object sender, EventArgs args) {
    142       var changed = VertexChanged;
    143       if (changed != null)
    144         changed(sender, args);
    145     }
    146 
    147     public event EventHandler VertexRemoved;
    148     protected virtual void OnVertexRemoved(object sender, EventArgs args) {
    149       var removed = VertexRemoved;
    150       if (removed != null)
    151         removed(sender, args);
    152     }
     132    protected virtual void OnVertexChanged(object sender, EventArgs args) { }
    153133
    154134    protected virtual void OnArcAdded(object sender, EventArgs<IArc> args) {
Note: See TracChangeset for help on using the changeset viewer.