1 // Author: Dwivedi, Ajay kumar
\r
5 // Permission is hereby granted, free of charge, to any person obtaining
6 // a copy of this software and associated documentation files (the
7 // "Software"), to deal in the Software without restriction, including
8 // without limitation the rights to use, copy, modify, merge, publish,
9 // distribute, sublicense, and/or sell copies of the Software, and to
10 // permit persons to whom the Software is furnished to do so, subject to
11 // the following conditions:
13 // The above copyright notice and this permission notice shall be
14 // included in all copies or substantial portions of the Software.
16 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25 using System.Collections;
\r
26 using System.Collections.Specialized;
\r
29 namespace System.Xml.Schema
\r
32 /// Summary description for XmlSchemaObjectTable.
\r
34 public class XmlSchemaObjectTable
\r
36 // private Hashtable table;
\r
37 private HybridDictionary table;
\r
39 internal XmlSchemaObjectTable ()
\r
41 // table = new Hashtable();
\r
42 table = new HybridDictionary ();
\r
46 get{ return table.Count; }
\r
48 public XmlSchemaObject this [XmlQualifiedName name]
\r
50 get{ return (XmlSchemaObject) table [name]; }
\r
52 public ICollection Names
\r
54 get{ return table.Keys; }
\r
56 public ICollection Values
\r
58 get{ return table.Values; }
\r
61 public bool Contains (XmlQualifiedName name)
\r
63 return table.Contains (name);
\r
65 public IDictionaryEnumerator GetEnumerator ()
\r
67 return new XmlSchemaObjectTableEnumerator (this);
\r
70 internal void Add (XmlQualifiedName name, XmlSchemaObject value)
\r
72 table [name] = value;
\r
75 internal void Clear ()
\r
80 internal void Set (XmlQualifiedName name, XmlSchemaObject value)
\r
82 table [name] = value;
\r
85 internal class XmlSchemaObjectTableEnumerator : IDictionaryEnumerator
\r
87 private IDictionaryEnumerator xenum;
\r
89 internal XmlSchemaObjectTableEnumerator (XmlSchemaObjectTable table)
\r
91 tmp = (IEnumerable) table.table;
\r
92 xenum = (IDictionaryEnumerator) tmp.GetEnumerator ();
\r
95 public XmlSchemaObject Current {
\r
97 return (XmlSchemaObject) xenum.Value;
\r
100 public DictionaryEntry Entry {
\r
101 get { return xenum.Entry; }
\r
103 public XmlQualifiedName Key {
\r
104 get { return (XmlQualifiedName) xenum.Key; }
\r
106 public XmlSchemaObject Value {
\r
107 get { return (XmlSchemaObject) xenum.Value; }
\r
110 public bool MoveNext()
\r
112 return xenum.MoveNext();
\r
115 //Explicit Interface implementation
\r
116 bool IEnumerator.MoveNext()
\r
118 return xenum.MoveNext();
\r
120 void IEnumerator.Reset()
\r
124 object IEnumerator.Current
\r
126 get { return xenum.Entry; }
\r
128 DictionaryEntry IDictionaryEnumerator.Entry {
\r
129 get { return xenum.Entry; }
\r
131 object IDictionaryEnumerator.Key {
\r
132 get { return (XmlQualifiedName) xenum.Key; }
\r
134 object IDictionaryEnumerator.Value {
\r
135 get { return (XmlSchemaObject) xenum.Value; }
\r