Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
11/19/08 12:12:39 (16 years ago)
Author:
vdorfer
Message:

Created API documentation for HeuristicLab.Core namespace (#331)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Core/ConstrainedItemBase.cs

    r2 r776  
    2626
    2727namespace HeuristicLab.Core {
     28  /// <summary>
     29  /// Base class for all items that are subjects to restrictions.
     30  /// </summary>
    2831  public abstract class ConstrainedItemBase : ItemBase, IConstrainedItem {
    2932    private List<IConstraint> myConstraints;
     33    /// <summary>
     34    /// Gets all current constraints.
     35    /// <note type="caution"> The constraints are returned read-only.</note>
     36    /// </summary>
    3037    public virtual ICollection<IConstraint> Constraints {
    3138      get { return myConstraints.AsReadOnly(); }
    3239    }
    3340
     41    /// <summary>
     42    /// Initializes a new instance of <see cref="ConstrainedItemBase"/>.
     43    /// </summary>
    3444    protected ConstrainedItemBase() {
    3545      myConstraints = new List<IConstraint>();
    3646    }
    3747
     48    /// <summary>
     49    /// Clones the current instance (deep clone).
     50    /// </summary>
     51    /// <remarks>Calls <see cref="StorableBase.Clone
     52    /// (System.Collections.Generic.IDictionary&lt;System.Guid, object&gt;)"/>
     53    /// of base class <see cref="ItemBase"/>.<br/>
     54    /// Deep clone through <see cref="Auxiliary.Clone"/> method of helper class
     55    /// <see cref="Auxiliary"/>.</remarks>
     56    /// <param name="clonedObjects">Dictionary of all already cloned objects. (Needed to avoid cycles.)</param>
     57    /// <returns>The cloned object as <see cref="ConstrainedItemBase"/>.</returns>
    3858    public override object Clone(IDictionary<Guid, object> clonedObjects) {
    3959      ConstrainedItemBase clone = (ConstrainedItemBase)base.Clone(clonedObjects);
     
    4464    }
    4565
     66    /// <summary>
     67    /// Adds the given <paramref name="constraint"/> to the current list.
     68    /// </summary>
     69    /// <remarks>Calls <see cref="OnConstraintAdded"/>.</remarks>
     70    /// <param name="constraint">The constraint to add.</param>
    4671    public virtual void AddConstraint(IConstraint constraint) {
    4772      myConstraints.Add(constraint);
    4873      OnConstraintAdded(constraint);
    4974    }
     75    /// <summary>
     76    /// Removes the given <paramref name="constraint"/> from the current list.
     77    /// </summary>
     78    /// <remarks>Calls <see cref="OnConstraintRemoved"/> if the constraint can be successfully removed.</remarks>
     79    /// <param name="constraint">The constraint to remove.</param>
    5080    public virtual void RemoveConstraint(IConstraint constraint) {
    5181      if (myConstraints.Remove(constraint))
     
    5383    }
    5484
     85    /// <summary>
     86    /// Checks all constraints of the current instance.
     87    /// </summary>
     88    /// <returns><c>true</c> if all constraints could be fulfilled, <c>false</c> otherwise.</returns>
    5589    public bool IsValid() {
    5690      bool result = true;
     
    5993      return result;
    6094    }
     95    /// <summary>
     96    /// Checks all constraints of the current instance.
     97    /// </summary>
     98    /// <param name="violatedConstraints">Output parameter; contains all constraints that could not be
     99    /// fulfilled.</param>
     100    /// <returns><c>true</c> if all constraints could be fulfilled, <c>false</c> otherwise.</returns>
    61101    public bool IsValid(out ICollection<IConstraint> violatedConstraints) {
    62102      bool result = true;
     
    71111    }
    72112
     113    /// <summary>
     114    /// Creates an instance of <see cref="ConstrainedItemBaseView"/>
     115    /// to represent the current instance visually.
     116    /// </summary>
     117    /// <returns>The created view as <see cref="ConstrainedItemBase"/>.</returns>
    73118    public override IView CreateView() {
    74119      return new ConstrainedItemBaseView(this);
    75120    }
    76121
     122    /// <summary>
     123    /// Occurs when a constraint is added.
     124    /// </summary>
    77125    public event EventHandler<ConstraintEventArgs> ConstraintAdded;
     126    /// <summary>
     127    /// Fires a new <c>ConstraintAdded</c> event.
     128    /// </summary>
     129    /// <param name="constraint">The constraint that was added.</param>
    78130    protected virtual void OnConstraintAdded(IConstraint constraint) {
    79131      if (ConstraintAdded != null)
    80132        ConstraintAdded(this, new ConstraintEventArgs(constraint));
    81133    }
     134    /// <summary>
     135    /// Occurs when a constraint is removed.
     136    /// </summary>
    82137    public event EventHandler<ConstraintEventArgs> ConstraintRemoved;
     138    /// <summary>
     139    /// Fires a new <c>ConstraintRemoved</c> event.
     140    /// </summary>
     141    /// <param name="constraint">The constraint that was removed.</param>
    83142    protected virtual void OnConstraintRemoved(IConstraint constraint) {
    84143      if (ConstraintRemoved != null)
     
    86145    }
    87146
    88     #region Persistence Methods
     147    #region Persistence Methods 
     148    /// <summary>
     149    /// Saves the current instance as <see cref="XmlNode"/> in the specified <paramref name="document"/>.
     150    /// </summary>
     151    /// <remarks>Calls <see cref="StorableBase.GetXmlNode"/> of base class <see cref="ItemBase"/>. <br/>
     152    /// For saving the constraints a child node is created having the tag name <c>Constraints</c>. Beyond this
     153    /// child node all constraints are saved as child nodes themselves.</remarks>
     154    /// <param name="name">The (tag)name of the <see cref="XmlNode"/>.</param>
     155    /// <param name="document">The <see cref="XmlDocument"/> where to save the data.</param>
     156    /// <param name="persistedObjects">The dictionary of all already persisted objects.
     157    /// (Needed to avoid cycles.)</param>
     158    /// <returns>The saved <see cref="XmlNode"/>.</returns>
    89159    public override XmlNode GetXmlNode(string name, XmlDocument document, IDictionary<Guid,IStorable> persistedObjects) {
    90160      XmlNode node = base.GetXmlNode(name, document, persistedObjects);
     
    97167      return node;
    98168    }
     169    /// <summary>
     170    ///  Loads the persisted item from the specified <paramref name="node"/>.
     171    /// </summary>
     172    /// <remarks>See <see cref="GetXmlNode"/> to get information about how the constrained item must
     173    /// be saved. <br/>
     174    /// Calls <see cref="StorableBase.Populate"/> of base class <see cref="ItemBase"/>.</remarks>
     175    /// <param name="node">The <see cref="XmlNode"/> where the constrained item is saved.</param>
     176    /// <param name="restoredObjects">The dictionary of all already restored objects.
     177    /// (Needed to avoid cycles.)</param>
    99178    public override void Populate(XmlNode node, IDictionary<Guid,IStorable> restoredObjects) {
    100179      base.Populate(node, restoredObjects);
Note: See TracChangeset for help on using the changeset viewer.