New test.
[mono.git] / mcs / tools / sqlsharp / gui / gtk-sharp / DbProviderCollection.cs
1 //
2 // DbProviderCollection.cs
3 //
4 // Author:
5 //     Daniel Morgan <danmorg@sc.rr.com>
6 //
7 // (C)Copyright 2002 by Daniel Morgan
8 //
9 // To be included with Mono as a SQL query tool licensed under the GPL license.
10 //
11
12 namespace Mono.Data.SqlSharp.Gui.GtkSharp 
13 {
14         using System;
15         using System.Data;
16         using System.Collections;
17
18         public class DbProviderCollection : MarshalByRefObject, IList, ICollection, IEnumerable 
19         {       
20                 #region Fields
21
22                 ArrayList list = new ArrayList ();
23
24                 #endregion // Fields
25
26                 #region Constructors
27
28                 public DbProviderCollection () 
29                 {
30                 }
31
32                 #endregion // Constructors
33
34                 #region Properties
35
36                 public DbProvider this[int index] {
37                         get { 
38                                 return (DbProvider) list[index]; 
39                         }
40                 }
41
42                 public DbProvider this[string key] {
43                         get {
44                                 DbProvider p = null;
45                                 foreach(object o in list) {
46                                         p = (DbProvider) o;
47                                         if(p.Key.ToUpper().Equals(key.ToUpper())) {
48                                                 return p;
49                                         }
50                                 }
51                                 throw new Exception("DbProvider not found");
52                         }
53                 }
54
55                 object IList.this[int index] {
56                         get { 
57                                 return list[index]; 
58                         }                       
59
60                         set {
61                                 list[index] = value;
62                         }
63                 }
64
65                 public int Count {
66                         get { 
67                                 return list.Count; 
68                         }
69                 }
70
71                 public bool IsFixedSize {
72                         get { 
73                                 return false; 
74                         }
75                 }
76
77                 public bool IsReadOnly {
78                         get { 
79                                 return true; 
80                         }
81                 }
82
83                 public bool IsSynchronized {
84                         get { 
85                                 return false; 
86                         }
87                 }
88
89                 public object SyncRoot {
90                         get { 
91                                 throw new InvalidOperationException (); 
92                         }
93                 }
94
95                 #endregion // Properties
96
97                 #region Methods
98
99                 public int Add (object o) 
100                 {
101                         return list.Add ((DbProvider) o);
102                 }
103
104                 public void Clear () 
105                 {
106                         list.Clear ();
107                 }
108
109                 public bool Contains (object o) 
110                 {
111                         return list.Contains ((DbProvider) o);
112                 }
113
114                 public void CopyTo (Array array, int index) 
115                 {
116                         list.CopyTo (array, index);
117                 }
118
119                 public IEnumerator GetEnumerator () 
120                 {
121                         return list.GetEnumerator ();
122                 }
123
124                 public int IndexOf (object o) 
125                 {
126                         return list.IndexOf ((DbProvider) o);
127                 }
128
129                 public void Insert (int index, object o) 
130                 {
131                         list.Insert (index, (DbProvider) o);
132                 }
133
134                 public void Remove (object o) 
135                 {
136                         list.Remove ((DbProvider) o);
137                 }
138
139                 public void RemoveAt (int index) 
140                 {
141                         list.RemoveAt (index);
142                 }
143
144                 #endregion // Methods
145                 
146         }
147 }