1 | using System;
|
---|
2 | using System.Collections.Generic;
|
---|
3 | namespace Netron.Diagramming.Core {
|
---|
4 | /// <summary>
|
---|
5 | /// Describes the CollectionBase collection.
|
---|
6 | /// </summary>
|
---|
7 | /// <typeparam name="T"></typeparam>
|
---|
8 | public interface ICollectionBase<T> : ICollection<T>, IList<T> {
|
---|
9 | #region Events
|
---|
10 | /// <summary>
|
---|
11 | /// Occurs when the collection is cleared.
|
---|
12 | /// </summary>
|
---|
13 | event EventHandler OnClear;
|
---|
14 | /// <summary>
|
---|
15 | /// Occurs when an item is added to the collection.
|
---|
16 | /// </summary>
|
---|
17 | event EventHandler<CollectionEventArgs<T>> OnItemAdded;
|
---|
18 | /// <summary>
|
---|
19 | /// Occurs when en item is removed from the collection.
|
---|
20 | /// </summary>
|
---|
21 | event EventHandler<CollectionEventArgs<T>> OnItemRemoved;
|
---|
22 | #endregion
|
---|
23 |
|
---|
24 | #region Properties
|
---|
25 |
|
---|
26 | #endregion
|
---|
27 |
|
---|
28 | #region Methods
|
---|
29 | /// <summary>
|
---|
30 | /// Adds the range of items to the collection.
|
---|
31 | /// </summary>
|
---|
32 | /// <param name="items">The items.</param>
|
---|
33 | void AddRange(CollectionBase<T> items);
|
---|
34 | /// <summary>
|
---|
35 | /// Copies this instance.
|
---|
36 | /// </summary>
|
---|
37 | /// <returns></returns>
|
---|
38 | CollectionBase<T> Copy();
|
---|
39 | /// <summary>
|
---|
40 | /// Creates a deep copy of this instance.
|
---|
41 | /// </summary>
|
---|
42 | /// <returns></returns>
|
---|
43 | CollectionBase<T> DeepCopy();
|
---|
44 | /// <summary>
|
---|
45 | /// Uses the given predicate to test the existence of a certain item in the collection.
|
---|
46 | /// </summary>
|
---|
47 | /// <param name="predicate">The predicate.</param>
|
---|
48 | /// <returns></returns>
|
---|
49 | bool Exists(Predicate<T> predicate);
|
---|
50 | /// <summary>
|
---|
51 | /// Finds the specified predicate.
|
---|
52 | /// </summary>
|
---|
53 | /// <param name="predicate">The predicate.</param>
|
---|
54 | /// <returns></returns>
|
---|
55 | T Find(Predicate<T> predicate);
|
---|
56 | /// <summary>
|
---|
57 | /// Uses the given Action to act on the collection items
|
---|
58 | /// </summary>
|
---|
59 | /// <param name="action">The action.</param>
|
---|
60 | void ForEach(Action<T> action);
|
---|
61 |
|
---|
62 |
|
---|
63 | ICollection<T> RemoveAll(Predicate<T> predicate);
|
---|
64 |
|
---|
65 | /// <summary>
|
---|
66 | /// Converts the collection to an array.
|
---|
67 | /// </summary>
|
---|
68 | /// <returns></returns>
|
---|
69 | T[] ToArray();
|
---|
70 | /// <summary>
|
---|
71 | /// Specific copy/paste utility function.
|
---|
72 | /// </summary>
|
---|
73 | /// <returns></returns>
|
---|
74 | System.IO.MemoryStream ToStream();
|
---|
75 | /// <summary>
|
---|
76 | /// Returns a string representation of the collection.
|
---|
77 | /// </summary>
|
---|
78 | /// <param name="format">The format.</param>
|
---|
79 | /// <param name="formatProvider">The format provider.</param>
|
---|
80 | /// <returns></returns>
|
---|
81 | string ToString(string format, IFormatProvider formatProvider);
|
---|
82 | /// <summary>
|
---|
83 | /// Returns a string representation of the collection.
|
---|
84 | /// </summary>
|
---|
85 | /// <returns></returns>
|
---|
86 | string ToString();
|
---|
87 | /// <summary>
|
---|
88 | /// Checks, using the given predicate, whether a certain property is true for all items in the collection.
|
---|
89 | /// </summary>
|
---|
90 | /// <param name="predicate">The predicate.</param>
|
---|
91 | /// <returns></returns>
|
---|
92 | bool TrueForAll(Predicate<T> predicate);
|
---|
93 | #endregion
|
---|
94 |
|
---|
95 |
|
---|
96 |
|
---|
97 | }
|
---|
98 | }
|
---|