Removed untyped contructor from ComponentRegistration and add a protected setter.
[castle.git] / Core / Castle.Core / Model / InterceptorReferenceCollection.cs
blobea7b1ddad51f0f57a48086ac578da636cc15269d
1 // Copyright 2004-2008 Castle Project - http://www.castleproject.org/
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
15 namespace Castle.Core
17 using System;
18 using System.Collections;
19 using Castle.Core.Internal;
21 /// <summary>
22 /// Collection of <see cref="InterceptorReference"/>
23 /// </summary>
24 [Serializable]
25 public class InterceptorReferenceCollection : ICollection
27 private readonly LinkedList list = new LinkedList();
29 /// <summary>
30 /// Adds the specified interceptor.
31 /// </summary>
32 /// <param name="interceptor">The interceptor.</param>
33 public void Add(InterceptorReference interceptor)
35 list.Add(interceptor);
38 /// <summary>
39 /// Adds the the specified interceptor as the first.
40 /// </summary>
41 /// <param name="interceptor">The interceptor.</param>
42 public void AddFirst(InterceptorReference interceptor)
44 list.AddFirst(interceptor);
47 /// <summary>
48 /// Adds the the specified interceptor as the last.
49 /// </summary>
50 /// <param name="interceptor">The interceptor.</param>
51 public void AddLast(InterceptorReference interceptor)
53 list.AddLast(interceptor);
56 /// <summary>
57 /// Inserts the specified interceptor at the specified index.
58 /// </summary>
59 /// <param name="index">The index.</param>
60 /// <param name="interceptor">The interceptor.</param>
61 public void Insert(int index, InterceptorReference interceptor)
63 list.Insert(index, interceptor);
66 /// <summary>
67 /// Gets a value indicating whether this instance has interceptors.
68 /// </summary>
69 /// <value>
70 /// <c>true</c> if this instance has interceptors; otherwise, <c>false</c>.
71 /// </value>
72 public bool HasInterceptors
74 get { return Count != 0; }
77 /// <summary>
78 /// When implemented by a class, copies the elements of
79 /// the <see cref="T:System.Collections.ICollection"/> to an <see cref="T:System.Array"/>, starting at a particular <see cref="T:System.Array"/> index.
80 /// </summary>
81 /// <param name="array">The one-dimensional <see cref="T:System.Array"/> that is the destination of the elements copied from <see cref="T:System.Collections.ICollection"/>. The <see cref="T:System.Array"/> must have zero-based indexing.</param>
82 /// <param name="index">The zero-based index in <paramref name="array"/> at which copying begins.</param>
83 /// <exception cref="T:System.ArgumentNullException">
84 /// <paramref name="array"/> is <see langword="null"/>.</exception>
85 /// <exception cref="T:System.ArgumentOutOfRangeException">
86 /// <paramref name="index"/> is less than zero.</exception>
87 /// <exception cref="T:System.ArgumentException">
88 /// <para>
89 /// <paramref name="array"/> is multidimensional.</para>
90 /// <para>-or-</para>
91 /// <para>
92 /// <paramref name="index"/> is equal to or greater than the length of <paramref name="array"/>.</para>
93 /// <para>-or-</para>
94 /// <para>The number of elements in the source <see cref="T:System.Collections.ICollection"/> is greater than the available space from <paramref name="index"/> to the end of the destination <paramref name="array"/>.</para>
95 /// </exception>
96 /// <exception cref="T:System.InvalidCastException">The type of the source <see cref="T:System.Collections.ICollection"/> cannot be cast automatically to the type of the destination <paramref name="array"/>.</exception>
97 public void CopyTo(Array array, int index)
99 throw new NotImplementedException();
102 /// <summary>
103 /// Gets the number of
104 /// elements contained in the <see cref="T:System.Collections.ICollection"/>.
105 /// </summary>
106 /// <value></value>
107 public int Count
109 get { return list.Count; }
112 /// <summary>
113 /// Gets an object that
114 /// can be used to synchronize access to the <see cref="T:System.Collections.ICollection"/>.
115 /// </summary>
116 /// <value></value>
117 public object SyncRoot
119 get { return list; }
122 /// <summary>
123 /// Gets a value
124 /// indicating whether access to the <see cref="T:System.Collections.ICollection"/> is synchronized
125 /// (thread-safe).
126 /// </summary>
127 /// <value></value>
128 public bool IsSynchronized
130 get { return false; }
133 /// <summary>
134 /// Returns an enumerator that can iterate through a collection.
135 /// </summary>
136 /// <returns>
137 /// An <see cref="T:System.Collections.IEnumerator"/>
138 /// that can be used to iterate through the collection.
139 /// </returns>
140 public IEnumerator GetEnumerator()
142 return list.GetEnumerator();
145 /// <summary>
146 /// Adds the interceptor to the end of the interceptors list if it does not exist already.
147 /// </summary>
148 /// <param name="interceptorReference">The interceptor reference.</param>
149 public void AddIfNotInCollection(InterceptorReference interceptorReference)
151 if (list.Contains(interceptorReference) == false)
152 list.AddLast(interceptorReference);