Changeset 430 for trunk/sources/HeuristicLab.Constraints
- Timestamp:
- 08/03/08 23:14:08 (16 years ago)
- Location:
- trunk/sources/HeuristicLab.Constraints
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Constraints/AllSubOperatorsTypeConstraintView.cs
r2 r430 87 87 #endregion 88 88 89 #region Drag Events 90 89 #region Drag Events 91 90 private void listView_DragDrop(object sender, DragEventArgs e) { 92 91 if(e.Effect != DragDropEffects.None) { … … 105 104 } 106 105 107 108 106 private void listView_DragEnter(object sender, DragEventArgs e) { 109 107 this.FindForm().BringToFront(); … … 117 115 } 118 116 } 119 120 117 121 118 private void listView_DragOver(object sender, DragEventArgs e) { -
trunk/sources/HeuristicLab.Constraints/SubOperatorsConstraintAnalyser.cs
r155 r430 91 91 private static bool InSet(IOperator op, ICollection<IOperator> set) { 92 92 foreach(IOperator element in set) { 93 if(element==op || 94 ((StringData)element.GetVariable("TypeId").Value).Data == 95 ((StringData)op.GetVariable("TypeId").Value).Data) { 93 if(element == op) 96 94 return true; 97 }98 95 } 99 100 96 return false; 101 97 } … … 132 128 } 133 129 } 134 130 135 131 public override void Visit(OrConstraint constraint) { 136 132 base.Visit(constraint); -
trunk/sources/HeuristicLab.Constraints/SubOperatorsTypeConstraint.cs
r2 r430 55 55 // check if already in the list of allowed functions 56 56 foreach(IOperator existingOp in subOperators) { 57 if (IsOperatorTypeEqual(existingOp, op)) {57 if(existingOp == op) { 58 58 return; 59 59 } … … 66 66 IOperator matchingOperator = null; 67 67 foreach(IOperator existingOp in subOperators) { 68 if( IsOperatorTypeEqual(existingOp, op)) {68 if(existingOp == op) { 69 69 matchingOperator = existingOp; 70 70 break; … … 72 72 } 73 73 74 if 74 if(matchingOperator != null) { 75 75 subOperators.Remove(matchingOperator); 76 76 } … … 79 79 public override bool Check(IItem data) { 80 80 IOperator op = data as IOperator; 81 if 81 if(data == null) return false; 82 82 83 83 if(op.SubOperators.Count <= subOperatorIndex.Data) { 84 84 return false; 85 85 } 86 87 return subOperators.Exists(delegate(IOperator curOp) { return IsOperatorTypeEqual(curOp, op.SubOperators[subOperatorIndex.Data]); });86 87 return subOperators.Exists(delegate(IOperator curOp) { return curOp == op.SubOperators[subOperatorIndex.Data]; }); 88 88 } 89 89 … … 108 108 109 109 #region persistence 110 public override XmlNode GetXmlNode(string name, XmlDocument document, IDictionary<Guid, IStorable> persistedObjects) {110 public override XmlNode GetXmlNode(string name, XmlDocument document, IDictionary<Guid, IStorable> persistedObjects) { 111 111 XmlNode node = base.GetXmlNode(name, document, persistedObjects); 112 112 XmlNode indexNode = PersistenceManager.Persist("SubOperatorIndex", subOperatorIndex, document, persistedObjects); … … 121 121 } 122 122 123 public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) {123 public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) { 124 124 base.Populate(node, restoredObjects); 125 125 subOperatorIndex = (IntData)PersistenceManager.Restore(node.SelectSingleNode("SubOperatorIndex"), restoredObjects); … … 131 131 #endregion persistence 132 132 133 134 private bool IsOperatorTypeEqual(IOperator f, IOperator g) {135 return ((StringData)f.GetVariable("TypeId").Value).Data == ((StringData)g.GetVariable("TypeId").Value).Data;136 }137 133 } 138 134 }
Note: See TracChangeset
for help on using the changeset viewer.