TARGET_J2EE/JVM fixes
[mono.git] / mcs / class / Microsoft.Web.Services / Microsoft.Web.Services / SoapOutputFilterCollection.cs
1 //
2 // SoapInputFilterCollection.cs: Soap Input Filter Collection
3 //
4 // Author:
5 //      Sebastien Pouliot (spouliot@motus.com)
6 //
7 // (C) 2003 Motus Technologies Inc. (http://www.motus.com)
8 //
9
10 using Microsoft.Web.Services;
11 using System;
12 using System.Collections;
13
14 namespace Microsoft.Web.Services {
15
16         public class SoapOutputFilterCollection : CollectionBase, ICloneable {
17                 
18                 public SoapOutputFilterCollection () {}
19
20                 internal SoapOutputFilterCollection (ArrayList list) 
21                 {
22                         InnerList.AddRange (list);
23                 }
24
25                 public SoapOutputFilter this [int index] {
26                         get { return (SoapOutputFilter) InnerList [index]; }
27                 }
28
29                 public int Add (SoapOutputFilter filter) 
30                 {
31                         if (filter == null)
32                                 throw new ArgumentNullException ("filter");
33                         return InnerList.Add (filter);
34                 }
35
36                 public void AddRange (ICollection filters) 
37                 {
38                         // can't use list.AddRange because we must check every items
39                         // in the collection
40                         foreach (object o in filters) {
41                                 if (! (o is SoapOutputFilter))
42                                         throw new ArgumentException ("not SoapOutputFilter");
43                                 // we'll get the ArgumentNullException in Add
44                                 InnerList.Add (o);
45                         }
46                 }
47
48                 // LAMESPEC: Shallow (implemented) or deep clone (todo)
49                 public object Clone () 
50                 {
51                         return new SoapOutputFilterCollection ((ArrayList) InnerList.Clone ());
52                 }
53
54                 public bool Contains (SoapOutputFilter filter) 
55                 {
56                         if (filter == null)
57                                 throw new ArgumentNullException ("filter");
58                         return InnerList.Contains (filter);
59                 }
60
61                 public bool Contains (Type filterType) 
62                 {
63                         foreach (object o in InnerList) {
64                                 if (o.GetType () == filterType)
65                                         return true;
66                         }
67                         return false;
68                 }
69
70                 public int IndexOf (SoapOutputFilter filter) 
71                 {
72                         if (filter == null)
73                                 throw new ArgumentNullException ("filter");
74                         return InnerList.IndexOf (filter);
75                 }
76
77                 public int IndexOf (Type filterType) 
78                 {
79                         if (filterType == null)
80                                 throw new ArgumentNullException ("filterType");
81                         int i = 0;
82                         foreach (object o in InnerList) {
83                                 if (o.GetType () == filterType)
84                                         return i;
85                                 i++;
86                         }
87                         return -1;
88                 }
89
90                 public void Insert (int index, SoapOutputFilter filter)
91                 {
92                         if (filter == null)
93                                 throw new ArgumentNullException ("filter");
94                         InnerList.Insert (index, filter);
95                 }
96
97                 public void Remove (SoapOutputFilter filter) 
98                 {
99                         if (filter == null)
100                                 throw new ArgumentNullException ("filter");
101                         InnerList.Remove (filter);
102                 }
103
104                 public void Remove (Type filterType) 
105                 {
106                         if (filterType == null)
107                                 throw new ArgumentNullException ("filterType");
108                         int i = 0;
109                         foreach (object o in InnerList) {
110                                 if (o.GetType () == filterType)
111                                         InnerList.RemoveAt (i);
112                                 i++;
113                         }
114                 }
115         } 
116 }