-
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
/******************************************************************************
* The MIT License
* Copyright (c) 2003 Novell Inc. www.novell.com
/// to Vector needed for handling messages.
/// </summary>
/* package */
- class MessageVector:System.Collections.ArrayList
+ class MessageVector:System.Collections.IList
{
+ private readonly System.Collections.ArrayList _innerList;
/// <summary>Returns an array containing all of the elements in this MessageVector.
/// The elements returned are in the same order in the array as in the
/// Vector. The contents of the vector are cleared.
/// </summary>
/// <returns> the array containing all of the elements.
/// </returns>
- virtual internal System.Object[] ObjectArray
+ internal System.Object[] ObjectArray
{
/* package */
get
{
- lock (this)
+ lock (this.SyncRoot)
{
- System.Object[] results = new System.Object[Count];
- Array.Copy((System.Array) ToArray(), 0, (System.Array) results, 0, Count);
- for (int i = 0; i < Count; i++)
- {
- ToArray()[i] = null;
- }
-// Count = 0;
+ System.Object[] results = ToArray();
+ Clear();
return results;
}
}
}
/* package */
- internal MessageVector(int cap, int incr):base(cap)
+ internal MessageVector(int cap, int incr)
{
+ _innerList = System.Collections.ArrayList.Synchronized(new System.Collections.ArrayList(cap));
return ;
}
/* package */
internal Message findMessageById(int msgId)
{
- lock (this)
+ lock (this.SyncRoot)
{
Message msg = null;
for (int i = 0; i < Count; i++)
{
- if ((msg = (Message) ToArray()[i]) == null)
+ if ((msg = (Message) this[i]) == null)
{
throw new System.FieldAccessException();
}
throw new System.FieldAccessException();
}
}
+
+ #region ArrayList members\r
+ public object[] ToArray()\r
+ {\r
+ return _innerList.ToArray();\r
+ }\r
+ #endregion\r
+\r
+ #region IList Members\r
+\r
+ public int Add(object value)\r
+ {\r
+ return _innerList.Add(value);\r
+ }\r
+\r
+ public void Clear()\r
+ {\r
+ _innerList.Clear();\r
+ }\r
+\r
+ public bool Contains(object value)\r
+ {\r
+ return _innerList.Contains(value);\r
+ }\r
+\r
+ public int IndexOf(object value)\r
+ {\r
+ return _innerList.IndexOf(value);\r
+ }\r
+\r
+ public void Insert(int index, object value)\r
+ {\r
+ _innerList.Insert(index, value);\r
+ }\r
+\r
+ public bool IsFixedSize\r
+ {\r
+ get { return _innerList.IsFixedSize; }\r
+ }\r
+\r
+ public bool IsReadOnly\r
+ {\r
+ get { return _innerList.IsReadOnly; }\r
+ }\r
+\r
+ public void Remove(object value)\r
+ {\r
+ _innerList.Remove(value);\r
+ }\r
+\r
+ public void RemoveAt(int index)\r
+ {\r
+ _innerList.RemoveAt(index);\r
+ }\r
+\r
+ public object this[int index]\r
+ {\r
+ get\r
+ {\r
+ return _innerList[index];\r
+ }\r
+ set\r
+ {\r
+ _innerList[index] = value;\r
+ }\r
+ }\r
+\r
+ #endregion\r
+\r
+ #region ICollection Members\r
+\r
+ public void CopyTo(Array array, int index)\r
+ {\r
+ _innerList.CopyTo(array, index);\r
+ }\r
+\r
+ public int Count\r
+ {\r
+ get { return _innerList.Count; }\r
+ }\r
+\r
+ public bool IsSynchronized\r
+ {\r
+ get { return _innerList.IsSynchronized; }\r
+ }\r
+\r
+ public object SyncRoot\r
+ {\r
+ get { return _innerList.SyncRoot; }\r
+ }\r
+\r
+ #endregion\r
+\r
+ #region IEnumerable Members\r
+\r
+ public System.Collections.IEnumerator GetEnumerator()\r
+ {\r
+ return _innerList.GetEnumerator();\r
+ }\r
+\r
+ #endregion
}
}