- Timestamp:
- 01/27/09 09:31:06 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Constraints/NumberOfSubOperatorsConstraint.cs
r764 r1176 29 29 30 30 namespace HeuristicLab.Constraints { 31 /// <summary> 32 /// Constraint where the number of sub-operators must be within a specific range. 33 /// </summary> 31 34 public class NumberOfSubOperatorsConstraint : ConstraintBase { 32 35 private IntData minOperators; 33 36 private IntData maxOperators; 34 37 38 /// <summary> 39 /// Gets the maximum number of sub-operators. 40 /// </summary> 35 41 public IntData MaxOperators { 36 42 get { return maxOperators; } 37 43 } 38 44 45 /// <summary> 46 /// Gets the minimum number of sub-operators. 47 /// </summary> 39 48 public IntData MinOperators { 40 49 get { return minOperators; } 41 50 } 42 51 52 /// <inheritdoc select="summary"/> 43 53 public override string Description { 44 54 get { return "Number of sub-operators has to be between " + MinOperators.ToString() + " and " + MaxOperators.ToString() + "."; } 45 55 } 46 56 57 /// <summary> 58 /// Initializes a new instance of <see cref="NumberOfSubOperatorsConstraint"/>. 59 /// </summary> 47 60 public NumberOfSubOperatorsConstraint() 48 61 : this(0,0) { 49 62 } 50 63 64 /// <summary> 65 /// Initializes a new instance of <see cref="NumberOfSubOperatorsConstraint"/> with the minimum and 66 /// the maximum number of sub-operators. 67 /// </summary> 68 /// <param name="min">The minimum number of sub-operators.</param> 69 /// <param name="max">The maximum number of sub-operators.</param> 51 70 public NumberOfSubOperatorsConstraint(int min, int max) : base() { 52 71 minOperators = new IntData(min); … … 54 73 } 55 74 75 /// <summary> 76 /// Checks whether the given element fulfills the current constraint. 77 /// </summary> 78 /// <param name="data">The item to check.</param> 79 /// <returns><c>true</c> if the constraint could be fulfilled, <c>false</c> otherwise.</returns> 56 80 public override bool Check(IItem data) { 57 81 IOperator op = data as IOperator; … … 61 85 } 62 86 87 /// <summary> 88 /// Clones the current instance (deep clone). 89 /// </summary> 90 /// <param name="clonedObjects">Dictionary of all already clone objects. (Needed to avoid cycles.)</param> 91 /// <returns>The cloned object as <see cref="AndConstraint"/>.</returns> 63 92 public override object Clone(IDictionary<Guid, object> clonedObjects) { 64 93 NumberOfSubOperatorsConstraint clone = new NumberOfSubOperatorsConstraint(); … … 69 98 } 70 99 100 /// <summary> 101 /// Creates a new instance of <see cref="NumberOfSubOperatorsConstraintView"/> to represent the current 102 /// instance visually. 103 /// </summary> 104 /// <returns>The created view as <see cref="NumberOfSubOperatorsConstraintView"/>.</returns> 71 105 public override IView CreateView() { 72 106 return new NumberOfSubOperatorsConstraintView(this); … … 74 108 75 109 #region persistence 110 /// <summary> 111 /// Saves the current instance as <see cref="XmlNode"/> in the specified <paramref name="document"/>. 112 /// </summary> 113 /// <remarks>The minimum and the maximum number of sub-operators are saved as child nodes with tag 114 /// names <c>min</c> and <c>max</c>.</remarks> 115 /// <param name="name">The (tag)name of the <see cref="XmlNode"/>.</param> 116 /// <param name="document">The <see cref="XmlDocument"/> where the data is saved.</param> 117 /// <param name="persistedObjects">The dictionary of all already persisted objects. 118 /// (Needed to avoid cycles.)</param> 119 /// <returns>The saved <see cref="XmlNode"/>.</returns> 76 120 public override XmlNode GetXmlNode(string name, XmlDocument document, IDictionary<Guid,IStorable> persistedObjects) { 77 121 XmlNode node = base.GetXmlNode(name, document, persistedObjects); … … 83 127 } 84 128 129 /// <summary> 130 /// Loads the persisted constraint from the specified <paramref name="node"/>. 131 /// </summary> 132 /// <remarks>The constraint must be saved in a specific way, see <see cref="GetXmlNode"/> for 133 /// more information.</remarks> 134 /// <param name="node">The <see cref="XmlNode"/> where the instance is saved.</param> 135 /// <param name="restoredObjects">The dictionary of all already restored objects. 136 /// (Needed to avoid cycles.)</param> 85 137 public override void Populate(XmlNode node, IDictionary<Guid,IStorable> restoredObjects) { 86 138 base.Populate(node, restoredObjects);
Note: See TracChangeset
for help on using the changeset viewer.