Changeset 885 for branches/CloningRefactorBranch/HeuristicLab.Constraints/AllSubOperatorsTypeConstraint.cs
- Timestamp:
- 12/02/08 14:13:06 (15 years ago)
- File:
-
- 1 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
Note: See TracChangeset
for help on using the changeset viewer.