- Timestamp:
- 02/18/15 10:54:32 (10 years ago)
- Location:
- branches/HeuristicLab.DatasetRefactor/sources
- Files:
-
- 30 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.DatasetRefactor/sources
- Property svn:mergeinfo changed
-
branches/HeuristicLab.DatasetRefactor/sources/HeuristicLab.Core/3.3/Collections/CheckedItemCollection.cs
r11171 r12031 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 4Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2015 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
branches/HeuristicLab.DatasetRefactor/sources/HeuristicLab.Core/3.3/Collections/CheckedItemList.cs
r11171 r12031 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 4Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2015 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
branches/HeuristicLab.DatasetRefactor/sources/HeuristicLab.Core/3.3/Collections/ConstraintCollection.cs
r11171 r12031 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 4Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2015 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
branches/HeuristicLab.DatasetRefactor/sources/HeuristicLab.Core/3.3/Collections/DirectedGraph/Arc.cs
r11853 r12031 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 4Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2015 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 56 56 } 57 57 58 [Storable]59 protected object data;60 public object Data {61 get { return data; }62 set {63 if (data == value) return;64 data = value;65 OnChanged(this, EventArgs.Empty);66 }67 }68 58 69 59 [StorableConstructor] … … 81 71 label = original.Label; 82 72 weight = original.Weight; 83 if (data is IDeepCloneable)84 data = cloner.Clone((IDeepCloneable)data);85 else data = original.Data;86 73 } 87 74 public override IDeepCloneable Clone(Cloner cloner) { return new Arc(this, cloner); } … … 96 83 97 84 [StorableClass] 98 public class Arc<T> : Arc, IArc<T> where T : class,IItem { 85 public class Arc<T> : Arc, IArc<T> where T : class,IDeepCloneable { 86 [Storable] 87 protected T data; 88 public T Data { 89 get { return data; } 90 set { 91 if (data == value) return; 92 data = value; 93 OnChanged(this, EventArgs.Empty); 94 } 95 } 96 97 public override IDeepCloneable Clone(Cloner cloner) { 98 return new Arc<T>(this, cloner); 99 } 100 101 protected Arc(Arc<T> original, Cloner cloner) 102 : base(original, cloner) { 103 if (original.Data != null) 104 Data = cloner.Clone(original.Data); 105 } 106 99 107 public Arc(bool deserializing) 100 108 : base(deserializing) { … … 108 116 : base(original, cloner) { 109 117 } 110 111 new public IVertex<T> Source {112 get { return (IVertex<T>)base.Source; }113 }114 new public IVertex<T> Target {115 get { return (IVertex<T>)base.Target; }116 }117 118 } 118 119 } -
branches/HeuristicLab.DatasetRefactor/sources/HeuristicLab.Core/3.3/Collections/DirectedGraph/DirectedGraph.cs
r11571 r12031 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 4Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2015 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 56 56 : base(original, cloner) { 57 57 vertices = new HashSet<IVertex>(original.vertices.Select(cloner.Clone)); 58 59 // this select preserves the arc order so they are added to the new cloned vertices exactly in the same order 60 var originalArcs = original.Vertices.SelectMany(x => x.InArcs).Select(cloner.Clone); 61 arcs = new HashSet<IArc>(); 58 arcs = new HashSet<IArc>(original.arcs.Select(cloner.Clone)); 62 59 63 60 // add the arcs to the newly cloned vertices 64 foreach (var arc in originalArcs) { 65 arcs.Add(arc); 61 foreach (var arc in arcs) { 66 62 arc.Source.AddArc(arc); 67 63 arc.Target.AddArc(arc); … … 85 81 } 86 82 87 foreach (var arc in arcs .OrderBy(x => x.Data != null)) {83 foreach (var arc in arcs) { 88 84 var source = arc.Source; 89 85 var target = arc.Target; … … 106 102 vertex.ArcAdded += Vertex_ArcAdded; 107 103 vertex.ArcRemoved += Vertex_ArcRemoved; 108 OnVerte dAdded(this, new EventArgs<IVertex>(vertex));104 OnVertexAdded(this, new EventArgs<IVertex>(vertex)); 109 105 } 110 106 } 111 107 112 108 public virtual void AddVertices(IEnumerable<IVertex> vertexList) { 113 var hash = new HashSet<IVertex>(vertexList); 114 var arcList = vertexList.SelectMany(v => v.InArcs.Concat(v.OutArcs)); 115 if (arcList.Any(x => !hash.Contains(x.Source) || !hash.Contains(x.Target))) 116 throw new ArgumentException("Vertex arcs are connected to vertices not in the graph."); 117 // if everything is in order, add the vertices to the directed graph 118 foreach (var v in vertexList) 119 vertices.Add(v); 120 foreach (var a in arcList) 121 arcs.Add(a); 109 foreach (var v in vertexList) { AddVertex(v); } 122 110 } 123 111 124 112 public virtual void RemoveVertices(IEnumerable<IVertex> vertexList) { 125 foreach (var v in vertexList) 126 RemoveVertex(v); 113 foreach (var v in vertexList) { RemoveVertex(v); } 127 114 } 128 115 … … 160 147 } 161 148 149 public virtual void AddArcs(IEnumerable<IArc> arcList) { 150 foreach (var a in arcList) { AddArc(a); } 151 } 152 162 153 public virtual void RemoveArc(IArc arc) { 163 154 arcs.Remove(arc); … … 168 159 } 169 160 161 public virtual void RemoveArcs(IEnumerable<IArc> arcList) { 162 foreach (var a in arcList) { RemoveArc(a); } 163 } 164 170 165 protected virtual void Vertex_ArcAdded(object sender, EventArgs<IArc> args) { 171 166 // the ArcAdded event is fired by a vertex when an arc from/to another vertex is added to its list of connections … … 182 177 // events 183 178 public event EventHandler<EventArgs<IVertex>> VertexAdded; 184 protected virtual void OnVerte dAdded(object sender, EventArgs<IVertex> args) {179 protected virtual void OnVertexAdded(object sender, EventArgs<IVertex> args) { 185 180 var added = VertexAdded; 186 181 if (added != null) -
branches/HeuristicLab.DatasetRefactor/sources/HeuristicLab.Core/3.3/Collections/DirectedGraph/Vertex.cs
r11263 r12031 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 4Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2015 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 52 52 } 53 53 54 [Storable]55 private IDeepCloneable data;56 public IDeepCloneable Data {57 get { return data; }58 set {59 if (data == value) return;60 data = value;61 OnChanged(this, EventArgs.Empty);62 }63 }64 65 54 private readonly List<IArc> inArcs = new List<IArc>(); 66 55 public IEnumerable<IArc> InArcs { … … 83 72 private void AfterDeserialization() { } 84 73 85 public Vertex(IDeepCloneable data) { 86 this.data = data; 87 } 74 public Vertex() { } 88 75 89 76 protected Vertex(Vertex original, Cloner cloner) 90 77 : base(original, cloner) { 91 data = cloner.Clone(original.Data);92 78 label = original.Label; 93 79 weight = original.Weight; 94 95 80 // we do not clone the arcs here (would cause too much recursion and ultimately a stack overflow) 96 81 } … … 157 142 158 143 [StorableClass] 159 public class Vertex<T> : Vertex, IVertex<T> where T : class,IItem { 160 public new T Data { 161 get { return (T)base.Data; } 162 set { base.Data = value; } 144 public class Vertex<T> : Vertex, IVertex<T> where T : class,IDeepCloneable { 145 [Storable] 146 private T data; 147 public T Data { 148 get { return data; } 149 set { 150 if (data == value) return; 151 data = value; 152 OnChanged(this, EventArgs.Empty); 153 } 163 154 } 164 155 … … 168 159 protected Vertex(Vertex<T> original, Cloner cloner) 169 160 : base(original, cloner) { 161 if (original.Data != null) 162 Data = cloner.Clone(original.Data); 170 163 } 171 164 172 public Vertex(IDeepCloneable data) 173 : base(data) { 174 } 165 public Vertex() : base() { } 175 166 176 167 public override IDeepCloneable Clone(Cloner cloner) { -
branches/HeuristicLab.DatasetRefactor/sources/HeuristicLab.Core/3.3/Collections/ItemArray.cs
r11171 r12031 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 4Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2015 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
branches/HeuristicLab.DatasetRefactor/sources/HeuristicLab.Core/3.3/Collections/ItemCollection.cs
r11171 r12031 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 4Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2015 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
branches/HeuristicLab.DatasetRefactor/sources/HeuristicLab.Core/3.3/Collections/ItemDictionary.cs
r11171 r12031 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 4Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2015 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
branches/HeuristicLab.DatasetRefactor/sources/HeuristicLab.Core/3.3/Collections/ItemList.cs
r11171 r12031 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 4Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2015 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
branches/HeuristicLab.DatasetRefactor/sources/HeuristicLab.Core/3.3/Collections/ItemSet.cs
r11171 r12031 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 4Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2015 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 52 52 protected ItemSet(ItemSet<T> original, Cloner cloner) { 53 53 cloner.RegisterClonedObject(original, this); 54 set = new HashSet<T>(original.Select( x => cloner.Clone(x)));54 set = new HashSet<T>(original.Select(cloner.Clone), original.set.Comparer); 55 55 } 56 56 public ItemSet() : base() { } -
branches/HeuristicLab.DatasetRefactor/sources/HeuristicLab.Core/3.3/Collections/KeyedItemCollection.cs
r11171 r12031 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 4Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2015 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
branches/HeuristicLab.DatasetRefactor/sources/HeuristicLab.Core/3.3/Collections/NamedItemCollection.cs
r11330 r12031 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 4Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2015 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
branches/HeuristicLab.DatasetRefactor/sources/HeuristicLab.Core/3.3/Collections/OperationCollection.cs
r11171 r12031 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 4Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2015 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
branches/HeuristicLab.DatasetRefactor/sources/HeuristicLab.Core/3.3/Collections/OperatorCollection.cs
r11171 r12031 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 4Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2015 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
branches/HeuristicLab.DatasetRefactor/sources/HeuristicLab.Core/3.3/Collections/OperatorList.cs
r11171 r12031 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 4Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2015 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
branches/HeuristicLab.DatasetRefactor/sources/HeuristicLab.Core/3.3/Collections/OperatorSet.cs
r11171 r12031 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 4Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2015 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
branches/HeuristicLab.DatasetRefactor/sources/HeuristicLab.Core/3.3/Collections/ParameterCollection.cs
r11171 r12031 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 4Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2015 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
branches/HeuristicLab.DatasetRefactor/sources/HeuristicLab.Core/3.3/Collections/ReadOnlyCheckedItemCollection.cs
r11171 r12031 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 4Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2015 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
branches/HeuristicLab.DatasetRefactor/sources/HeuristicLab.Core/3.3/Collections/ReadOnlyCheckedItemList.cs
r11171 r12031 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 4Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2015 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
branches/HeuristicLab.DatasetRefactor/sources/HeuristicLab.Core/3.3/Collections/ReadOnlyItemArray.cs
r11171 r12031 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 4Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2015 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
branches/HeuristicLab.DatasetRefactor/sources/HeuristicLab.Core/3.3/Collections/ReadOnlyItemCollection.cs
r11171 r12031 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 4Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2015 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
branches/HeuristicLab.DatasetRefactor/sources/HeuristicLab.Core/3.3/Collections/ReadOnlyItemDictionary.cs
r11171 r12031 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 4Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2015 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
branches/HeuristicLab.DatasetRefactor/sources/HeuristicLab.Core/3.3/Collections/ReadOnlyItemList.cs
r11171 r12031 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 4Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2015 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
branches/HeuristicLab.DatasetRefactor/sources/HeuristicLab.Core/3.3/Collections/ReadOnlyItemSet.cs
r11171 r12031 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 4Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2015 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
branches/HeuristicLab.DatasetRefactor/sources/HeuristicLab.Core/3.3/Collections/ReadOnlyKeyedItemCollection.cs
r11171 r12031 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 4Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2015 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
branches/HeuristicLab.DatasetRefactor/sources/HeuristicLab.Core/3.3/Collections/ScopeList.cs
r11171 r12031 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 4Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2015 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
branches/HeuristicLab.DatasetRefactor/sources/HeuristicLab.Core/3.3/Collections/ValueParameterCollection.cs
r11171 r12031 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 4Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2015 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
branches/HeuristicLab.DatasetRefactor/sources/HeuristicLab.Core/3.3/Collections/VariableCollection.cs
r11171 r12031 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 4Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2015 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab.
Note: See TracChangeset
for help on using the changeset viewer.