Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
08/26/14 13:05:22 (10 years ago)
Author:
pfleck
Message:

#2208 merged changes from trunk

Location:
branches/HeuristicLab.Problems.Orienteering
Files:
2 edited
1 copied

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.Problems.Orienteering

  • branches/HeuristicLab.Problems.Orienteering/HeuristicLab.Core/3.3/Collections/DirectedGraph/Vertex.cs

    r11241 r11303  
    2727
    2828namespace HeuristicLab.Core {
     29  [Item("Vertex", "An object representing a vertex in the graph. It can have a text label, a weight, and an additional data object.")]
    2930  [StorableClass]
    3031  public class Vertex : Item, IVertex {
     
    9293      weight = original.Weight;
    9394
    94       inArcs = original.InArcs.Select(cloner.Clone).ToList();
    95       outArcs = original.OutArcs.Select(cloner.Clone).ToList();
     95      // we do not clone the arcs here (would cause too much recursion and ultimately a stack overflow)
    9696    }
    9797
     
    102102    public void AddArc(IArc arc) {
    103103      if (this != arc.Source && this != arc.Target)
    104         throw new InvalidOperationException("The current vertex must be either the arc source or the arc target.");
     104        throw new ArgumentException("The current vertex must be either the arc source or the arc target.");
     105
     106      if (arc.Source == arc.Target)
     107        throw new ArgumentException("Arc source and target must be different.");
    105108
    106109      if (this == arc.Source) {
     
    117120    public void RemoveArc(IArc arc) {
    118121      if (this != arc.Source && this != arc.Target)
    119         throw new InvalidOperationException("The current vertex must be either the arc source or the arc target.");
     122        throw new ArgumentException("The current vertex must be either the arc source or the arc target.");
    120123
    121124      if (this == arc.Source) {
     
    167170    }
    168171
     172    public Vertex(IDeepCloneable data)
     173      : base(data) {
     174    }
     175
    169176    public override IDeepCloneable Clone(Cloner cloner) {
    170177      return new Vertex<T>(this, cloner);
Note: See TracChangeset for help on using the changeset viewer.