- Timestamp:
- 07/30/09 10:47:00 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/GP-Refactoring-713/sources/HeuristicLab.GP/3.3/FunctionLibrary.cs
r2210 r2212 26 26 using HeuristicLab.Core; 27 27 using System.Xml; 28 using HeuristicLab.Data;29 using HeuristicLab.Constraints;30 28 using HeuristicLab.GP.Interfaces; 31 29 … … 41 39 } 42 40 43 44 41 public void AddFunction(IFunction fun) { 45 if (!functions.Contains(fun)) functions.Add(fun); 46 // OnFunctionAdded(fun); 42 if (!functions.Contains(fun)) { 43 functions.Add(fun); 44 OnChanged(); 45 } 47 46 } 48 49 //void UpdateTreeBounds(object sender, EventArgs e) {50 // RecalculateMinimalTreeBounds();51 //}52 53 54 //private void GetMinMaxArity(IOperator op, out int minArity, out int maxArity) {55 // foreach (IConstraint constraint in op.Constraints) {56 // NumberOfSubOperatorsConstraint theConstraint = constraint as NumberOfSubOperatorsConstraint;57 // if (theConstraint != null) {58 // minArity = theConstraint.MinOperators.Data;59 // maxArity = theConstraint.MaxOperators.Data;60 // return;61 // }62 // }63 // // the default arity is 264 // minArity = 2;65 // maxArity = 2;66 //}67 47 68 48 public void RemoveFunction(IFunction fun) { 69 49 functions.Remove(fun); 70 50 71 // remove the operator from the allowed sub-functions of the remaining operators51 // remove the operator from the allowed sub-functions of all functions 72 52 foreach (IFunction f in Functions) { 73 if (f != fun) { 53 for (int i = 0; i < f.MaxSubTrees; i++) { 54 f.RemoveAllowedSubFunction(fun, i); 74 55 } 75 56 } 76 // OnFunctionRemoved(fun);57 OnChanged(); 77 58 } 78 79 //public event EventHandler FunctionAdded;80 //public event EventHandler FunctionRemoved;81 82 //protected virtual void OnFunctionAdded(IFunction fun) {83 // if (FunctionAdded != null) {84 // FunctionAdded(this, new EventArgs(fun));85 // }86 //}87 //protected virtual void OnFunctionRemoved(IFunction fun) {88 // if (FunctionRemoved != null) {89 // FunctionRemoved(this, new EventArgs(fun));90 // }91 //}92 59 93 60 public override IView CreateView() {
Note: See TracChangeset
for help on using the changeset viewer.