Changeset 10897 for branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking/3.4/DirectedGraph/Vertex.cs
- Timestamp:
- 05/27/14 16:33:17 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking/3.4/DirectedGraph/Vertex.cs
r10890 r10897 30 30 [StorableClass] 31 31 public class Vertex : Item, IVertex { 32 public event EventHandler PreContentChanged; 33 protected virtual void OnPreContentChanged(object sender, EventArgs args) { 34 var changed = PreContentChanged; 35 if (changed != null) { 36 changed(sender, args); 37 } 38 } 39 40 public event EventHandler PostContentChanged; 41 protected virtual void OnPostContentChanged(object sender, EventArgs args) { 42 var changed = PostContentChanged; 43 if (changed != null) { 44 changed(sender, args); 45 } 46 } 47 32 48 [Storable] 33 49 private string id; 50 34 51 public string Id { 35 52 get { return id; } 36 set { id = value; }37 53 } 54 38 55 [Storable] 39 p rivate string label;40 public string Label { get { return label; } set { label = value; } } 56 public string Label { get; set; } 57 41 58 [Storable] 42 private double weight; 43 public double Weight { get { return weight; } set { weight = value; } } 59 public double Weight { get; set; } 60 61 [Storable] 62 protected object content; 63 public object Content { 64 get { return content; } 65 set { 66 OnPreContentChanged(this, EventArgs.Empty); 67 content = value; 68 OnPostContentChanged(this, EventArgs.Empty); 69 } 70 } 71 44 72 [Storable] 45 73 private List<IArc> inArcs; … … 48 76 set { inArcs = value.ToList(); } 49 77 } 78 50 79 [Storable] 51 80 private List<IArc> outArcs; … … 54 83 set { outArcs = value.ToList(); } 55 84 } 56 [Storable]57 public object Content { get; set; }58 85 59 86 [StorableConstructor] … … 64 91 } 65 92 93 public Vertex(object content) 94 : this() { 95 this.content = content; 96 } 97 66 98 protected Vertex(Vertex original, Cloner cloner) 67 99 : base(original, cloner) { 68 Id = Guid.NewGuid().ToString(); 100 id = Guid.NewGuid().ToString(); 101 content = original.content; 69 102 Label = original.Label; 103 Weight = original.Weight; 70 104 inArcs = new List<IArc>(original.inArcs); 71 105 outArcs = new List<IArc>(original.outArcs); … … 79 113 protected void AfterDeserialization() { 80 114 if (Id == null) { 81 Id = Guid.NewGuid().ToString();115 id = Guid.NewGuid().ToString(); 82 116 } 83 117 } … … 117 151 protected Vertex(Vertex<T> original, Cloner cloner) 118 152 : base(original, cloner) { 119 Content = original.Content; // not sure if to Clone()120 153 } 121 154
Note: See TracChangeset
for help on using the changeset viewer.