root/src/BRAINSFramework/PriorityQueue.cs
| 13 | 21 | ||
|---|---|---|---|
13 | /// <typeparam name="TValue">The type of object in the queue.</typeparam> | 13 | /// <typeparam name="TValue">The type of object in the queue.</typeparam> |
14 | /// <typeparam name="TPriority">The type of the priority field.</typeparam> | 14 | /// <typeparam name="TPriority">The type of the priority field.</typeparam> |
15 | [Serializable] | 15 | [Serializable] |
16 | public struct PriorityQueueItem<TValue, TPriority> | 16 | internal struct PriorityQueueItem<TValue, TPriority> |
17 | { | 17 | { |
18 | private TValue value; | 18 | private TValue value; |
19 | private TPriority priority; | 19 | private TPriority priority; |
... | ... | ||
49 | /// <typeparam name="TPriority">The type of the priority field.</typeparam> | 49 | /// <typeparam name="TPriority">The type of the priority field.</typeparam> |
50 | [Serializable] | 50 | [Serializable] |
51 | [ComVisible(false)] | 51 | [ComVisible(false)] |
52 | public class PriorityQueue<TValue, TPriority> : ICollection, | 52 | internal class PriorityQueue<TValue, TPriority> : ICollection, IEnumerable<PriorityQueueItem<TValue, TPriority>> |
53 | IEnumerable<PriorityQueueItem<TValue, TPriority>> | ||
54 | { | 53 | { |
55 | private PriorityQueueItem<TValue, TPriority>[] items; | 54 | private PriorityQueueItem<TValue, TPriority>[] items; |
56 | 55 | ||
... | ... | ||
64 | /// Initializes a new instance of the PriorityQueue class that is empty, | 63 | /// Initializes a new instance of the PriorityQueue class that is empty, |
65 | /// has the default initial capacity, and uses the default IComparer. | 64 | /// has the default initial capacity, and uses the default IComparer. |
66 | /// </summary> | 65 | /// </summary> |
67 | public PriorityQueue() | 66 | public PriorityQueue() : this(DefaultCapacity, Comparer<TPriority>.Default) |
68 | : this(DefaultCapacity, Comparer<TPriority>.Default) | ||
69 | { | 67 | { |
70 | } | 68 | } |
71 | 69 | ||
... | ... | ||
74 | /// has the specified initial capacity, and uses the default IComparer. | 72 | /// has the specified initial capacity, and uses the default IComparer. |
75 | /// </summary> | 73 | /// </summary> |
76 | /// <param name="initialCapacity">Desired initial capacity.</param> | 74 | /// <param name="initialCapacity">Desired initial capacity.</param> |
77 | public PriorityQueue(Int32 initialCapacity) | 75 | public PriorityQueue(Int32 initialCapacity) : this(initialCapacity, Comparer<TPriority>.Default) |
78 | : this(initialCapacity, Comparer<TPriority>.Default) | ||
79 | { | 76 | { |
80 | } | 77 | } |
81 | 78 | ||
... | ... | ||
85 | /// </summary> | 82 | /// </summary> |
86 | /// <param name="comparer">An object that implements the IComparer interface | 83 | /// <param name="comparer">An object that implements the IComparer interface |
87 | /// for items of type TPriority.</param> | 84 | /// for items of type TPriority.</param> |
88 | public PriorityQueue(IComparer<TPriority> comparer) | 85 | public PriorityQueue(IComparer<TPriority> comparer) : this(DefaultCapacity, comparer) |
89 | : this(DefaultCapacity, comparer) | ||
90 | { | 86 | { |
91 | } | 87 | } |
92 | 88 | ||
... | ... | ||
427 | } | 423 | } |
428 | #endregion | 424 | #endregion |
429 | 425 | ||
430 | public class PriorityQueueB<T> : IPriorityQueue<T> | 426 | internal class PriorityQueueB<T> : IPriorityQueue<T> |
431 | { | 427 | { |
432 | #region Variables Declaration | 428 | #region Variables Declaration |
433 | protected List<T> InnerList = new List<T>(); | 429 | protected List<T> InnerList = new List<T>(); |
Download diff