Changeset 53


Ignore:
Timestamp:
03/06/08 19:17:54 (13 years ago)
Author:
mkofler
Message:

Worked on ticket #51

  • implemented AddRange, Exists and FindAll
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Data/ItemList_T.cs

    r41 r53  
    4343      clonedObjects.Add(Guid, clone);
    4444      for (int i = 0; i < list.Count; i++)
    45         clone.list.Add((T)Auxiliary.Clone(list[i], clonedObjects));
     45        clone.list.Add((T) Auxiliary.Clone(list[i], clonedObjects));
    4646      return clone;
    4747    }
    4848
    49     public override XmlNode GetXmlNode(string name, XmlDocument document, IDictionary<Guid,IStorable> persistedObjects) {
     49    public override XmlNode GetXmlNode(string name, XmlDocument document, IDictionary<Guid, IStorable> persistedObjects) {
    5050      XmlNode node = base.GetXmlNode(name, document, persistedObjects);
    5151      for (int i = 0; i < list.Count; i++)
     
    5353      return node;
    5454    }
    55     public override void Populate(XmlNode node, IDictionary<Guid,IStorable> restoredObjects) {
     55    public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) {
    5656      base.Populate(node, restoredObjects);
    5757      for (int i = 0; i < node.ChildNodes.Count; i++)
    58         list.Add((T)PersistenceManager.Restore(node.ChildNodes[i], restoredObjects));
     58        list.Add((T) PersistenceManager.Restore(node.ChildNodes[i], restoredObjects));
    5959    }
    6060
     
    136136    #endregion
    137137
     138    #region List<T> Methods
     139    public void AddRange(IEnumerable<T> collection) {
     140      foreach (T obj in collection) {
     141        this.Add(obj);
     142      }
     143    }
     144
     145    public bool Exists(Predicate<T> match) {
     146      return list.Exists(match);
     147    }
     148
     149    public List<T> FindAll(Predicate<T> match) {
     150      return list.FindAll(match);
     151    }
     152    #endregion
     153
    138154    public event EventHandler<ItemIndexEventArgs> ItemAdded;
    139155    protected virtual void OnItemAdded(IItem item, int index) {
Note: See TracChangeset for help on using the changeset viewer.