Changeset 732
- Timestamp:
- 11/11/08 12:20:45 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Data/ConstrainedItemList.cs
r347 r732 114 114 public bool TryInsert(int index, IItem item, out ICollection<IConstraint> violatedConstraints) { 115 115 list.Insert(index, item); 116 violatedConstraints = new List<IConstraint>(); 116 117 if (!suspendConstraintCheck && IsValid(out violatedConstraints)) { 117 118 OnItemAdded(item, index); 118 119 return true; 119 120 } else { 120 violatedConstraints = new List<IConstraint>();121 121 list.RemoveAt(index); 122 122 return false; … … 127 127 IItem item = list[index]; 128 128 list.RemoveAt(index); 129 violatedConstraints = new List<IConstraint>(); 129 130 if (!suspendConstraintCheck && IsValid(out violatedConstraints)) { 130 131 OnItemRemoved(item, index); 131 132 return true; 132 133 } else { 133 violatedConstraints = new List<IConstraint>();134 134 list.Insert(index, item); 135 135 return false; … … 144 144 IItem backup = this[index]; 145 145 list[index] = item; 146 if (!suspendConstraintCheck && IsValid(out violatedConstraints)) {147 return true;148 } else {149 violatedConstraints = new List<IConstraint>();146 violatedConstraints = new List<IConstraint>(); 147 if (!suspendConstraintCheck && IsValid(out violatedConstraints)) { 148 return true; 149 } else { 150 150 list[index] = backup; 151 151 return false; … … 155 155 public bool TryAdd(IItem item, out ICollection<IConstraint> violatedConstraints) { 156 156 list.Add(item); 157 violatedConstraints = new List<IConstraint>(); 157 158 if (!suspendConstraintCheck && IsValid(out violatedConstraints)) { 158 159 OnItemAdded(item, list.Count - 1); 159 160 return true; 160 161 } else { 161 violatedConstraints = new List<IConstraint>();162 162 list.RemoveAt(list.Count - 1); 163 163 return false;
Note: See TracChangeset
for help on using the changeset viewer.