Changeset 885
- Timestamp:
- 12/02/08 14:13:06 (16 years ago)
- Location:
- branches/CloningRefactorBranch
- Files:
-
- 44 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/CloningRefactorBranch/HeuristicLab.Constraints/AllSubOperatorsTypeConstraint.cs
r764 r885 42 42 } 43 43 44 public AllSubOperatorsTypeConstraint() 45 : base() { 44 /// <summary> 45 /// Default constructor for an empty AllSubOperatorsTypeConstraint. 46 /// </summary> 47 public AllSubOperatorsTypeConstraint() { 46 48 groupConstraint = new SubOperatorTypeConstraint(); 49 } 50 /// <summary> 51 /// Copy constructor to create clones (deep). 52 /// </summary> 53 /// <param name="original">The original instance to be cloned.</param> 54 public AllSubOperatorsTypeConstraint(AllSubOperatorsTypeConstraint original) 55 : this(original, new Dictionary<Guid, object>()) { } 56 /// <summary> 57 /// Copy constructor to create clones (deep) reusing already cloned object references. 58 /// </summary> 59 /// <param name="original">The instance to be cloned.</param> 60 /// <param name="clonedObjects">Already cloned objects (for referential integrity).</param> 61 protected AllSubOperatorsTypeConstraint(AllSubOperatorsTypeConstraint original, IDictionary<Guid, object> clonedObjects) 62 : base(original, clonedObjects) { 63 this.groupConstraint = (SubOperatorTypeConstraint)Auxiliary.Clone(original.groupConstraint, clonedObjects); 47 64 } 48 65 … … 59 76 public override bool Check(IItem data) { 60 77 IOperator op = data as IOperator; 61 if (data == null) return false;78 if (data == null) return false; 62 79 63 for (int i = 0; i < op.SubOperators.Count; i++) {80 for (int i = 0; i < op.SubOperators.Count; i++) { 64 81 groupConstraint.SubOperatorIndex.Data = i; 65 if (groupConstraint.Check(data) == false) {82 if (groupConstraint.Check(data) == false) { 66 83 return false; 67 84 } … … 75 92 76 93 public override object Clone(IDictionary<Guid, object> clonedObjects) { 77 AllSubOperatorsTypeConstraint clone = new AllSubOperatorsTypeConstraint(); 78 clonedObjects.Add(Guid, clone); 79 clone.groupConstraint = (SubOperatorTypeConstraint)Auxiliary.Clone(groupConstraint, clonedObjects); 80 return clone; 94 return new AllSubOperatorsTypeConstraint(this); 81 95 } 82 96 -
branches/CloningRefactorBranch/HeuristicLab.Constraints/AndConstraint.cs
r764 r885 44 44 } 45 45 46 /// <summary> 47 /// Default constructor for an empty AndConstraint. 48 /// </summary> 46 49 public AndConstraint() { 47 50 clauses = new ItemList<IConstraint>(); 51 } 52 53 /// <summary> 54 /// Copy constructor to create clones (deep). 55 /// </summary> 56 /// <param name="original">The original instance to be cloned.</param> 57 public AndConstraint(AndConstraint original) : this(original, new Dictionary<Guid, object>()) { } 58 /// <summary> 59 /// Copy constructor to create clones (deep) reusing already cloned object references. 60 /// </summary> 61 /// <param name="original">The instance to be cloned.</param> 62 /// <param name="clonedObjects">Already cloned objects (for referential integrity).</param> 63 protected AndConstraint(AndConstraint original, IDictionary<Guid, object> clonedObjects) 64 : base(original, clonedObjects) { 65 this.Clauses = (ItemList<IConstraint>)Auxiliary.Clone(original.Clauses, clonedObjects); 48 66 } 49 67 … … 60 78 return new AndConstraintView(this); 61 79 } 62 80 /// <summary> 81 /// Uses copy constructor to create a deep clone reusing already cloned object references. 82 /// </summary> 83 /// <param name="clonedObjects">Already cloned objects (for referential integrity).</param> 84 /// <returns></returns> 63 85 public override object Clone(IDictionary<Guid, object> clonedObjects) { 64 AndConstraint clone = new AndConstraint(); 65 clonedObjects.Add(Guid, clone); 66 clone.Clauses = (ItemList<IConstraint>)Auxiliary.Clone(Clauses, clonedObjects); 67 return clone; 86 return new AndConstraint(this, clonedObjects); 68 87 } 69 88 -
branches/CloningRefactorBranch/HeuristicLab.Constraints/ConstraintBase.cs
r764 r885 32 32 } 33 33 34 /// <summary> 35 /// Default constructor 36 /// </summary> 37 protected ConstraintBase() { } 38 39 /// <summary> 40 /// Copy constructor to create clones (deep) reusing already cloned object references. 41 /// </summary> 42 /// <param name="original">The instance to be cloned.</param> 43 /// <param name="clonedObjects">Already cloned objects (for referential integrity).</param> 44 protected ConstraintBase(ConstraintBase original, IDictionary<Guid, object> clonedObjects) 45 : base(original, clonedObjects) { } 46 34 47 public abstract bool Check(IItem data); 35 48 } -
branches/CloningRefactorBranch/HeuristicLab.Constraints/DoubleBoundedConstraint.cs
r764 r885 101 101 } 102 102 103 /// <summary> 104 /// Copy constructor to create clones (deep). 105 /// </summary> 106 /// <param name="original">The original instance to be cloned.</param> 107 public DoubleBoundedConstraint(DoubleBoundedConstraint original) : this(original, new Dictionary<Guid, object>()) { } 108 /// <summary> 109 /// Copy constructor to create clones (deep) reusing already cloned object references. 110 /// </summary> 111 /// <param name="original">The instance to be cloned.</param> 112 /// <param name="clonedObjects">Already cloned objects (for referential integrity).</param> 113 protected DoubleBoundedConstraint(DoubleBoundedConstraint original, IDictionary<Guid, object> clonedObjects) 114 : base(original, clonedObjects) { 115 this.upperBound = original.UpperBound; 116 this.upperBoundIncluded = original.UpperBoundIncluded; 117 this.upperBoundEnabled = original.UpperBoundEnabled; 118 this.lowerBound = original.LowerBound; 119 this.lowerBoundIncluded = original.LowerBoundIncluded; 120 this.lowerBoundEnabled = original.LowerBoundEnabled; 121 } 103 122 104 123 public override bool Check(IItem data) { … … 116 135 } 117 136 137 /// <summary> 138 /// Clones an instance using the copy constructor 139 /// reusing already cloned object references. 140 /// </summary> 141 /// <param name="clonedObjects">Already cloned objects (for referential integrity).</param> 142 /// <returns>A cloned (deep) instance</returns> 118 143 public override object Clone(IDictionary<Guid, object> clonedObjects) { 119 DoubleBoundedConstraint clone = new DoubleBoundedConstraint(); 120 clonedObjects.Add(Guid, clone); 121 clone.upperBound = UpperBound; 122 clone.upperBoundIncluded = UpperBoundIncluded; 123 clone.upperBoundEnabled = UpperBoundEnabled; 124 clone.lowerBound = LowerBound; 125 clone.lowerBoundIncluded = LowerBoundIncluded; 126 clone.lowerBoundEnabled = LowerBoundEnabled; 127 return clone; 144 return new DoubleBoundedConstraint(this, clonedObjects); 128 145 } 129 146 -
branches/CloningRefactorBranch/HeuristicLab.Constraints/FalseConstraint.cs
r764 r885 31 31 get { return "This constraint is always false."; } 32 32 } 33 /// <summary> 34 /// Default constructor. 35 /// </summary> 36 public FalseConstraint() { } 37 /// <summary> 38 /// Copy constructor to create clones (deep). 39 /// </summary> 40 /// <param name="original">The original instance to be cloned.</param> 41 public FalseConstraint(FalseConstraint original) : this(original, new Dictionary<Guid, object>()) { } 42 /// <summary> 43 /// Copy constructor to create clones (deep) reusing already cloned object references. 44 /// </summary> 45 /// <param name="original">The instance to be cloned.</param> 46 /// <param name="clonedObjects">Already cloned objects (for referential integrity).</param> 47 protected FalseConstraint(FalseConstraint original, IDictionary<Guid, object> clonedObjects) 48 : base(original, clonedObjects) { } 33 49 34 50 public override IView CreateView() { … … 36 52 } 37 53 54 /// <summary> 55 /// Clones an instance using the copy constructor 56 /// reusing already cloned object references. 57 /// </summary> 58 /// <param name="clonedObjects">Already cloned objects (for referential integrity).</param> 59 /// <returns>A cloned (deep) instance</returns> 38 60 public override object Clone(IDictionary<Guid, object> clonedObjects) { 39 FalseConstraint clone = new FalseConstraint(); 40 clonedObjects.Add(Guid, clone); 41 return clone; 61 return new FalseConstraint(this, clonedObjects); 42 62 } 43 63 -
branches/CloningRefactorBranch/HeuristicLab.Constraints/IntBoundedConstraint.cs
r764 r885 86 86 } 87 87 88 public IntBoundedConstraint(int low, int high) : base() { 88 public IntBoundedConstraint(int low, int high) 89 : base() { 89 90 lowerBound = low; 90 91 lowerBoundIncluded = false; … … 93 94 upperBoundIncluded = false; 94 95 upperBoundEnabled = true; 96 } 97 /// <summary> 98 /// Copy constructor to create clones (deep). 99 /// </summary> 100 /// <param name="original">The original instance to be cloned.</param> 101 public IntBoundedConstraint(IntBoundedConstraint original) : this(original, new Dictionary<Guid, object>()) { } 102 /// <summary> 103 /// Copy constructor to create clones (deep) reusing already cloned object references. 104 /// </summary> 105 /// <param name="original">The instance to be cloned.</param> 106 /// <param name="clonedObjects">Already cloned objects (for referential integrity).</param> 107 protected IntBoundedConstraint(IntBoundedConstraint original, IDictionary<Guid, object> clonedObjects) 108 : base(original, clonedObjects) { 109 this.upperBound = original.UpperBound; 110 this.upperBoundIncluded = original.UpperBoundIncluded; 111 this.upperBoundEnabled = original.UpperBoundEnabled; 112 this.lowerBound = original.LowerBound; 113 this.lowerBoundIncluded = original.LowerBoundIncluded; 114 this.lowerBoundEnabled = original.LowerBoundEnabled; 95 115 } 96 116 … … 109 129 } 110 130 131 /// <summary> 132 /// Clones an instance using the copy constructor 133 /// reusing already cloned object references. 134 /// </summary> 135 /// <param name="clonedObjects">Already cloned objects (for referential integrity).</param> 136 /// <returns>A cloned (deep) instance</returns> 111 137 public override object Clone(IDictionary<Guid, object> clonedObjects) { 112 IntBoundedConstraint clone = new IntBoundedConstraint(); 113 clonedObjects.Add(Guid, clone); 114 clone.upperBound = UpperBound; 115 clone.upperBoundIncluded = UpperBoundIncluded; 116 clone.upperBoundEnabled = UpperBoundEnabled; 117 clone.lowerBound = LowerBound; 118 clone.lowerBoundIncluded = LowerBoundIncluded; 119 clone.lowerBoundEnabled = LowerBoundEnabled; 120 return clone; 138 return new IntBoundedConstraint(this, clonedObjects); 121 139 } 122 140 -
branches/CloningRefactorBranch/HeuristicLab.Constraints/IsIntegerConstraint.cs
r764 r885 27 27 28 28 namespace HeuristicLab.Constraints { 29 public class IsIntegerConstraint : ConstraintBase {29 public class IsIntegerConstraint : ConstraintBase { 30 30 public override string Description { 31 31 get { return "Allows only integer values."; } 32 32 } 33 /// <summary> 34 /// Default constructor. 35 /// </summary> 36 public IsIntegerConstraint() { } 37 38 /// <summary> 39 /// Copy constructor to create clones (deep). 40 /// </summary> 41 /// <param name="original">The original instance to be cloned.</param> 42 public IsIntegerConstraint(IsIntegerConstraint original) : this(original, new Dictionary<Guid, object>()) { } 43 /// <summary> 44 /// Copy constructor to create clones (deep) reusing already cloned object references. 45 /// </summary> 46 /// <param name="original">The instance to be cloned.</param> 47 /// <param name="clonedObjects">Already cloned objects (for referential integrity).</param> 48 protected IsIntegerConstraint(IsIntegerConstraint original, IDictionary<Guid, object> clonedObjects) 49 : base(original, clonedObjects) { } 33 50 34 51 public override bool Check(IItem item) { 35 52 // ConstrainedIntData is always integer => just return true 36 if (item is ConstrainedIntData)53 if (item is ConstrainedIntData) 37 54 return true; 38 55 39 56 // if we have an item of ConstrainedDoubleData then we check if it is integer or not 40 if (item is ConstrainedDoubleData) {57 if (item is ConstrainedDoubleData) { 41 58 ConstrainedDoubleData d = (ConstrainedDoubleData)item; 42 if (d.Data == Math.Truncate(d.Data)) {59 if (d.Data == Math.Truncate(d.Data)) { 43 60 return true; 44 61 } else { … … 50 67 return false; 51 68 } 69 70 /// <summary> 71 /// Clones an instance using the copy constructor 72 /// reusing already cloned object references. 73 /// </summary> 74 /// <param name="clonedObjects">Already cloned objects (for referential integrity).</param> 75 /// <returns>A cloned (deep) instance</returns> 76 public override object Clone(IDictionary<Guid, object> clonedObjects) { 77 return new IsIntegerConstraint(this, clonedObjects); 78 } 52 79 } 53 80 } -
branches/CloningRefactorBranch/HeuristicLab.Constraints/ItemTypeConstraint.cs
r764 r885 53 53 } 54 54 55 /// <summary> 56 /// Copy constructor to create clones (deep). 57 /// </summary> 58 /// <param name="original">The original instance to be cloned.</param> 59 public ItemTypeConstraint(ItemTypeConstraint original) : this(original, new Dictionary<Guid, object>()) { } 60 61 /// <summary> 62 /// Copy constructor to create clones (deep) reusing already cloned object references. 63 /// </summary> 64 /// <param name="original">The instance to be cloned.</param> 65 /// <param name="clonedObjects">Already cloned objects (for referential integrity).</param> 66 protected ItemTypeConstraint(ItemTypeConstraint original, IDictionary<Guid, object> clonedObjects) 67 : base(original, clonedObjects) { } 68 55 69 public override bool Check(IItem data) { 56 70 ConstrainedItemList list = (data as ConstrainedItemList); … … 68 82 69 83 #region clone & persistence 84 /// <summary> 85 /// Clones an instance using the copy constructor 86 /// reusing already cloned object references. 87 /// </summary> 88 /// <param name="clonedObjects">Already cloned objects (for referential integrity).</param> 89 /// <returns>A cloned (deep) instance</returns> 70 90 public override object Clone(IDictionary<Guid, object> clonedObjects) { 71 ItemTypeConstraint clone = new ItemTypeConstraint(type); 72 clonedObjects.Add(Guid, clone); 73 return clone; 91 return new ItemTypeConstraint(this, clonedObjects); 74 92 } 75 93 -
branches/CloningRefactorBranch/HeuristicLab.Constraints/NotConstraint.cs
r764 r885 47 47 } 48 48 49 /// <summary> 50 /// Copy constructor to create clones (deep). 51 /// </summary> 52 /// <param name="original">The original instance to be cloned.</param> 53 public NotConstraint(NotConstraint original) : this(original, new Dictionary<Guid, object>()) { } 54 /// <summary> 55 /// Copy constructor to create clones (deep) reusing already cloned object references. 56 /// </summary> 57 /// <param name="original">The instance to be cloned.</param> 58 /// <param name="clonedObjects">Already cloned objects (for referential integrity).</param> 59 protected NotConstraint(NotConstraint original, IDictionary<Guid, object> clonedObjects) 60 : base(original, clonedObjects) { 61 this.subConstraint = (ConstraintBase)Auxiliary.Clone(original.SubConstraint, clonedObjects); 62 } 63 49 64 public override bool Check(IItem data) { 50 65 return !subConstraint.Check(data); … … 55 70 } 56 71 72 /// <summary> 73 /// Clones an instance using the copy constructor 74 /// reusing already cloned object references. 75 /// </summary> 76 /// <param name="clonedObjects">Already cloned objects (for referential integrity).</param> 77 /// <returns>A cloned (deep) instance</returns> 57 78 public override object Clone(IDictionary<Guid, object> clonedObjects) { 58 NotConstraint clone = new NotConstraint(); 59 clonedObjects.Add(Guid, clone); 60 clone.SubConstraint = (ConstraintBase)SubConstraint.Clone(); 61 return clone; 79 return new NotConstraint(this, clonedObjects); 62 80 } 63 81 -
branches/CloningRefactorBranch/HeuristicLab.Constraints/NumberOfSubOperatorsConstraint.cs
r764 r885 54 54 } 55 55 56 /// <summary> 57 /// Copy constructor to create clones (deep). 58 /// </summary> 59 /// <param name="original">The original instance to be cloned.</param> 60 public NumberOfSubOperatorsConstraint(NumberOfSubOperatorsConstraint original) 61 : this(original, new Dictionary<Guid, object>()) { } 62 63 /// <summary> 64 /// Copy constructor to create clones (deep) reusing already cloned object references. 65 /// </summary> 66 /// <param name="original">The instance to be cloned.</param> 67 /// <param name="clonedObjects">Already cloned objects (for referential integrity).</param> 68 protected NumberOfSubOperatorsConstraint(NumberOfSubOperatorsConstraint original, IDictionary<Guid, object> clonedObjects) 69 : base(original, clonedObjects) { 70 this.maxOperators.Data = original.maxOperators.Data; 71 this.minOperators.Data = original.minOperators.Data; 72 } 73 56 74 public override bool Check(IItem data) { 57 75 IOperator op = data as IOperator; … … 61 79 } 62 80 81 /// <summary> 82 /// Clones an instance using the copy constructor 83 /// reusing already cloned object references. 84 /// </summary> 85 /// <param name="clonedObjects">Already cloned objects (for referential integrity).</param> 86 /// <returns>A cloned (deep) instance</returns> 63 87 public override object Clone(IDictionary<Guid, object> clonedObjects) { 64 NumberOfSubOperatorsConstraint clone = new NumberOfSubOperatorsConstraint(); 65 clonedObjects.Add(Guid, clone); 66 clone.maxOperators.Data = maxOperators.Data; 67 clone.minOperators.Data = minOperators.Data; 68 return clone; 88 return new NumberOfSubOperatorsConstraint(this, clonedObjects); 69 89 } 70 90 -
branches/CloningRefactorBranch/HeuristicLab.Constraints/OrConstraint.cs
r764 r885 48 48 } 49 49 50 /// <summary> 51 /// Copy constructor to create clones (deep). 52 /// </summary> 53 /// <param name="original">The original instance to be cloned.</param> 54 public OrConstraint(OrConstraint original) : this(original, new Dictionary<Guid, object>()) { } 55 /// <summary> 56 /// Copy constructor to create clones (deep) reusing already cloned object references. 57 /// </summary> 58 /// <param name="original">The instance to be cloned.</param> 59 /// <param name="clonedObjects">Already cloned objects (for referential integrity).</param> 60 protected OrConstraint(OrConstraint original, IDictionary<Guid, object> clonedObjects) 61 : base(original, clonedObjects) { 62 this.Clauses = (ItemList<IConstraint>)Auxiliary.Clone(original.Clauses, clonedObjects); 63 } 64 50 65 public override bool Check(IItem data) { 51 66 bool result = false; 52 for (int i = 0 ; i < clauses.Count; i++) {67 for (int i = 0; i < clauses.Count; i++) { 53 68 result = clauses[i].Check(data); 54 69 if (result) return true; … … 61 76 } 62 77 78 /// <summary> 79 /// Clones an instance using the copy constructor 80 /// reusing already cloned object references. 81 /// </summary> 82 /// <param name="clonedObjects">Already cloned objects (for referential integrity).</param> 83 /// <returns>A cloned (deep) instance</returns> 63 84 public override object Clone(IDictionary<Guid, object> clonedObjects) { 64 OrConstraint clone = new OrConstraint(); 65 clonedObjects.Add(Guid, clone); 66 clone.Clauses = (ItemList<IConstraint>)Auxiliary.Clone(Clauses, clonedObjects); 67 return clone; 85 return new OrConstraint(this, clonedObjects); 68 86 } 69 87 70 88 #region persistence 71 public override XmlNode GetXmlNode(string name, XmlDocument document, IDictionary<Guid, IStorable> persistedObjects) {89 public override XmlNode GetXmlNode(string name, XmlDocument document, IDictionary<Guid, IStorable> persistedObjects) { 72 90 XmlNode node = base.GetXmlNode(name, document, persistedObjects); 73 91 XmlNode clausesNode = PersistenceManager.Persist("Clauses", Clauses, document, persistedObjects); … … 77 95 } 78 96 79 public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) {97 public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) { 80 98 base.Populate(node, restoredObjects); 81 99 clauses = (ItemList<IConstraint>)PersistenceManager.Restore(node.SelectSingleNode("Clauses"), restoredObjects); -
branches/CloningRefactorBranch/HeuristicLab.Constraints/SubOperatorsTypeConstraint.cs
r764 r885 52 52 } 53 53 54 public SubOperatorTypeConstraint(int index) : base() { 54 public SubOperatorTypeConstraint(int index) 55 : base() { 55 56 subOperatorIndex = new IntData(index); 56 57 subOperators = new List<IOperator>(); 57 58 } 58 59 60 /// Copy constructor to create clones (deep). 61 /// </summary> 62 /// <param name="original">The original instance to be cloned.</param> 63 public SubOperatorTypeConstraint(SubOperatorTypeConstraint original) : this(original, new Dictionary<Guid, object>()) { } 64 65 /// <summary> 66 /// Copy constructor to create clones (deep) reusing already cloned object references. 67 /// </summary> 68 /// <param name="original">The instance to be cloned.</param> 69 /// <param name="clonedObjects">Already cloned objects (for referential integrity).</param> 70 /// <summary> 71 protected SubOperatorTypeConstraint(SubOperatorTypeConstraint original, IDictionary<Guid, object> clonedObjects) 72 : base(original, clonedObjects) { 73 this.subOperatorIndex.Data = original.subOperatorIndex.Data; 74 foreach (IOperator op in original.subOperators) { 75 this.AddOperator((IOperator)Auxiliary.Clone(op, clonedObjects)); 76 } 77 } 78 59 79 public void AddOperator(IOperator op) { 60 if (!subOperators.Contains(op)) {80 if (!subOperators.Contains(op)) { 61 81 subOperators.Add(op); 62 82 FireChanged(); … … 65 85 66 86 public void RemoveOperator(IOperator op) { 67 if (subOperators.Contains(op)) {87 if (subOperators.Contains(op)) { 68 88 subOperators.Remove(op); 69 89 FireChanged(); … … 77 97 public override bool Check(IItem data) { 78 98 IOperator op = data as IOperator; 79 if (data == null) return false;99 if (data == null) return false; 80 100 81 if (op.SubOperators.Count <= subOperatorIndex.Data) {101 if (op.SubOperators.Count <= subOperatorIndex.Data) { 82 102 return false; 83 103 } … … 85 105 } 86 106 107 /// <summary> 108 /// Clones an instance using the copy constructor 109 /// reusing already cloned object references. 110 /// </summary> 111 /// <param name="clonedObjects">Already cloned objects (for referential integrity).</param> 112 /// <returns>A cloned (deep) instance</returns> 87 113 public override object Clone(IDictionary<Guid, object> clonedObjects) { 88 SubOperatorTypeConstraint clone = new SubOperatorTypeConstraint(); 89 clonedObjects.Add(Guid, clone); 90 clone.subOperatorIndex.Data = subOperatorIndex.Data; 91 foreach(IOperator op in subOperators) { 92 clone.AddOperator((IOperator)Auxiliary.Clone(op, clonedObjects)); 93 } 94 return clone; 114 return new SubOperatorTypeConstraint(this, clonedObjects); 95 115 } 96 116 … … 105 125 node.AppendChild(indexNode); 106 126 XmlNode listNode = document.CreateNode(XmlNodeType.Element, "AllowedSubOperators", document.NamespaceURI); 107 foreach (IOperator op in subOperators) {127 foreach (IOperator op in subOperators) { 108 128 XmlNode opNode = PersistenceManager.Persist(op, document, persistedObjects); 109 129 listNode.AppendChild(opNode); … … 117 137 subOperatorIndex = (IntData)PersistenceManager.Restore(node.SelectSingleNode("SubOperatorIndex"), restoredObjects); 118 138 subOperators = new List<IOperator>(); 119 foreach (XmlNode childNode in node.SelectSingleNode("AllowedSubOperators").ChildNodes) {139 foreach (XmlNode childNode in node.SelectSingleNode("AllowedSubOperators").ChildNodes) { 120 140 subOperators.Add((IOperator)PersistenceManager.Restore(childNode, restoredObjects)); 121 141 } -
branches/CloningRefactorBranch/HeuristicLab.Constraints/TrueConstraint.cs
r764 r885 31 31 get { return "This constraint is always true."; } 32 32 } 33 /// <summary> 34 /// Default constructor. 35 /// </summary> 36 public TrueConstraint() { } 37 /// <summary> 38 /// Copy constructor to create clones (deep). 39 /// </summary> 40 /// <param name="original">The original instance to be cloned.</param> 41 public TrueConstraint(TrueConstraint original) : this(original, new Dictionary<Guid, object>()) { } 42 /// <summary> 43 /// Copy constructor to create clones (deep) reusing already cloned object references. 44 /// </summary> 45 /// <param name="original">The instance to be cloned.</param> 46 /// <param name="clonedObjects">Already cloned objects (for referential integrity).</param> 47 protected TrueConstraint(TrueConstraint original, IDictionary<Guid, object> clonedObjects) 48 : base(original, clonedObjects) { } 33 49 34 50 public override IView CreateView() { … … 36 52 } 37 53 54 /// <summary> 55 /// Clones an instance using the copy constructor 56 /// reusing already cloned object references. 57 /// </summary> 58 /// <param name="clonedObjects">Already cloned objects (for referential integrity).</param> 59 /// <returns>A cloned (deep) instance</returns> 38 60 public override object Clone(IDictionary<Guid, object> clonedObjects) { 39 TrueConstraint clone = new TrueConstraint(); 40 clonedObjects.Add(Guid, clone); 41 return clone; 61 return new TrueConstraint(); 42 62 } 43 63 -
branches/CloningRefactorBranch/HeuristicLab.Constraints/VariableComparisonConstraint.cs
r175 r885 59 59 } 60 60 61 /// <summary> 62 /// Copy constructor to create clones (deep). 63 /// </summary> 64 /// <param name="original">The original instance to be cloned.</param> 65 public VariableComparisonConstraint(VariableComparisonConstraint original) 66 : this(original, new Dictionary<Guid, object>()) { } 67 68 /// <summary> 69 /// Copy constructor to create clones (deep) reusing already cloned object references. 70 /// </summary> 71 /// <param name="original">The instance to be cloned.</param> 72 /// <param name="clonedObjects">Already cloned objects (for referential integrity).</param> 73 protected VariableComparisonConstraint(VariableComparisonConstraint original, IDictionary<Guid, object> clonedObjects) 74 : base(original, clonedObjects) { 75 this.LeftVarName = (StringData)Auxiliary.Clone(original.LeftVarName, clonedObjects); 76 this.RightVarName = (StringData)Auxiliary.Clone(original.RightVarName, clonedObjects); 77 this.Comparer = (IntData)Auxiliary.Clone(original.Comparer, clonedObjects); 78 } 79 61 80 public override bool Check(IItem data) { 62 81 ConstrainedItemList list = (data as ConstrainedItemList); … … 97 116 98 117 #region clone & persistence 118 /// <summary> 119 /// Clones an instance using the copy constructor 120 /// reusing already cloned object references. 121 /// </summary> 122 /// <param name="clonedObjects">Already cloned objects (for referential integrity).</param> 123 /// <returns>A cloned (deep) instance</returns> 99 124 public override object Clone(IDictionary<Guid, object> clonedObjects) { 100 VariableComparisonConstraint clone = new VariableComparisonConstraint(); 101 clonedObjects.Add(Guid, clone); 102 clone.LeftVarName = (StringData)Auxiliary.Clone(LeftVarName, clonedObjects); 103 clone.RightVarName = (StringData)Auxiliary.Clone(RightVarName, clonedObjects); 104 clone.Comparer = (IntData)Auxiliary.Clone(Comparer, clonedObjects); 105 return clone; 125 return new VariableComparisonConstraint(this, clonedObjects); 106 126 } 107 127 -
branches/CloningRefactorBranch/HeuristicLab.Core/AtomicOperation.cs
r836 r885 62 62 63 63 /// <summary> 64 /// Copy constructor to create a deep clone of an AtomicOperation instance. 65 /// <remarks>Calls <see cref="AtomicOperation(AtomicOperation original, 66 /// IDictionary<Guid, object> clonedObjects)"/></remarks> with an initially 67 /// empty dictionary of cloned objects to create the clone. 68 /// </summary> 69 /// <param name="original">The original instance to be cloned.</param> 70 public AtomicOperation(AtomicOperation original) : this(original, new Dictionary<Guid, object>()) { } 71 72 /// <summary> 73 /// Copy constructor to create a deep clone of an AtomicOperation instance 74 /// automatically reusing references of already cloned objects. 75 /// </summary> 76 /// <param name="original">The original instance to be cloned</param> 77 /// <param name="clonedObjects">Already cloned object references</param> 78 protected AtomicOperation(AtomicOperation original, IDictionary<Guid, object> clonedObjects) 79 : base(original, clonedObjects) { 80 this.myOperator = (IOperator)Auxiliary.Clone(original.Operator, clonedObjects); 81 this.myScope = (IScope)Auxiliary.Clone(original.Scope, clonedObjects); 82 } 83 84 /// <summary> 64 85 /// Clones the current instance. 65 86 /// </summary> 66 /// <remarks>The operator and the scope objects are cloned with the 67 /// <see cref="HeuristicLab.Core.Auxiliary.Clone"/> method of the <see cref="Auxiliary"/> class.</remarks> 68 /// <param name="clonedObjects">All already cloned objects. (Needed to avoid cycles.)</param> 87 /// <remarks>The operator and the scope objects are cloned with the copy constructor 88 /// <see cref="HeuristicLab.Core.AtomicOperation(AtomicOperation original, IDictionary<Guid, object> clonedObjects"/> 89 /// copy constructor.</remarks> 90 /// <param name="clonedObjects">All already cloned objects. (Needed for referential integrity)</param> 69 91 /// <returns>The cloned object as <see cref="AtomicOperation"/>.</returns> 70 92 public override object Clone(IDictionary<Guid, object> clonedObjects) { 71 AtomicOperation clone = new AtomicOperation(); 72 clonedObjects.Add(Guid, clone); 73 clone.myOperator = (IOperator)Auxiliary.Clone(Operator, clonedObjects); 74 clone.myScope = (IScope)Auxiliary.Clone(Scope, clonedObjects); 75 return clone; 93 return new AtomicOperation(this, clonedObjects); 76 94 } 77 95 -
branches/CloningRefactorBranch/HeuristicLab.Core/CompositeOperation.cs
r776 r885 59 59 60 60 /// <summary> 61 /// Copy constructor to create a deep clone of a CompositeOperation instance. 62 /// <remarks>Calls <see cref="CompositeOperation(CompositeOperation original, 63 /// IDictionary<Guid, object> clonedObjects)"/></remarks> with an initially 64 /// empty dictionary of cloned objects to create the clone. 65 /// </summary> 66 /// <param name="original">The original instance to be cloned.</param> 67 public CompositeOperation(CompositeOperation original) : this(original, new Dictionary<Guid, object>()) { } 68 69 /// <summary> 70 /// Copy constructor to create a deep clone of a CompositeOperation instance 71 /// automatically reusing references of already cloned objects. 72 /// </summary> 73 /// <param name="original">The original instance to be cloned</param> 74 /// <param name="clonedObjects">Already cloned object references</param> 75 protected CompositeOperation(CompositeOperation original, IDictionary<Guid, object> clonedObjects) 76 : base(original, clonedObjects) { 77 this.myExecuteInParallel = original.ExecuteInParallel; 78 for (int i = 0; i < original.Operations.Count; i++) 79 this.AddOperation((IOperation)Auxiliary.Clone(original.Operations[i], clonedObjects)); 80 } 81 82 /// <summary> 61 83 /// Adds an operation to the current list of operations. 62 84 /// </summary> … … 77 99 /// </summary> 78 100 /// <remarks>All operations of the current instance are cloned, too (deep clone), with the 79 /// <see cref="HeuristicLab.Core.Auxiliary.Clone"/> method of the class <see cref="Auxiliary"/>.</remarks> 80 /// <param name="clonedObjects">A dictionary of all already cloned objects. (Needed to avoid cycles.)</param> 101 /// copy consturctor <see cref="HeuristicLab.Core.CompositeOperation( 102 /// CompositeOperation original, IDictionary<Guid, object> clonedObjects)"/>.</remarks> 103 /// <param name="clonedObjects">A dictionary of all already cloned objects. (Needed for referential integrity.)</param> 81 104 /// <returns>The cloned operation as <see cref="CompositeOperation"/>.</returns> 82 105 public override object Clone(IDictionary<Guid, object> clonedObjects) { 83 CompositeOperation clone = new CompositeOperation(); 84 clonedObjects.Add(Guid, clone); 85 clone.myExecuteInParallel = ExecuteInParallel; 86 for (int i = 0; i < Operations.Count; i++) 87 clone.AddOperation((IOperation)Auxiliary.Clone(Operations[i], clonedObjects)); 88 return clone; 106 return new CompositeOperation(this, clonedObjects); 89 107 } 90 108 -
branches/CloningRefactorBranch/HeuristicLab.Core/EngineBase.cs
r836 r885 118 118 119 119 /// <summary> 120 /// Copy constructor. 121 /// </summary> 122 /// <param name="original"></param> 123 /// <param name="clonedObjects"></param> 120 /// Copy constructor to create a deep clone of an EngineBase instance. 121 /// </summary> 122 /// <remarks>Calls the copy constructor of the base class <see cref="ItemBase"/> 123 /// and <see cref="Auxiliary.Clone"/> to clone contained objects</remarks> 124 /// <param name="original">The instance to be cloned.</param> 125 /// <param name="clonedObjects">Already cloned object references</param> 124 126 protected EngineBase(EngineBase original, IDictionary<Guid, object> clonedObjects) 125 127 : base(original, clonedObjects) { … … 133 135 this.myRunning = original.Running; 134 136 this.myCanceled = original.Canceled; 135 }136 137 /// <summary>138 /// Clones the current instance (deep clone).139 /// </summary>140 /// <remarks>Deep clone through <see cref="Auxiliary.Clone"/> method of helper class141 /// <see cref="Auxiliary"/>.</remarks>142 /// <param name="clonedObjects">Dictionary of all already clone objects. (Needed to avoid cycles.)</param>143 /// <returns>The cloned object as <see cref="EngineBase"/>.</returns>144 public override object Clone(IDictionary<Guid, object> clonedObjects) {145 return new EngineBase(this, clonedObjects);146 137 } 147 138 -
branches/CloningRefactorBranch/HeuristicLab.Core/OperatorBase.cs
r836 r885 105 105 106 106 /// <summary> 107 /// Copy constructor 108 /// </summary> 109 /// <param name="original"> </param>110 /// <param name="clonedObjects"> </param>107 /// Copy constructor. 108 /// </summary> 109 /// <param name="original">The original instance to be cloned</param> 110 /// <param name="clonedObjects">Already cloned objects (for referential integrity).</param> 111 111 protected OperatorBase(OperatorBase original, IDictionary<Guid, object> clonedObjects) 112 112 : base(original, clonedObjects) { -
branches/CloningRefactorBranch/HeuristicLab.Core/OperatorGraph.cs
r776 r885 60 60 61 61 /// <summary> 62 /// Copy constructor to create a deep clone of an OperatorGraph instance. 63 /// </summary> 64 /// <param name="original">The original instance to be cloned.</param> 65 public OperatorGraph(OperatorGraph original) : this(original, new Dictionary<Guid, object>()) { } 66 67 /// <summary> 68 /// Copy constructor to create a deep clone of an OperatorGraph instance 69 /// reusing already cloned objects. 70 /// </summary> 71 /// <param name="original">The original instance to be cloned</param> 72 /// <param name="clonedObjects">Already cloned objects (for referential integrity).</param> 73 protected OperatorGraph(OperatorGraph original, IDictionary<Guid, object> clonedObjects) 74 : base(original, clonedObjects) { 75 foreach (IOperator op in original.Operators) 76 this.AddOperator((IOperator)Auxiliary.Clone(op, clonedObjects)); 77 if (original.InitialOperator != null) 78 this.myInitialOperator = (IOperator)Auxiliary.Clone(original.InitialOperator, clonedObjects); 79 } 80 81 /// <summary> 62 82 /// Creates a new instance of <see cref="OperatorGraphView"/> to represent the current instance 63 83 /// visually. … … 71 91 /// Clones the current instance (deep clone). 72 92 /// </summary> 73 /// <remarks>Deep clone through <see cref="Auxiliary.Clone"/> method of helper class 74 /// <see cref="Auxiliary"/>.</remarks> 93 /// <remarks>Deep clone using the copy constructor.</remarks> 75 94 /// <param name="clonedObjects">Dictionary of all already cloned objects. (Needed to avoid cycles.)</param> 76 95 /// <returns>The cloned object as <see cref="OperatorGraph"/>.</returns> 77 96 public override object Clone(IDictionary<Guid, object> clonedObjects) { 78 OperatorGraph clone = new OperatorGraph(); 79 clonedObjects.Add(Guid, clone); 80 foreach (IOperator op in Operators) 81 clone.AddOperator((IOperator)Auxiliary.Clone(op, clonedObjects)); 82 if (InitialOperator != null) 83 clone.myInitialOperator = (IOperator)Auxiliary.Clone(InitialOperator, clonedObjects); 84 return clone; 97 return new OperatorGraph(this, clonedObjects); 85 98 } 86 99 … … 179 192 /// (Needed to avoid cycles.)</param> 180 193 /// <returns>The saved <see cref="XmlNode"/>.</returns> 181 public override XmlNode GetXmlNode(string name, XmlDocument document, IDictionary<Guid, IStorable> persistedObjects) {194 public override XmlNode GetXmlNode(string name, XmlDocument document, IDictionary<Guid, IStorable> persistedObjects) { 182 195 XmlNode node = base.GetXmlNode(name, document, persistedObjects); 183 196 XmlNode ops = document.CreateNode(XmlNodeType.Element, "Operators", null); … … 197 210 /// <param name="restoredObjects">The dictionary of all already restored objects. 198 211 /// (Needed to avoid cycles.)</param> 199 public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) {212 public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) { 200 213 base.Populate(node, restoredObjects); 201 214 -
branches/CloningRefactorBranch/HeuristicLab.Core/OperatorGroup.cs
r836 r885 71 71 72 72 /// <summary> 73 /// Copy constructor for deep cloning 74 /// </summary> 75 /// <param name="original"></param> 76 /// <param name="clonedObjects"></param> 73 /// Copy constructor to create a deep clone of an OperatorGroup instance. 74 /// </summary> 75 /// <param name="original">The instance to be cloned.</param> 76 public OperatorGroup(OperatorGroup original) : this(original, new Dictionary<Guid, object>()) {} 77 78 /// <summary> 79 /// Copy constructor to create a deep clone of an OperatorGroup instance reusing 80 /// already cloned object references. 81 /// </summary> 82 /// <param name="original">The original instance to be cloned</param> 83 /// <param name="clonedObjects">Already cloned objects (for referential integrity).</param> 77 84 protected OperatorGroup(OperatorGroup original, IDictionary<Guid, object> clonedObjects) : base(original, clonedObjects) { 78 85 this.myName = original.myName; … … 88 95 /// Clones the current instance (deep clone). 89 96 /// </summary> 90 /// <remarks>Deep clone with <see cref="Auxiliary.Clone"/> method of helper class 91 /// <see cref="Auxiliary"/>.</remarks> 92 /// <param name="clonedObjects">Dictionary of all already cloned objects. (Needed to avoid cycles.)</param> 97 /// <remarks>Uses copy constructor to create the deep clone.</remarks> 98 /// <param name="clonedObjects">Dictionary of all already cloned objects. (Needed for referential integrity.)</param> 93 99 /// <returns>The cloned object as <see cref="OperatorGroup"/>.</returns> 94 100 public override object Clone(IDictionary<Guid, object> clonedObjects) { 95 OperatorGroup clone = new OperatorGroup(this, clonedObjects); 96 return clone; 101 return new OperatorGroup(this, clonedObjects); 97 102 } 98 103 -
branches/CloningRefactorBranch/HeuristicLab.Core/OperatorLibrary.cs
r776 r885 46 46 47 47 /// <summary> 48 /// Copy constructor to create a deep clone of an OperatorLibrary instance. 49 /// </summary> 50 /// <param name="original">The instance to be cloned.</param> 51 public OperatorLibrary(OperatorLibrary original) : this(original, new Dictionary<Guid, object>()) { } 52 53 /// <summary> 54 /// Copy constructor to create a deep clone of an OperatorLibrary instance reusing 55 /// already cloned object references. 56 /// </summary> 57 /// <param name="original">The original instance to be cloned</param> 58 /// <param name="clonedObjects">Already cloned objects (for referential integrity).</param> 59 protected OperatorLibrary(OperatorLibrary original, IDictionary<Guid, object> clonedObjects) 60 : base(original, clonedObjects) { 61 this.myGroup = (IOperatorGroup)Auxiliary.Clone(original.Group, clonedObjects); 62 } 63 64 /// <summary> 48 65 /// Creates a new instance of <see cref="OperatorLibraryEditor"/> to display the current instance. 49 66 /// </summary> … … 63 80 /// Clones the current instance (deep clone). 64 81 /// </summary> 65 /// <remarks>Deep clone through <see cref="Auxiliary.Clone"/> method of helper class 66 /// <see cref="Auxiliary"/>.</remarks> 67 /// <param name="clonedObjects">Dictionary of all already cloned objects. (Needed to avoid cycles.)</param> 82 /// <remarks>Deep clone through the copy constructor.</remarks> 83 /// <param name="clonedObjects">Dictionary of all already cloned objects. (Needed for referential integrity.)</param> 68 84 /// <returns>The cloned object as <see cref="OperatorLibrary"/>.</returns> 69 85 public override object Clone(IDictionary<Guid, object> clonedObjects) { 70 OperatorLibrary clone = new OperatorLibrary(); 71 clonedObjects.Add(Guid, clone); 72 clone.myGroup = (IOperatorGroup)Auxiliary.Clone(Group, clonedObjects); 73 return clone; 86 return new OperatorLibrary(this, clonedObjects); 74 87 } 75 88 -
branches/CloningRefactorBranch/HeuristicLab.Core/Scope.cs
r836 r885 78 78 79 79 /// <summary> 80 /// Copy constructor to c reate deep clones.80 /// Copy constructor to clone (deep) a Scope instance. 81 81 /// </summary> 82 82 /// <param name="original"></param> 83 /// <param name="clonedObjects"></param> 83 public Scope(Scope original) : this(original, new Dictionary<Guid, object>()) { } 84 85 /// <summary> 86 /// Copy constructor to clone (deep) a Scope instance reusing 87 /// already cloned object references. 88 /// </summary> 89 /// <param name="original">The original instance to be cloned.</param> 90 /// <param name="clonedObjects">Already cloned object references (for referential integrity).</param> 84 91 protected Scope(Scope original, IDictionary<Guid, object> clonedObjects) 85 92 : base(original, clonedObjects) { -
branches/CloningRefactorBranch/HeuristicLab.Core/Variable.cs
r801 r885 79 79 } 80 80 81 /// <summary> 82 /// Copy constructor to deep clone Variable instances. 83 /// </summary> 84 /// <param name="original">The instance to be cloned.</param> 85 public Variable(Variable original) : this(original, new Dictionary<Guid, object>()) { } 86 87 /// <summary> 88 /// Copy constructor to deep clone Variable instances reusing 89 /// already cloned object references. 90 /// </summary> 91 /// <param name="original">The instance to be cloned.</param> 92 /// <param name="clonedObjects">Already cloned objects (for referential integrity).</param> 93 protected Variable(Variable original, IDictionary<Guid, object> clonedObjects) 94 : base(original, clonedObjects) { 95 this.myName = original.Name; 96 if (original.Value != null) 97 this.myValue = (IItem)Auxiliary.Clone(original.Value, clonedObjects); 98 } 99 81 100 /// <inheritdoc cref="IVariable.GetValue<T>"/> 82 101 public T GetValue<T>() where T : class, IItem { … … 95 114 /// Clones the current instance (deep clone). 96 115 /// </summary> 97 /// <param name="clonedObjects">Dictionary of all already cloned objects. (Needed to avoid cycles.)</param>116 /// <param name="clonedObjects">Dictionary of all already cloned objects. (Needed for referential integrity.)</param> 98 117 /// <returns>The cloned object as <see cref="Variable"/>.</returns> 99 118 public override object Clone(IDictionary<Guid, object> clonedObjects) { 100 Variable clone = new Variable(); 101 clonedObjects.Add(Guid, clone); 102 clone.myName = Name; 103 if (Value != null) 104 clone.myValue = (IItem)Auxiliary.Clone(Value, clonedObjects); 105 return clone; 119 return new Variable(this, clonedObjects); 106 120 } 107 121 -
branches/CloningRefactorBranch/HeuristicLab.Core/VariableInfo.cs
r776 r885 119 119 120 120 /// <summary> 121 /// Copy constructor to deep clone VariableInfo instances. 122 /// </summary> 123 /// <param name="original">The instance to be cloned.</param> 124 public VariableInfo(VariableInfo original) : this(original, new Dictionary<Guid, object>()) { } 125 126 /// <summary> 127 /// Copy constructor to deep clone VariableInfo instances 128 /// reusing already cloned object references. 129 /// </summary> 130 /// <param name="original">The instance to be cloned.</param> 131 /// <param name="clonedObjects">Already cloned instances (for referential integrity).</param> 132 protected VariableInfo(VariableInfo original, IDictionary<Guid, object> clonedObjects) 133 : base(original, clonedObjects) { 134 this.myActualName = original.ActualName; 135 this.myFormalName = original.FormalName; 136 this.myDescription = original.Description; 137 this.myDataType = original.DataType; 138 this.myKind = original.Kind; 139 this.myLocal = original.Local; 140 } 141 142 /// <summary> 121 143 /// Creates a new instance of <see cref="VariableInfoView"/> to represent the current instance 122 144 /// visually. … … 130 152 /// Clones the current instance (deep clone). 131 153 /// </summary> 132 /// <param name="clonedObjects">Dictionary of all already cloned objects. (Needed to avoid cycles.)</param> 154 /// <remarks>Uses the copy constructor to create the deep clone.</remarks> 155 /// <param name="clonedObjects">Dictionary of all already cloned objects (for referential integrity.)</param> 133 156 /// <returns>The cloned object as <see cref="VariableInfo"/>.</returns> 134 157 public override object Clone(IDictionary<Guid, object> clonedObjects) { 135 VariableInfo clone = new VariableInfo(); 136 clonedObjects.Add(Guid, clone); 137 clone.myActualName = ActualName; 138 clone.myFormalName = FormalName; 139 clone.myDescription = Description; 140 clone.myDataType = DataType; 141 clone.myKind = Kind; 142 clone.myLocal = Local; 143 return clone; 158 return new VariableInfo(this, clonedObjects); 144 159 } 145 160 -
branches/CloningRefactorBranch/HeuristicLab.Data/ArrayDataBase.cs
r737 r885 42 42 43 43 /// <summary> 44 /// Default constructor. 45 /// </summary> 46 protected ArrayDataBase() { } 47 48 /// <summary> 49 /// Copy constructor to create clones (deep) reusing already cloned object references. 50 /// </summary> 51 /// <param name="original">The instance to be cloned.</param> 52 /// <param name="clonedObjects">Already cloned objects (for referential integrity).</param> 53 protected ArrayDataBase(ArrayDataBase original, IDictionary<Guid, object> clonedObjects) 54 : base(original, clonedObjects) { } 55 56 /// <summary> 44 57 /// The string representation of the array. 45 58 /// </summary> -
branches/CloningRefactorBranch/HeuristicLab.Data/BoolArrayData.cs
r763 r885 55 55 Data = data; 56 56 } 57 /// <summary> 58 /// Copy constructor to create clones (deep). 59 /// </summary> 60 /// <param name="original">The original instance to be cloned.</param> 61 public BoolArrayData(BoolArrayData original) : this(original, new Dictionary<Guid, object>()) { } 62 /// <summary> 63 /// Copy constructor to create clones (deep) reusing already cloned object references. 64 /// </summary> 65 /// <param name="original">The instance to be cloned.</param> 66 /// <param name="clonedObjects">Already cloned objects (for referential integrity).</param> 67 protected BoolArrayData(BoolArrayData original, IDictionary<Guid, object> clonedObjects) 68 : base(original, clonedObjects) { } 57 69 58 70 /// <summary> … … 62 74 public override IView CreateView() { 63 75 return new BoolArrayDataView(this); 76 } 77 78 /// <summary> 79 /// Clones an instance using the copy constructor 80 /// reusing already cloned object references. 81 /// </summary> 82 /// <param name="clonedObjects">Already cloned objects (for referential integrity).</param> 83 /// <returns>A cloned (deep) instance</returns> 84 public override object Clone(IDictionary<Guid, object> clonedObjects) { 85 return new BoolArrayData(this, clonedObjects); 64 86 } 65 87 … … 73 95 /// (Needed to avoid cycles.)</param> 74 96 /// <returns>The saved <see cref="XmlNode"/>.</returns> 75 public override XmlNode GetXmlNode(string name, XmlDocument document, IDictionary<Guid, IStorable> persistedObjects) {97 public override XmlNode GetXmlNode(string name, XmlDocument document, IDictionary<Guid, IStorable> persistedObjects) { 76 98 XmlNode node = base.GetXmlNode(name, document, persistedObjects); 77 99 node.InnerText = ToString(); … … 87 109 /// <param name="restoredObjects">A Dictionary of all already restored objects. 88 110 /// (Needed to avoid cycles.)</param> 89 public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) {111 public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) { 90 112 base.Populate(node, restoredObjects); 91 113 string[] tokens = node.InnerText.Split(';'); -
branches/CloningRefactorBranch/HeuristicLab.Data/BoolData.cs
r776 r885 54 54 Data = data; 55 55 } 56 57 /// <summary> 58 /// Copy constructor to create deep clones. 59 /// </summary> 60 /// <param name="original">The instance to be cloned.</param> 61 public BoolData(BoolData original) : this(original, new Dictionary<Guid, object>()) { } 62 63 /// <summary> 64 /// Copy constructor to create deep clones reusing already cloned object references. 65 /// </summary> 66 /// <param name="original">The instance to be cloned.</param> 67 /// <param name="clonedObjects">Already cloned objects (for referential integrity).</param> 68 protected BoolData(BoolData original, IDictionary<Guid, object> clonedObjects) 69 : base(original, clonedObjects) { 70 this.Data = original.Data; 71 } 56 72 /// <summary> 57 73 /// Creates a new instance of the <see cref="BoolDataView"/> class. … … 63 79 64 80 /// <summary> 65 /// Clones the current instance .81 /// Clones the current instance using the copy constructor. 66 82 /// </summary> 67 /// <remarks>The cloned instance is added to the <paramref name="dictionary"/>.</remarks>68 83 /// <param name="clonedObjects">Dictionary of all already cloned objects.</param> 69 84 /// <returns>The cloned instance as <see cref="BoolData"/>.</returns> 70 85 public override object Clone(IDictionary<Guid, object> clonedObjects) { 71 BoolData clone = new BoolData(); 72 clonedObjects.Add(Guid, clone); 73 clone.Data = Data; 74 return clone; 86 return new BoolData(this, clonedObjects); 75 87 } 76 88 /// <summary> … … 82 94 /// <param name="persistedObjects">The dictionary of all already persisted objects. (Needed to avoid cycles.)</param> 83 95 /// <returns>The saved <see cref="XmlNode"/>.</returns> 84 public override XmlNode GetXmlNode(string name, XmlDocument document, IDictionary<Guid, IStorable> persistedObjects) {96 public override XmlNode GetXmlNode(string name, XmlDocument document, IDictionary<Guid, IStorable> persistedObjects) { 85 97 XmlNode node = base.GetXmlNode(name, document, persistedObjects); 86 98 node.InnerText = ToString(); … … 95 107 /// <param name="restoredObjects">The dictionary of all already restored objects. 96 108 /// (Needed to avoid cycles.)</param> 97 public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) {109 public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) { 98 110 base.Populate(node, restoredObjects); 99 111 Data = bool.Parse(node.InnerText); -
branches/CloningRefactorBranch/HeuristicLab.Data/BoolMatrixData.cs
r763 r885 58 58 59 59 /// <summary> 60 /// Copy constructor to create clones (deep). 61 /// </summary> 62 /// <param name="original">The original instance to be cloned.</param> 63 public BoolMatrixData(BoolMatrixData original) : this(original, new Dictionary<Guid, object>()) { } 64 /// <summary> 65 /// Copy constructor to create clones (deep) reusing already cloned object references. 66 /// </summary> 67 /// <param name="original">The instance to be cloned.</param> 68 /// <param name="clonedObjects">Already cloned objects (for referential integrity).</param> 69 protected BoolMatrixData(BoolMatrixData original, IDictionary<Guid, object> clonedObjects) 70 : base(original, clonedObjects) { } 71 72 /// <summary> 60 73 /// Creates a new instance of the <see cref="BoolMatrixDataView"/> class. 61 74 /// </summary> … … 63 76 public override IView CreateView() { 64 77 return new BoolMatrixDataView(this); 78 } 79 80 /// <summary> 81 /// Clones the instance using the copy constructor 82 /// reusing already cloned object references. 83 /// </summary> 84 /// <param name="clonedObjects">Already cloned objects (for referential integrity).</param> 85 /// <returns>A cloned (deep) instance</returns> 86 public override object Clone(IDictionary<Guid, object> clonedObjects) { 87 return new BoolMatrixData(this, clonedObjects); 65 88 } 66 89 … … 75 98 /// <param name="persistedObjects">The dictionary of all already persisted objects. (Needed to avoid cycles.)</param> 76 99 /// <returns>The saved <see cref="XmlNode"/>.</returns> 77 public override XmlNode GetXmlNode(string name, XmlDocument document, IDictionary<Guid, IStorable> persistedObjects) {100 public override XmlNode GetXmlNode(string name, XmlDocument document, IDictionary<Guid, IStorable> persistedObjects) { 78 101 XmlNode node = base.GetXmlNode(name, document, persistedObjects); 79 102 XmlAttribute dim1 = document.CreateAttribute("Dimension1"); … … 94 117 /// <param name="node">The <see cref="XmlNode"/> where the instance is saved.</param> 95 118 /// <param name="restoredObjects">The dictionary of all already restored objects. (Needed to avoid cycles.)</param> 96 public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) {119 public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) { 97 120 base.Populate(node, restoredObjects); 98 121 int dim1 = int.Parse(node.Attributes["Dimension1"].Value, CultureInfo.InvariantCulture.NumberFormat); -
branches/CloningRefactorBranch/HeuristicLab.Data/ConstrainedDoubleData.cs
r836 r885 57 57 58 58 /// <summary> 59 /// Copy constructor to create deep clones. 60 /// </summary> 61 /// <param name="original"></param> 62 public ConstrainedDoubleData(ConstrainedDoubleData original) : this(original, new Dictionary<Guid, object>()) { } 63 64 /// <summary> 59 65 /// Copy constructor for deep cloning of ConstrainedDoubleData items. 60 66 /// </summary> 61 67 /// <param name="original"></param> 62 68 /// <param name="clonedObjects"></param> 63 protected ConstrainedDoubleData(ConstrainedDoubleData original, IDictionary<Guid, object> clonedObjects) : base(original, clonedObjects) { } 69 protected ConstrainedDoubleData(ConstrainedDoubleData original, IDictionary<Guid, object> clonedObjects) 70 : base(original, clonedObjects) { } 64 71 65 72 /// <inheritdoc cref="ConstrainedObjectData.TrySetData(object)"/> … … 83 90 /// Clones the current instance. 84 91 /// </summary> 85 /// <remarks>Uses the <see cref="ConstrainedObjectData.Clone"/> implementation of base class <see cref="ConstrainedObjectData"/>.</remarks>92 /// <remarks>Uses the copy constructor <see cref="ConstrainedDoubleData.ctor"/> to create a deep clone of the ConstrainedDoubleData instance.</remarks> 86 93 /// <param name="clonedObjects">A dictionary of all already cloned objects.</param> 87 94 /// <returns>The cloned instance as <see cref="ConstrainedDoubleData"/>.</returns> -
branches/CloningRefactorBranch/HeuristicLab.Data/ConstrainedIntData.cs
r836 r885 57 57 58 58 /// <summary> 59 /// Copy constructor for deep cloning of ConstrainedDoubleData items.59 /// Copy constructor to create clones (deep). 60 60 /// </summary> 61 /// <param name="original"></param> 62 /// <param name="clonedObjects"></param> 63 protected ConstrainedIntData(ConstrainedIntData original, IDictionary<Guid, object> clonedObjects) : base(original, clonedObjects) { } 61 /// <param name="original">The original instance to be cloned.</param> 62 public ConstrainedIntData(ConstrainedIntData original) : this(original, new Dictionary<Guid, object>()) { } 63 64 /// <summary> 65 /// Copy constructor to create clones (deep) reusing already cloned object references. 66 /// </summary> 67 /// <param name="original">The instance to be cloned.</param> 68 /// <param name="clonedObjects">Already cloned objects (for referential integrity).</param> 69 protected ConstrainedIntData(ConstrainedIntData original, IDictionary<Guid, object> clonedObjects) 70 : base(original, clonedObjects) { } 64 71 65 72 /// <inheritdoc cref="ConstrainedObjectData.TrySetData(object)"/> … … 83 90 /// Clones the current instance. 84 91 /// </summary> 85 /// <remarks>Uses the <see cref="ConstrainedObjectData.Clone"/> implementation of base class <see cref="ConstrainedObjectData"/>.</remarks>92 /// <remarks>Uses the copy constructor <see cref="ConstrainedIntData.ctor"/> to create a deep clone of the ConstrainedIntData instance.</remarks> 86 93 /// <param name="clonedObjects">A dictionary of all already cloned objects.</param> 87 94 /// <returns>The clone instance as <see cref="ConstrainedIntData"/>.</returns> -
branches/CloningRefactorBranch/HeuristicLab.Data/ConstrainedItemList.cs
r737 r885 53 53 54 54 /// <summary> 55 /// Copy constructor to create clones (deep). 56 /// </summary> 57 /// <param name="original">The original instance to be cloned.</param> 58 public ConstrainedItemList(ConstrainedItemList original) : this(original, new Dictionary<Guid, object>()) { } 59 60 /// <summary> 61 /// Copy constructor to create clones (deep) reusing already cloned object references. 62 /// </summary> 63 /// <param name="original">The instance to be cloned.</param> 64 /// <param name="clonedObjects">Already cloned objects (for referential integrity).</param> 65 protected ConstrainedItemList(ConstrainedItemList original, IDictionary<Guid, object> clonedObjects) 66 : base(original, clonedObjects) { 67 foreach (IConstraint constraint in original.Constraints) 68 this.AddConstraint((IConstraint)Auxiliary.Clone(constraint, clonedObjects)); 69 this.suspendConstraintCheck = original.suspendConstraintCheck; 70 foreach (IItem item in original.list) { 71 this.list.Add((IItem)Auxiliary.Clone(item, clonedObjects)); 72 } 73 } 74 75 /// <summary> 55 76 /// Creates a new instance of <see cref="ConstrainedItemListView"/>. 56 77 /// </summary> … … 64 85 /// Clones the current instance. 65 86 /// </summary> 66 /// <remarks>The elements of the current instance are cloned with the 67 /// <see cref="HeuristicLab.Core.Auxiliary.Clone"/> method of the class <see cref="Auxiliary"/>.</remarks> 87 /// <remarks>The elements of the current instance are cloned with the copy constructor.</remarks> 68 88 /// <param name="clonedObjects">A dictionary of all already cloned objects.</param> 69 89 /// <returns>The cloned instance as <see cref="ConstrainedItemList"/>.</returns> 70 90 public override object Clone(IDictionary<Guid, object> clonedObjects) { 71 ConstrainedItemList clone = new ConstrainedItemList(); 72 clonedObjects.Add(Guid, clone); 73 foreach (IConstraint constraint in Constraints) 74 clone.AddConstraint((IConstraint)Auxiliary.Clone(constraint, clonedObjects)); 75 clone.suspendConstraintCheck = suspendConstraintCheck; 76 foreach (IItem item in list) { 77 clone.list.Add((IItem)Auxiliary.Clone(item, clonedObjects)); 78 } 79 return clone; 91 return new ConstrainedItemList(this, clonedObjects); 80 92 } 81 93 … … 94 106 /// <param name="persistedObjects">A dictionary of all already persisted objects. (Needed to avoid cycles.)</param> 95 107 /// <returns>The saved <see cref="XmlNode"/>.</returns> 96 public override XmlNode GetXmlNode(string name, XmlDocument document, IDictionary<Guid, IStorable> persistedObjects) {108 public override XmlNode GetXmlNode(string name, XmlDocument document, IDictionary<Guid, IStorable> persistedObjects) { 97 109 XmlNode node = base.GetXmlNode(name, document, persistedObjects); 98 110 XmlNode listNode = document.CreateNode(XmlNodeType.Element, "ListItems", null); … … 115 127 /// <param name="node">The <see cref="XmlNode"/> where the int is saved.</param> 116 128 /// <param name="restoredObjects">A dictionary of all already restored objects. (Needed to avoid cycles.)</param> 117 public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) {129 public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) { 118 130 base.Populate(node, restoredObjects); 119 131 XmlNode listNode = node.SelectSingleNode("ListItems"); -
branches/CloningRefactorBranch/HeuristicLab.Data/ConstrainedObjectData.cs
r763 r885 48 48 49 49 /// <summary> 50 /// Default constructor 51 /// </summary> 52 public ConstrainedObjectData() { } 53 54 /// <summary> 55 /// Copy constructor to create clones (deep) . 56 /// </summary> 57 /// <param name="original">The instance to be cloned.</param> 58 public ConstrainedObjectData(ConstrainedObjectData original) : this(original, new Dictionary<Guid, object>()) { } 59 60 /// <summary> 61 /// Copy constructor to create a cloned instance. 62 /// </summary> 63 /// <remarks>HeuristicLab data items are cloned with the <see cref="HeuristicLab.Core.Auxiliary.Clone"/> method of 64 /// class <see cref="Auxiliary"/> (deep copy), all other items (like basic data types) 65 /// are cloned with their own <c>Clone</c> methods (shadow copy).</remarks> 66 /// <param name="clonedObjects">All already cloned objects.</param> 67 /// <returns>The cloned object as <see cref="ConstrainedObjectData"/>.</returns> 68 protected ConstrainedObjectData(ConstrainedObjectData original, IDictionary<Guid, object> clonedObjects) 69 : base(original, clonedObjects) { 70 if (original.Data is IStorable) 71 this.myData = Auxiliary.Clone((IStorable)original.Data, clonedObjects); 72 else if (original.Data is ICloneable) 73 this.myData = ((ICloneable)original.Data).Clone(); 74 else 75 throw new InvalidOperationException("contained object is not cloneable"); 76 } 77 78 /// <summary> 50 79 /// Assigns the new <paramref name="data"/> if it is valid according to the constraints. 51 80 /// </summary> … … 89 118 90 119 /// <summary> 91 /// Clones the current object.92 /// </summary>93 /// <remarks>HeuristicLab data items are cloned with the <see cref="HeuristicLab.Core.Auxiliary.Clone"/> method of94 /// class <see cref="Auxiliary"/> (deep copy), all other items (like basic data types)95 /// are cloned with their own <c>Clone</c> methods (shadow copy).</remarks>96 /// <param name="clonedObjects">All already cloned objects.</param>97 /// <returns>The cloned object as <see cref="ConstrainedObjectData"/>.</returns>98 public override object Clone(IDictionary<Guid, object> clonedObjects) {99 ConstrainedObjectData clone = (ConstrainedObjectData)base.Clone(clonedObjects);100 if (Data is IStorable)101 clone.myData = Auxiliary.Clone((IStorable)Data, clonedObjects);102 else if (Data is ICloneable)103 clone.myData = ((ICloneable)Data).Clone();104 else105 throw new InvalidOperationException("contained object is not cloneable");106 return clone;107 }108 109 /// <summary>110 120 /// Compares the current instance to the given <paramref name="obj"/>. 111 121 /// </summary> … … 131 141 132 142 /// <summary> 143 /// Clones an instance using the copy constructor 144 /// reusing already cloned object references. 145 /// </summary> 146 /// <param name="clonedObjects">Already cloned objects (for referential integrity).</param> 147 /// <returns>A cloned (deep) instance</returns> 148 public override object Clone(IDictionary<Guid, object> clonedObjects) { 149 return new ConstrainedObjectData(this, clonedObjects); 150 } 151 152 /// <summary> 133 153 /// The string representation of the current instance. 134 154 /// </summary> -
branches/CloningRefactorBranch/HeuristicLab.Data/DoubleArrayData.cs
r763 r885 56 56 Data = data; 57 57 } 58 /// <summary> 59 /// Copy constructor to create clones (deep). 60 /// </summary> 61 /// <param name="original">The original instance to be cloned.</param> 62 public DoubleArrayData(DoubleArrayData original) : this(original, new Dictionary<Guid, object>()) { } 63 /// <summary> 64 /// Copy constructor to create clones (deep) reusing already cloned object references. 65 /// </summary> 66 /// <param name="original">The instance to be cloned.</param> 67 /// <param name="clonedObjects">Already cloned objects (for referential integrity).</param> 68 protected DoubleArrayData(DoubleArrayData original, IDictionary<Guid, object> clonedObjects) 69 : base(original, clonedObjects) { } 58 70 59 71 /// <summary> … … 63 75 public override IView CreateView() { 64 76 return new DoubleArrayDataView(this); 77 } 78 79 /// <summary> 80 /// Clones an instance using the copy constructor 81 /// reusing already cloned object references. 82 /// </summary> 83 /// <param name="clonedObjects">Already cloned objects (for referential integrity).</param> 84 /// <returns>A cloned (deep) instance</returns> 85 public override object Clone(IDictionary<Guid, object> clonedObjects) { 86 return new DoubleArrayData(this, clonedObjects); 65 87 } 66 88 … … 74 96 /// <param name="persistedObjects">A dictionary of all already persisted objects. (Needed to avoid cycles.)</param> 75 97 /// <returns>The saved <see cref="XmlNode"></see>.</returns> 76 public override XmlNode GetXmlNode(string name, XmlDocument document, IDictionary<Guid, IStorable> persistedObjects) {98 public override XmlNode GetXmlNode(string name, XmlDocument document, IDictionary<Guid, IStorable> persistedObjects) { 77 99 XmlNode node = base.GetXmlNode(name, document, persistedObjects); 78 100 node.InnerText = ToString(CultureInfo.InvariantCulture.NumberFormat); 79 101 return node; 80 102 } 81 103 82 104 /// <summary> 83 105 /// Loads the persisted double array from the specified <paramref name="node"/>. … … 89 111 /// <param name="node">The <see cref="XmlNode"></see> where the instance is saved.</param> 90 112 /// <param name="restoredObjects">A dictionary of all already restored objects. (Needed to avoid cycles.)</param> 91 public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) {113 public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) { 92 114 base.Populate(node, restoredObjects); 93 115 string[] tokens = node.InnerText.Split(';'); 94 116 double[] data = new double[tokens.Length]; 95 for (int i = 0; i < data.Length; i++)96 if (double.TryParse(tokens[i], NumberStyles.Float, CultureInfo.InvariantCulture.NumberFormat, out data[i]) == false) {117 for (int i = 0; i < data.Length; i++) 118 if (double.TryParse(tokens[i], NumberStyles.Float, CultureInfo.InvariantCulture.NumberFormat, out data[i]) == false) { 97 119 throw new FormatException("Can't parse " + tokens[i] + " as double value."); 98 120 } … … 109 131 private string ToString(NumberFormatInfo format) { 110 132 StringBuilder builder = new StringBuilder(); 111 for (int i = 0; i < Data.Length; i++) {133 for (int i = 0; i < Data.Length; i++) { 112 134 builder.Append(";"); 113 135 builder.Append(Data[i].ToString("r", format)); 114 136 } 115 if (builder.Length > 0)137 if (builder.Length > 0) 116 138 builder.Remove(0, 1); 117 139 return builder.ToString(); -
branches/CloningRefactorBranch/HeuristicLab.Data/DoubleData.cs
r763 r885 58 58 59 59 /// <summary> 60 /// Copy constructor to create clones (deep). 61 /// </summary> 62 /// <param name="original">The original instance to be cloned.</param> 63 public DoubleData(DoubleData original) : this(original, new Dictionary<Guid, object>()) { } 64 65 /// <summary> 66 /// Copy constructor to create clones (deep) reusing already cloned object references. 67 /// </summary> 68 /// <param name="original">The instance to be cloned.</param> 69 /// <param name="clonedObjects">Already cloned objects (for referential integrity).</param> 70 protected DoubleData(DoubleData original, IDictionary<Guid, object> clonedObjects) 71 : base(original, clonedObjects) { 72 this.Data = original.Data; 73 } 74 75 /// <summary> 60 76 /// Creates a new instance of the <see cref="DoubleDataView"/> class. 61 77 /// </summary> … … 66 82 67 83 /// <summary> 68 /// Clones the current instance and adds it to the dictionary <paramref name="clonedObjects"/>.84 /// Clones the current instance using the copy constructor. 69 85 /// </summary> 70 86 /// <param name="clonedObjects">Dictionary of all already cloned objects.</param> 71 87 /// <returns>The cloned instance as <see cref="DoubleData"/>.</returns> 72 88 public override object Clone(IDictionary<Guid, object> clonedObjects) { 73 DoubleData clone = new DoubleData(); 74 clonedObjects.Add(Guid, clone); 75 clone.Data = Data; 76 return clone; 89 return new DoubleData(this, clonedObjects); 77 90 } 78 91 … … 86 99 /// <param name="persistedObjects">A dictionary of all already persisted objects. (Needed to avoid cycles.)</param> 87 100 /// <returns>The saved <see cref="XmlNode"/>.</returns> 88 public override XmlNode GetXmlNode(string name, XmlDocument document, IDictionary<Guid, IStorable> persistedObjects) {101 public override XmlNode GetXmlNode(string name, XmlDocument document, IDictionary<Guid, IStorable> persistedObjects) { 89 102 XmlNode node = base.GetXmlNode(name, document, persistedObjects); 90 103 node.InnerText = Data.ToString("r", CultureInfo.InvariantCulture.NumberFormat); … … 100 113 /// <param name="node">The <see cref="XmlNode"/> where the double is saved.</param> 101 114 /// <param name="restoredObjects">A dictionary of all already restored objects. (Needed to avoid cycles.)</param> 102 public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) {115 public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) { 103 116 base.Populate(node, restoredObjects); 104 117 double data; 105 if (double.TryParse(node.InnerText, NumberStyles.Float, CultureInfo.InvariantCulture.NumberFormat, out data) == true) {118 if (double.TryParse(node.InnerText, NumberStyles.Float, CultureInfo.InvariantCulture.NumberFormat, out data) == true) { 106 119 Data = data; 107 120 } else { 108 throw new FormatException("Can't parse " + node.InnerText + " as double value."); 121 throw new FormatException("Can't parse " + node.InnerText + " as double value."); 109 122 } 110 123 } -
branches/CloningRefactorBranch/HeuristicLab.Data/DoubleMatrixData.cs
r737 r885 58 58 59 59 /// <summary> 60 /// Copy constructor to create clones (deep). 61 /// </summary> 62 /// <param name="original">The original instance to be cloned.</param> 63 public DoubleMatrixData(DoubleMatrixData original) : this(original, new Dictionary<Guid, object>()) { } 64 65 /// <summary> 66 /// Copy constructor to create clones (deep) reusing already cloned object references. 67 /// </summary> 68 /// <param name="original">The instance to be cloned.</param> 69 /// <param name="clonedObjects">Already cloned objects (for referential integrity).</param> 70 protected DoubleMatrixData(DoubleMatrixData original, IDictionary<Guid, object> clonedObjects) 71 : base(original, clonedObjects) { } 72 73 /// <summary> 60 74 /// Creates a new instance of the <see cref="DoubleMatrixDataView"/> class. 61 75 /// </summary> … … 63 77 public override IView CreateView() { 64 78 return new DoubleMatrixDataView(this); 79 } 80 81 /// <summary> 82 /// Clones an instance using the copy constructor 83 /// reusing already cloned object references. 84 /// </summary> 85 /// <param name="clonedObjects">Already cloned objects (for referential integrity).</param> 86 /// <returns>A cloned (deep) instance</returns> 87 public override object Clone(IDictionary<Guid, object> clonedObjects) { 88 return new DoubleMatrixData(this, clonedObjects); 65 89 } 66 90 … … 77 101 /// <param name="persistedObjects">A dictionary of all already persisted objects. (Needed to avoid cycles.)</param> 78 102 /// <returns>The saved <see cref="XmlNode"/>.</returns> 79 public override XmlNode GetXmlNode(string name, XmlDocument document, IDictionary<Guid, IStorable> persistedObjects) {103 public override XmlNode GetXmlNode(string name, XmlDocument document, IDictionary<Guid, IStorable> persistedObjects) { 80 104 XmlNode node = base.GetXmlNode(name, document, persistedObjects); 81 105 XmlAttribute dim1 = document.CreateAttribute("Dimension1"); … … 99 123 /// <param name="node">The <see cref="XmlNode"/> where the instance is saved.</param> 100 124 /// <param name="restoredObjects">The dictionary of all already restored objects. (Needed to avoid cycles.)</param> 101 public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) {125 public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) { 102 126 base.Populate(node, restoredObjects); 103 127 int dim1 = int.Parse(node.Attributes["Dimension1"].Value, CultureInfo.InvariantCulture.NumberFormat); … … 107 131 for (int i = 0; i < dim1; i++) { 108 132 for (int j = 0; j < dim2; j++) { 109 if (double.TryParse(tokens[i * dim2 + j], NumberStyles.Float, CultureInfo.InvariantCulture.NumberFormat, out data[i, j])==false) {133 if (double.TryParse(tokens[i * dim2 + j], NumberStyles.Float, CultureInfo.InvariantCulture.NumberFormat, out data[i, j]) == false) { 110 134 throw new FormatException("Can't parse " + tokens[i * dim2 + j] + " as double value."); 111 135 } … … 123 147 return ToString(CultureInfo.CurrentCulture.NumberFormat); 124 148 } 125 149 126 150 /// <summary> 127 151 /// The string representation of the matrix, considering a specified <paramref name="format"/>. -
branches/CloningRefactorBranch/HeuristicLab.Data/IntArrayData.cs
r737 r885 56 56 Data = data; 57 57 } 58 /// <summary> 59 /// Copy constructor to create clones (deep). 60 /// </summary> 61 /// <param name="original">The original instance to be cloned.</param> 62 public IntArrayData(IntArrayData original) : this(original, new Dictionary<Guid, object>()) { } 63 /// <summary> 64 /// Copy constructor to create clones (deep) reusing already cloned object references. 65 /// </summary> 66 /// <param name="original">The instance to be cloned.</param> 67 /// <param name="clonedObjects">Already cloned objects (for referential integrity).</param> 68 protected IntArrayData(IntArrayData original, IDictionary<Guid, object> clonedObjects) 69 : base(original, clonedObjects) { } 58 70 59 71 /// <summary> … … 63 75 public override IView CreateView() { 64 76 return new IntArrayDataView(this); 77 } 78 79 /// <summary> 80 /// Clones an instance using the copy constructor 81 /// reusing already cloned object references. 82 /// </summary> 83 /// <param name="clonedObjects">Already cloned objects (for referential integrity).</param> 84 /// <returns>A cloned (deep) instance</returns> 85 public override object Clone(IDictionary<Guid, object> clonedObjects) { 86 return new IntArrayData(this, clonedObjects); 65 87 } 66 88 -
branches/CloningRefactorBranch/HeuristicLab.Data/IntData.cs
r763 r885 55 55 Data = data; 56 56 } 57 /// <summary> 58 /// Copy constructor to create clones (deep). 59 /// </summary> 60 /// <param name="original">The original instance to be cloned.</param> 61 public IntData(IntData original) : this(original, new Dictionary<Guid, object>()) { } 62 63 /// <summary> 64 /// Copy constructor to create clones (deep) reusing already cloned object references. 65 /// </summary> 66 /// <param name="original">The instance to be cloned.</param> 67 /// <param name="clonedObjects">Already cloned objects (for referential integrity).</param> 68 protected IntData(IntData original, IDictionary<Guid, object> clonedObjects) 69 : base(original, clonedObjects) { 70 this.Data = original.Data; 71 } 57 72 58 73 /// <summary> … … 65 80 66 81 /// <summary> 67 /// Clones the current instance .82 /// Clones the current instance using the copy constructor. 68 83 /// </summary> 69 84 /// <remarks>Adds the cloned instance to the dictionary <paramref name="clonedObjects"/>.</remarks> … … 71 86 /// <returns>The cloned instance as <see cref="IntData"/>.</returns> 72 87 public override object Clone(IDictionary<Guid, object> clonedObjects) { 73 IntData clone = new IntData(); 74 clonedObjects.Add(Guid, clone); 75 clone.Data = Data; 76 return clone; 88 return new IntData(this, clonedObjects); 77 89 } 78 90 … … 86 98 /// <param name="persistedObjects">A dictionary of all already persisted objects.(Needed to avoid cycles.)</param> 87 99 /// <returns>The saved <see cref="XmlNode"/>.</returns> 88 public override XmlNode GetXmlNode(string name, XmlDocument document, IDictionary<Guid, IStorable> persistedObjects) {100 public override XmlNode GetXmlNode(string name, XmlDocument document, IDictionary<Guid, IStorable> persistedObjects) { 89 101 XmlNode node = base.GetXmlNode(name, document, persistedObjects); 90 102 node.InnerText = Data.ToString(CultureInfo.InvariantCulture.NumberFormat); … … 99 111 /// <param name="node">The <see cref="XmlNode"/> where the int is saved.</param> 100 112 /// <param name="restoredObjects">A dictionary of all already restored objects. (Needed to avoid cycles.)</param> 101 public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) {113 public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) { 102 114 base.Populate(node, restoredObjects); 103 115 Data = int.Parse(node.InnerText, CultureInfo.InvariantCulture.NumberFormat); -
branches/CloningRefactorBranch/HeuristicLab.Data/IntMatrixData.cs
r763 r885 58 58 59 59 /// <summary> 60 /// Copy constructor to create clones (deep). 61 /// </summary> 62 /// <param name="original">The original instance to be cloned.</param> 63 public IntMatrixData(IntMatrixData original) : this(original, new Dictionary<Guid, object>()) { } 64 65 /// <summary> 66 /// Copy constructor to create clones (deep) reusing already cloned object references. 67 /// </summary> 68 /// <param name="original">The instance to be cloned.</param> 69 /// <param name="clonedObjects">Already cloned objects (for referential integrity).</param> 70 protected IntMatrixData(IntMatrixData original, IDictionary<Guid, object> clonedObjects) 71 : base(original, clonedObjects) { } 72 73 /// <summary> 60 74 /// Creates a new instance of <see cref="IntMatrixDataView"/>. 61 75 /// </summary> … … 65 79 } 66 80 81 /// <summary> 82 /// Clones an instance using the copy constructor 83 /// reusing already cloned object references. 84 /// </summary> 85 /// <param name="clonedObjects">Already cloned objects (for referential integrity).</param> 86 /// <returns>A cloned (deep) instance</returns> 87 public override object Clone(IDictionary<Guid, object> clonedObjects) { 88 return new IntMatrixData(this, clonedObjects); 89 } 67 90 /// <summary> 68 91 /// Saves the current instance as <see cref="XmlNode"/> in the specified <paramref name="document"/>. … … 78 101 /// (Needed to avoid cycles.)</param> 79 102 /// <returns>The saved <see cref="XmlNode"/>.</returns> 80 public override XmlNode GetXmlNode(string name, XmlDocument document, IDictionary<Guid, IStorable> persistedObjects) {103 public override XmlNode GetXmlNode(string name, XmlDocument document, IDictionary<Guid, IStorable> persistedObjects) { 81 104 XmlNode node = base.GetXmlNode(name, document, persistedObjects); 82 105 XmlAttribute dim1 = document.CreateAttribute("Dimension1"); … … 99 122 /// <param name="node">The <see cref="XmlNode"/> where the instance is saved.</param> 100 123 /// <param name="restoredObjects">The dictionary of all already restored objects. (Needed to avoid cycles.)</param> 101 public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) {124 public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) { 102 125 base.Populate(node, restoredObjects); 103 126 int dim1 = int.Parse(node.Attributes["Dimension1"].Value, CultureInfo.InvariantCulture.NumberFormat); -
branches/CloningRefactorBranch/HeuristicLab.Data/ItemDictionary_T.cs
r737 r885 1 1 using System; 2 using System.Collections; 2 using System.Collections; 3 3 using System.Collections.Generic; 4 4 using System.Text; … … 12 12 /// <typeparam name="K">The type of the keys, which must implement the interface <see cref="IItem"/>.</typeparam> 13 13 /// <typeparam name="V">The type of the values, which must imlement the interface <see cref="IItem"/>.</typeparam> 14 public class ItemDictionary<K, V> : ItemBase, IDictionary<K,V>14 public class ItemDictionary<K, V> : ItemBase, IDictionary<K, V> 15 15 where K : IItem 16 where V : IItem {16 where V : IItem { 17 17 private Dictionary<K, V> dict; 18 18 … … 34 34 } 35 35 36 /// <summary> 37 /// Copy constructor to create clones (deep). 38 /// </summary> 39 /// <param name="original">The original instance to be cloned.</param> 40 public ItemDictionary(ItemDictionary<K, V> original) : this(original, new Dictionary<Guid, object>()) { } 41 42 /// <summary> 43 /// Copy constructor to create clones (deep) reusing already cloned object references. 44 /// </summary> 45 /// <param name="original">The instance to be cloned.</param> 46 /// <param name="clonedObjects">Already cloned objects (for referential integrity).</param> 47 protected ItemDictionary(ItemDictionary<K, V> original, IDictionary<Guid, object> clonedObjects) 48 : base(original, clonedObjects) { 49 foreach (KeyValuePair<K, V> item in original.dict) { 50 this.dict.Add((K)Auxiliary.Clone(item.Key, clonedObjects), (V)Auxiliary.Clone(item.Value, clonedObjects)); 51 } 52 } 53 36 54 #region ItemBase Members 37 55 /// <summary> … … 40 58 /// <returns>The created instance as <see cref="ItemDictionaryView<K,V>"/>.</returns> 41 59 public override IView CreateView() { 42 return new ItemDictionaryView<K, V>(this);43 } 44 45 /// <summary> 46 /// Clones the current instance and adds it to the dictionary <paramref name="clonedObjects"/>.60 return new ItemDictionaryView<K, V>(this); 61 } 62 63 /// <summary> 64 /// Clones the current instance using the copy constructor. 47 65 /// </summary> 48 66 /// <remarks>Also the keys and values in the dictionary are cloned and saved to the dictionary <paramref name="clonedObjects"/>, … … 51 69 /// <returns>The cloned instance as <see cref="ItemDictionary<K,V>"/>.</returns> 52 70 public override object Clone(IDictionary<Guid, object> clonedObjects) { 53 ItemDictionary<K,V> clone = new ItemDictionary<K,V>(); 54 clonedObjects.Add(Guid, clone); 55 foreach (KeyValuePair<K, V> item in dict) { 56 clone.dict.Add((K) Auxiliary.Clone(item.Key, clonedObjects), (V) Auxiliary.Clone(item.Value, clonedObjects)); 57 } 58 return clone; 71 return new ItemDictionary<K, V>(this, clonedObjects); 59 72 } 60 73 … … 74 87 foreach (KeyValuePair<K, V> item in dict) { 75 88 XmlNode keyNode = PersistenceManager.Persist("Key", item.Key, document, persistedObjects); 76 XmlNode valueNode = PersistenceManager.Persist("Val", item.Value, document, persistedObjects); 77 XmlNode pairNode = document.CreateNode(XmlNodeType.Element, "KeyValuePair", null); 78 pairNode.AppendChild(keyNode); 79 pairNode.AppendChild(valueNode); 80 node.AppendChild(pairNode); 81 } 82 return node; 89 XmlNode valueNode = PersistenceManager.Persist("Val", item.Value, document, persistedObjects); 90 XmlNode pairNode = document.CreateNode(XmlNodeType.Element, "KeyValuePair", null); 91 pairNode.AppendChild(keyNode); 92 pairNode.AppendChild(valueNode); 93 node.AppendChild(pairNode); 94 } 95 return node; 83 96 } 84 97 … … 94 107 base.Populate(node, restoredObjects); 95 108 for (int i = 0; i < node.ChildNodes.Count; i++) { 96 K key = (K) 97 V val = (V) 98 dict[key] = val; 109 K key = (K)PersistenceManager.Restore(node.ChildNodes[i].SelectSingleNode("Key"), restoredObjects); 110 V val = (V)PersistenceManager.Restore(node.ChildNodes[i].SelectSingleNode("Val"), restoredObjects); 111 dict[key] = val; 99 112 } 100 113 } … … 154 167 /// <c>false</c> if the key was not found.</returns> 155 168 public bool Remove(K key) { 156 V value = dict[key]; 169 V value = dict[key]; 157 170 bool removed = dict.Remove(key); 158 OnItemRemoved(key, value); 159 return removed; 171 OnItemRemoved(key, value); 172 return removed; 160 173 } 161 174 … … 191 204 public void Add(KeyValuePair<K, V> item) { 192 205 dict.Add(item.Key, item.Value); 193 OnItemAdded(item.Key, item.Value); 206 OnItemAdded(item.Key, item.Value); 194 207 } 195 208 … … 201 214 public void Clear() { 202 215 dict.Clear(); 203 OnCleared(); 216 OnCleared(); 204 217 } 205 218 … … 220 233 /// <param name="arrayIndex"></param> 221 234 public void CopyTo(KeyValuePair<K, V>[] array, int arrayIndex) { 222 throw new NotImplementedException(); 235 throw new NotImplementedException(); 223 236 } 224 237 … … 246 259 if (removed) { 247 260 OnItemRemoved(item.Key, item.Value); 248 } 249 return removed; 261 } 262 return removed; 250 263 } 251 264 #endregion … … 328 341 public bool Equals(T x, T y) { 329 342 if (x is IComparable) { 330 return (((IComparable) x).CompareTo(y) == 0);343 return (((IComparable)x).CompareTo(y) == 0); 331 344 } 332 345 if (y is IComparable) { 333 return (((IComparable) y).CompareTo(x) == 0);346 return (((IComparable)y).CompareTo(x) == 0); 334 347 } 335 return x.Equals(y); 348 return x.Equals(y); 336 349 } 337 350 … … 343 356 public int GetHashCode(T obj) { 344 357 if (obj is IObjectData) { 345 return ((IObjectData) obj).Data.GetHashCode();358 return ((IObjectData)obj).Data.GetHashCode(); 346 359 } 347 return obj.Guid.GetHashCode(); 360 return obj.Guid.GetHashCode(); 348 361 } 349 362 } -
branches/CloningRefactorBranch/HeuristicLab.Data/ItemList.cs
r737 r885 33 33 public class ItemList : ItemList<IItem> { 34 34 /// <summary> 35 /// Default constructor for an empty ItemList. 36 /// </summary> 37 public ItemList() { } 38 39 /// <summary> 40 /// Copy constructor to create clones (deep). 41 /// </summary> 42 /// <param name="original">The original instance to be cloned.</param> 43 public ItemList(ItemList original) : this(original, new Dictionary<Guid, object>()) { } 44 /// <summary> 45 /// Copy constructor to create clones (deep) reusing already cloned object references. 46 /// </summary> 47 /// <param name="original">The instance to be cloned.</param> 48 /// <param name="clonedObjects">Already cloned objects (for referential integrity).</param> 49 protected ItemList(ItemList original, IDictionary<Guid, object> clonedObjects) 50 : base(original, clonedObjects) { 51 } 52 53 /// <summary> 35 54 /// Clones the current list and all its elements. 36 55 /// </summary> … … 38 57 /// <returns>The cloned instance as <see cref="ItemList"/>.</returns> 39 58 public override object Clone(IDictionary<Guid, object> clonedObjects) { 40 ItemList clone = new ItemList(); 41 clonedObjects.Add(Guid, clone); 42 base.CloneElements(clone, clonedObjects); 43 return clone; 59 return new ItemList(this, clonedObjects); 44 60 } 45 61 } -
branches/CloningRefactorBranch/HeuristicLab.Data/ItemList_T.cs
r737 r885 41 41 list = new List<T>(); 42 42 } 43 /// <summary> 44 /// Copy constructor to create clones (deep). 45 /// </summary> 46 /// <param name="original">The original instance to be cloned.</param> 47 public ItemList(ItemList<T> original) : this(original, new Dictionary<Guid, object>()) { } 48 /// <summary> 49 /// Copy constructor to create clones (deep) reusing already cloned object references. 50 /// </summary> 51 /// <param name="original">The instance to be cloned.</param> 52 /// <param name="clonedObjects">Already cloned objects (for referential integrity).</param> 53 protected ItemList(ItemList<T> original, IDictionary<Guid, object> clonedObjects) 54 : base(original, clonedObjects) { 55 CloneElements(original, clonedObjects); 56 } 43 57 44 58 /// <summary> … … 51 65 52 66 /// <summary> 53 /// Clones the current instance .67 /// Clones the current instance using the copy constructor. 54 68 /// </summary> 55 69 /// <remarks>Saves the cloned instance in the dictionary <paramref name="clonedObjects"/>.</remarks> … … 57 71 /// <returns>The cloned instance as <see cref="ItemList<T>"/>.</returns> 58 72 public override object Clone(IDictionary<Guid, object> clonedObjects) { 59 ItemList<T> clone = new ItemList<T>(); 60 clonedObjects.Add(Guid, clone); 61 CloneElements(clone, clonedObjects); 62 return clone; 63 } 64 65 /// <summary> 66 /// Clones all elements in the current list. 73 return new ItemList<T>(this, clonedObjects); 74 } 75 76 /// <summary> 77 /// Clones all elements from the supplied ItemList"/>. 67 78 /// </summary> 68 79 /// <remarks>Clones only elements that have not already been cloned 69 80 /// (and therefore exist in the dictionary <paramref name="clonedObjects"/>).</remarks> 70 /// <param name="destination">The <see cref="ItemList<T>"/> where to save thecloned objects.</param>81 /// <param name="destination">The <see cref="ItemList<T>"/> from which to cloned objects.</param> 71 82 /// <param name="clonedObjects">A dictionary of all already cloned objects.</param> 72 protected void CloneElements(ItemList<T> destination, IDictionary<Guid, object> clonedObjects) {73 for (int i = 0; i < list.Count; i++)74 destination.list.Add((T) Auxiliary.Clone(list[i], clonedObjects));83 protected void CloneElements(ItemList<T> original, IDictionary<Guid, object> clonedObjects) { 84 for (int i = 0; i < original.list.Count; i++) 85 this.list.Add((T)Auxiliary.Clone(original.list[i], clonedObjects)); 75 86 } 76 87 … … 99 110 base.Populate(node, restoredObjects); 100 111 for (int i = 0; i < node.ChildNodes.Count; i++) 101 list.Add((T) 112 list.Add((T)PersistenceManager.Restore(node.ChildNodes[i], restoredObjects)); 102 113 } 103 114 -
branches/CloningRefactorBranch/HeuristicLab.Data/NullData.cs
r763 r885 48 48 49 49 /// <summary> 50 /// Clones the current instance. 50 /// Copy constructor to create clones (deep). 51 /// </summary> 52 /// <param name="original">The original instance to be cloned.</param> 53 public NullData(NullData original) : this(original, new Dictionary<Guid, object>()) { } 54 /// <summary> 55 /// Copy constructor to create clones (deep) reusing already cloned object references. 56 /// </summary> 57 /// <param name="original">The instance to be cloned.</param> 58 /// <param name="clonedObjects">Already cloned objects (for referential integrity).</param> 59 protected NullData(NullData original, IDictionary<Guid, object> clonedObjects) 60 : base(original, clonedObjects) { } 61 62 /// <summary> 63 /// Clones the current instance using the copy constructor 51 64 /// </summary> 52 65 /// <remarks>Adds the cloned instance to the dictionary <paramref name="clonedObjects"/>.</remarks> … … 54 67 /// <returns>The cloned instance as <see cref="NullData"/>.</returns> 55 68 public override object Clone(IDictionary<Guid, object> clonedObjects) { 56 NullData clone = new NullData(); 57 clonedObjects.Add(Guid, clone); 58 return clone; 69 return new NullData(this); 59 70 } 60 71 } -
branches/CloningRefactorBranch/HeuristicLab.Data/ObjectData.cs
r763 r885 47 47 48 48 /// <summary> 49 /// Clones the current instance. 49 /// Default constructor to create ObjectData instances 50 /// </summary> 51 public ObjectData() { } 52 53 /// <summary> 54 /// Copy constructor to create clones (deep). 55 /// </summary> 56 /// <param name="original">The original instance to be cloned.</param> 57 public ObjectData(ObjectData original) : this(original, new Dictionary<Guid, object>()) { } 58 59 /// <summary> 60 /// Copy constructor, creates a deep copy of the ObjectData instance. 50 61 /// </summary> 51 62 /// <remarks>HeuristicLab data items are cloned with the <see cref="HeuristicLab.Core.Auxiliary.Clone"/> method of … … 53 64 /// are cloned with their own <c>Clone</c> methods (shadow copy).</remarks> 54 65 /// <exception cref="InvalidOperationException">Thrown when the current instance is not cloneable.</exception> 55 /// <param name="clonedObjects">A dictionary of all already cloned objects.</param> 56 /// <returns>The clone instance.</returns> 57 public override object Clone(IDictionary<Guid, object> clonedObjects) { 58 ObjectData clone = (ObjectData)base.Clone(clonedObjects); 59 if (Data is IStorable) 60 clone.myData = Auxiliary.Clone((IStorable)Data, clonedObjects); 61 else if (Data is ICloneable) 62 clone.myData = ((ICloneable)Data).Clone(); 66 /// <param name="clonedObjects">A dictionary of all already cloned objects (for referential integrity).</param> 67 protected ObjectData(ObjectData original, IDictionary<Guid, object> clonedObjects) 68 : base(original, clonedObjects) { 69 if (original.Data is IStorable) 70 this.myData = Auxiliary.Clone((IStorable)original.Data, clonedObjects); 71 else if (original.Data is ICloneable) 72 this.myData = ((ICloneable)original.Data).Clone(); 63 73 else 64 74 throw new InvalidOperationException("contained object is not cloneable"); 65 return clone;66 75 } 67 76 … … 73 82 /// the contained data is the same, <c>false</c> otherwise.</returns> 74 83 public override bool Equals(object obj) { 75 if (obj == this) return true; // same instance84 if (obj == this) return true; // same instance 76 85 IObjectData other = obj as IObjectData; 77 if (other != null)86 if (other != null) 78 87 return Data.Equals(other.Data); // are the contained Data the same? 79 88 else … … 109 118 } 110 119 120 public override object Clone(IDictionary<Guid, object> clonedObjects) { 121 return new ObjectData(this, clonedObjects); 122 } 123 111 124 /// <summary> 112 125 /// The string representation of the current instance. -
branches/CloningRefactorBranch/HeuristicLab.Data/StringData.cs
r763 r885 55 55 Data = data; 56 56 } 57 58 /// <summary> 59 /// Copy constructor to create clones (deep). 60 /// </summary> 61 /// <param name="original">The original instance to be cloned.</param> 62 public StringData(StringData original) : this(original, new Dictionary<Guid, object>()) { } 63 /// <summary> 64 /// Copy constructor to create clones (deep) reusing already cloned object references. 65 /// </summary> 66 /// <param name="original">The instance to be cloned.</param> 67 /// <param name="clonedObjects">Already cloned objects (for referential integrity).</param> 68 protected StringData(StringData original, IDictionary<Guid, object> clonedObjects) 69 : base(original, clonedObjects) { 70 this.Data = original.Data; 71 } 57 72 58 73 /// <summary> … … 65 80 66 81 /// <summary> 67 /// Clones the current instance .82 /// Clones the current instance using the copy constructor. 68 83 /// </summary> 69 84 /// <remarks>The current instance is added to the dictionary <paramref name="clonedObjects"/>.</remarks> 70 /// <param name="clonedObjects">A dictionary of all already cloned objects .</param>85 /// <param name="clonedObjects">A dictionary of all already cloned objects (for referential integrity).</param> 71 86 /// <returns>The coned instance as <see cref="StringData"/>.</returns> 72 87 public override object Clone(IDictionary<Guid, object> clonedObjects) { 73 StringData clone = new StringData(); 74 clonedObjects.Add(Guid, clone); 75 clone.Data = Data; 76 return clone; 88 return new StringData(this, clonedObjects); 77 89 } 78 90
Note: See TracChangeset
for help on using the changeset viewer.