(DISTFILES): Comment out a few missing files.
[mono-project.git] / mcs / class / Novell.Directory.Ldap / Novell.Directory.Ldap / MessageVector.cs
blob40e3c61fff5d47f0fd935c4ea47ce79adbc9e3fe
2 //
3 // Permission is hereby granted, free of charge, to any person obtaining
4 // a copy of this software and associated documentation files (the
5 // "Software"), to deal in the Software without restriction, including
6 // without limitation the rights to use, copy, modify, merge, publish,
7 // distribute, sublicense, and/or sell copies of the Software, and to
8 // permit persons to whom the Software is furnished to do so, subject to
9 // the following conditions:
10 //
11 // The above copyright notice and this permission notice shall be
12 // included in all copies or substantial portions of the Software.
13 //
14 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22 /******************************************************************************
23 * The MIT License
24 * Copyright (c) 2003 Novell Inc. www.novell.com
26 * Permission is hereby granted, free of charge, to any person obtaining a copy
27 * of this software and associated documentation files (the Software), to deal
28 * in the Software without restriction, including without limitation the rights
29 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
30 * copies of the Software, and to permit persons to whom the Software is
31 * furnished to do so, subject to the following conditions:
33 * The above copyright notice and this permission notice shall be included in
34 * all copies or substantial portions of the Software.
36 * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
37 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
38 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
39 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
40 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
41 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
42 * SOFTWARE.
43 *******************************************************************************/
45 // Novell.Directory.Ldap.MessageVector.cs
47 // Author:
48 // Sunil Kumar (Sunilk@novell.com)
50 // (C) 2003 Novell, Inc (http://www.novell.com)
53 using System;
55 namespace Novell.Directory.Ldap
58 /// <summary> The <code>MessageVector</code> class implements additional semantics
59 /// to Vector needed for handling messages.
60 /// </summary>
61 /* package */
62 class MessageVector:System.Collections.ArrayList
64 /// <summary>Returns an array containing all of the elements in this MessageVector.
65 /// The elements returned are in the same order in the array as in the
66 /// Vector. The contents of the vector are cleared.
67 ///
68 /// </summary>
69 /// <returns> the array containing all of the elements.
70 /// </returns>
71 virtual internal System.Object[] ObjectArray
73 /* package */
75 get
77 lock (this)
79 System.Object[] results = new System.Object[Count];
80 Array.Copy((System.Array) ToArray(), 0, (System.Array) results, 0, Count);
81 for (int i = 0; i < Count; i++)
83 ToArray()[i] = null;
85 // Count = 0;
86 return results;
91 /* package */
92 internal MessageVector(int cap, int incr):base(cap)
94 return ;
97 /// <summary> Finds the Message object with the given MsgID, and returns the Message
98 /// object. It finds the object and returns it in an atomic operation.
99 ///
100 /// </summary>
101 /// <param name="msgId">The msgId of the Message object to return
102 ///
103 /// </param>
104 /// <returns> The Message object corresponding to this MsgId.
105 ///
106 /// @throws NoSuchFieldException when no object with the corresponding
107 /// value for the MsgId field can be found.
108 /// </returns>
109 /* package */
110 internal Message findMessageById(int msgId)
112 lock (this)
114 Message msg = null;
115 for (int i = 0; i < Count; i++)
117 if ((msg = (Message) ToArray()[i]) == null)
119 throw new System.FieldAccessException();
121 if (msg.MessageID == msgId)
123 return msg;
126 throw new System.FieldAccessException();