2
0

XmlSchemaObjectTable.cs 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. // Author: Dwivedi, Ajay kumar
  2. // [email protected]
  3. using System;
  4. using System.Collections;
  5. using System.Collections.Specialized;
  6. using System.Xml;
  7. namespace System.Xml.Schema
  8. {
  9. /// <summary>
  10. /// Summary description for XmlSchemaObjectTable.
  11. /// </summary>
  12. public class XmlSchemaObjectTable
  13. {
  14. // private Hashtable table;
  15. private HybridDictionary table;
  16. internal XmlSchemaObjectTable ()
  17. {
  18. // table = new Hashtable();
  19. table = new HybridDictionary ();
  20. }
  21. public int Count
  22. {
  23. get{ return table.Count; }
  24. }
  25. public XmlSchemaObject this [XmlQualifiedName name]
  26. {
  27. get{ return (XmlSchemaObject) table [name]; }
  28. }
  29. public ICollection Names
  30. {
  31. get{ return table.Keys; }
  32. }
  33. public ICollection Values
  34. {
  35. get{ return table.Values; }
  36. }
  37. public bool Contains (XmlQualifiedName name)
  38. {
  39. return table.Contains (name);
  40. }
  41. public IDictionaryEnumerator GetEnumerator ()
  42. {
  43. return new XmlSchemaObjectTableEnumerator (this);
  44. }
  45. internal void Add (XmlQualifiedName name, XmlSchemaObject value)
  46. {
  47. table [name] = value;
  48. }
  49. internal void Clear ()
  50. {
  51. table.Clear ();
  52. }
  53. internal void Set (XmlQualifiedName name, XmlSchemaObject value)
  54. {
  55. table [name] = value;
  56. }
  57. internal class XmlSchemaObjectTableEnumerator : IDictionaryEnumerator
  58. {
  59. private IDictionaryEnumerator xenum;
  60. IEnumerable tmp;
  61. XmlSchemaObjectTable table;
  62. internal XmlSchemaObjectTableEnumerator (XmlSchemaObjectTable table)
  63. {
  64. this.table = table;
  65. tmp = (IEnumerable) table.table;
  66. xenum = (IDictionaryEnumerator) tmp.GetEnumerator ();
  67. }
  68. // Properties
  69. public XmlSchemaObject Current {
  70. get {
  71. return (XmlSchemaObject) xenum.Value;
  72. }
  73. }
  74. public DictionaryEntry Entry {
  75. get { return xenum.Entry; }
  76. }
  77. public XmlQualifiedName Key {
  78. get { return (XmlQualifiedName) xenum.Key; }
  79. }
  80. public XmlSchemaObject Value {
  81. get { return (XmlSchemaObject) xenum.Value; }
  82. }
  83. // Methods
  84. public bool MoveNext()
  85. {
  86. return xenum.MoveNext();
  87. }
  88. //Explicit Interface implementation
  89. bool IEnumerator.MoveNext()
  90. {
  91. return xenum.MoveNext();
  92. }
  93. void IEnumerator.Reset()
  94. {
  95. xenum.Reset();
  96. }
  97. object IEnumerator.Current
  98. {
  99. get { return xenum.Entry; }
  100. }
  101. DictionaryEntry IDictionaryEnumerator.Entry {
  102. get { return xenum.Entry; }
  103. }
  104. object IDictionaryEnumerator.Key {
  105. get { return (XmlQualifiedName) xenum.Key; }
  106. }
  107. object IDictionaryEnumerator.Value {
  108. get { return (XmlSchemaObject) xenum.Value; }
  109. }
  110. }
  111. }
  112. }