Changeset 11229 for branches/HeuristicLab.BottomUpTreeDistance/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/DirectedGraph/Arc.cs
- Timestamp:
- 07/29/14 16:20:08 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.BottomUpTreeDistance/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/DirectedGraph/Arc.cs
r11211 r11229 20 20 #endregion 21 21 22 using System; 22 23 using HeuristicLab.Common; 23 24 using HeuristicLab.Core; … … 26 27 namespace HeuristicLab.Problems.DataAnalysis.Symbolic { 27 28 /// <summary> 28 /// An arc that can have a weight, a label, and can old additional information in the Data object29 /// An arc that can have a weight, a label, and a data object for holding additional info 29 30 /// </summary> 30 31 [StorableClass] 31 32 public class Arc : Item, IArc { 32 [Storable] 33 public IVertex Source { get; set; } 33 public event EventHandler Changed; 34 protected virtual void OnChanged(object sender, EventArgs args) { 35 var changed = Changed; 36 if (changed != null) 37 changed(sender, args); 38 } 34 39 35 40 [Storable] 36 public IVertex Target { get;set; }41 public IVertex Source { get; private set; } 37 42 38 43 [Storable] 39 public string Label { get;set; }44 public IVertex Target { get; private set; } 40 45 41 46 [Storable] 42 public double Weight { get; set; } 47 protected string label; 48 public string Label { 49 get { return label; } 50 set { 51 label = value; 52 OnChanged(this, EventArgs.Empty); 53 } 54 } 43 55 44 56 [Storable] 45 public object Data { get; set; } 57 protected double weight; 58 public double Weight { 59 get { return weight; } 60 set { 61 weight = value; 62 OnChanged(this, EventArgs.Empty); 63 } 64 } 65 66 [Storable] 67 protected object data; 68 public object Data { 69 get { return data; } 70 set { 71 data = value; 72 OnChanged(this, EventArgs.Empty); 73 } 74 } 46 75 47 76 [StorableConstructor] 48 77 public Arc(bool deserializing) : base(deserializing) { } 49 50 public override IDeepCloneable Clone(Cloner cloner) {51 return new Arc(this, cloner);52 }53 public Arc() { }54 78 55 79 public Arc(IVertex source, IVertex target) { … … 60 84 protected Arc(Arc original, Cloner cloner) 61 85 : base(original, cloner) { 62 Source = original.Source; 63 Target = original.Target; 64 Label = original.Label; 65 Weight = original.Weight; 66 Data = original.Data; 86 Source = cloner.Clone(original.Source); 87 Target = cloner.Clone(original.Target); 88 label = original.Label; 89 weight = original.Weight; 90 data = original; 91 } 92 93 public override IDeepCloneable Clone(Cloner cloner) { 94 return new Arc(this, cloner); 95 } 96 } 97 98 [StorableClass] 99 public class Arc<T> : Arc, IArc<T> where T : class,IItem { 100 public Arc(bool deserializing) 101 : base(deserializing) { 102 } 103 104 public Arc(IVertex source, IVertex target) 105 : base(source, target) { 106 } 107 108 protected Arc(Arc original, Cloner cloner) 109 : base(original, cloner) { 110 } 111 112 new public IVertex<T> Source { 113 get { return (IVertex<T>)base.Source; } 114 } 115 new public IVertex<T> Target { 116 get { return (IVertex<T>)base.Target; } 67 117 } 68 118 }
Note: See TracChangeset
for help on using the changeset viewer.