context: // NAnt - A .NET build tool
  // Copyright (C) 2002-2003 Scott Hernandez
  //
  // This program is free software; you can redistribute it and/or modify
  // it under the terms of the GNU General Public License as published by
  // the Free Software Foundation; either version 2 of the License, or
  // (at your option) any later version.
  //
  // This program is distributed in the hope that it will be useful,
  // but WITHOUT ANY WARRANTY; without even the implied warranty of
  // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  // GNU General Public License for more details.
  //
  // You should have received a copy of the GNU General Public License
  // along with this program; if not, write to the Free Software
  // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  //
  // Ian MacLean (imaclean@gmail.com)
  
  using System;
  using System.Collections;
  
  namespace NAnt.Core {
  
      /// <summary>
      /// Dictionary class to manage the projects types.
      /// </summary>
      public class DataTypeBaseDictionary : IDictionary, ICollection, IEnumerable, ICloneable {
          #region Private Instance Fields
  
          private Hashtable _innerHash;
  
          #endregion Private Instance Fields
          
          #region Public Instance Constructors
  
          /// <summary>
          /// Initializes a new instance of the <see cref="DataTypeBaseDictionary" /> class.
          /// </summary>
          public DataTypeBaseDictionary() {
              _innerHash = new Hashtable();
          }
  
          /// <summary>
          /// Initializes a new instance of the <see cref="DataTypeBaseDictionary"/> class.
          /// </summary>
          /// <param name="original">The original dictionary which well be copied.</param>
          public DataTypeBaseDictionary(DataTypeBaseDictionary original) {
              _innerHash = new Hashtable(original.InnerHash);
          }
  
          /// <summary>
          /// Initializes a new instance of the <see cref="DataTypeBaseDictionary"/> class.
          /// </summary>
          /// <param name="dictionary">The dictionary which will be copied.</param>
          public DataTypeBaseDictionary(IDictionary dictionary) {
              _innerHash = new Hashtable (dictionary);
          }
  
          /// <summary>
          /// Initializes a new instance of the <see cref="DataTypeBaseDictionary" /> class
          /// with the specified capacity.
          /// </summary>
          public DataTypeBaseDictionary(int capacity) {
              _innerHash = new Hashtable(capacity);
          }
  
          /// <summary>
          /// Initializes a new instance of the <see cref="DataTypeBaseDictionary"/> class.
          /// </summary>
          /// <param name="dictionary">The dictionary.</param>
          /// <param name="loadFactor">The load factor.</param>
          public DataTypeBaseDictionary(IDictionary dictionary, float loadFactor) {
              _innerHash = new Hashtable(dictionary, loadFactor);
          }
  
          /// <summary>
          /// Initializes a new instance of the <see cref="DataTypeBaseDictionary"/> class.
          /// </summary>
          /// <param name="codeProvider">The code provider.</param>
          /// <param name="comparer">The comparer.</param>
          public DataTypeBaseDictionary(IHashCodeProvider codeProvider, IComparer comparer) {
              _innerHash = new Hashtable(codeProvider, comparer);
          }
  
          /// <summary>
          /// Initializes a new instance of the <see cref="DataTypeBaseDictionary"/> class.
          /// </summary>
          /// <param name="capacity">The capacity.</param>
          /// <param name="loadFactor">The load factor.</param>
          public DataTypeBaseDictionary(int capacity, int loadFactor) {
              _innerHash = new Hashtable(capacity, loadFactor);
          }
  
          /// <summary>
          /// Initializes a new instance of the <see cref="DataTypeBaseDictionary"/> class.
          /// </summary>
          /// <param name="dictionary">The dictionary.</param>
          /// <param name="codeProvider">The code provider.</param>
          /// <param name="comparer">The comparer.</param>
          public DataTypeBaseDictionary(IDictionary dictionary, IHashCodeProvider codeProvider, IComparer comparer) {
              _innerHash = new Hashtable (dictionary, codeProvider, comparer);
          }
  
          /// <summary>
          /// Initializes a new instance of the <see cref="DataTypeBaseDictionary"/> class.
          /// </summary>
          /// <param name="capacity">The capacity.</param>
          /// <param name="codeProvider">The code provider.</param>
          /// <param name="comparer">The comparer.</param>
          public DataTypeBaseDictionary(int capacity, IHashCodeProvider codeProvider, IComparer comparer) {
              _innerHash = new Hashtable (capacity, codeProvider, comparer);
          }
  
          /// <summary>
          /// Initializes a new instance of the <see cref="DataTypeBaseDictionary"/> class.
          /// </summary>
          /// <param name="dictionary">The dictionary.</param>
          /// <param name="loadFactor">The load factor.</param>
          /// <param name="codeProvider">The code provider.</param>
          /// <param name="comparer">The comparer.</param>
          public DataTypeBaseDictionary(IDictionary dictionary, float loadFactor, IHashCodeProvider codeProvider, IComparer comparer) {
              _innerHash = new Hashtable (dictionary, loadFactor, codeProvider, comparer);
          }
  
          /// <summary>
          /// Initializes a new instance of the <see cref="DataTypeBaseDictionary"/> class.
          /// </summary>
          /// <param name="capacity">The capacity.</param>
          /// <param name="loadFactor">The load factor.</param>
          /// <param name="codeProvider">The code provider.</param>
          /// <param name="comparer">The comparer.</param>
          public DataTypeBaseDictionary(int capacity, float loadFactor, IHashCodeProvider codeProvider, IComparer comparer) {
              _innerHash = new Hashtable (capacity, loadFactor, codeProvider, comparer);
          }
  
          #endregion Public Instance Constructors
  
          #region Internal Instance Properties
  
          internal Hashtable InnerHash {
              get { return _innerHash; }
              set { _innerHash = value ; }
          }
  
          #endregion Internal Instance Properties
  
          #region Implementation of IDictionary
  
          /// <summary>
          /// Gets the enumerator.
          /// </summary>
          /// <returns>An enumerator object for the dictionary.</returns>
          public DataTypeBaseDictionaryEnumerator GetEnumerator() {
              return new DataTypeBaseDictionaryEnumerator(this);
          }
  
          /// <summary>
          /// Returns an <see cref="T:System.Collections.IDictionaryEnumerator" /> object for the <see cref="T:System.Collections.IDictionary" /> object.
          /// </summary>
          /// <returns>
          /// An <see cref="T:System.Collections.IDictionaryEnumerator" /> object for the <see cref="T:System.Collections.IDictionary" /> object.
          /// </returns>
          IDictionaryEnumerator IDictionary.GetEnumerator() {
              return new DataTypeBaseDictionaryEnumerator(this);
          }
  
          /// <summary>
          /// Returns an enumerator that iterates through a collection.
          /// </summary>
          /// <returns>
          /// An <see cref="T:System.Collections.IEnumerator" /> object that can be used to iterate through the collection.
          /// </returns>
          IEnumerator IEnumerable.GetEnumerator() {
              return GetEnumerator();
          }
          
        /// <summary>
          /// Removes the element with the specified key from the <see cref="T:System.Collections.IDictionary" /> object.
          /// </summary>
          /// <param name="key">The key of the element to remove.</param>
          public void Remove(string key) {
              _innerHash.Remove(key);
          }
  
          /// <summary>
          /// Removes the element with the specified key from the <see cref="T:System.Collections.IDictionary" /> object.
          /// </summary>
          /// <param name="key">The key of the element to remove.</param>
          void IDictionary.Remove(object key) {
              Remove((string) key);
          }
  
          /// <summary>
          /// Determines whether the <see cref="T:System.Collections.IDictionary" /> object contains an element with the specified key.
          /// </summary>
          /// <param name="key">The key to locate in the <see cref="T:System.Collections.IDictionary" /> object.</param>
          /// <returns>
          /// true if the <see cref="T:System.Collections.IDictionary" /> contains an element with the key; otherwise, false.
          /// </returns>
          public bool Contains(string key) {
              return _innerHash.Contains(key);
          }
  
          /// <summary>
          /// Determines whether the <see cref="T:System.Collections.IDictionary" /> object contains an element with the specified key.
          /// </summary>
          /// <param name="key">The key to locate in the <see cref="T:System.Collections.IDictionary" /> object.</param>
          /// <returns>
          /// true if the <see cref="T:System.Collections.IDictionary" /> contains an element with the key; otherwise, false.
          /// </returns>
          bool IDictionary.Contains(object key) {
              return Contains((string)key);
          }
  
          /// <summary>
          /// Removes all keys and values from the Dictionary.
          /// </summary>
          public void Clear() {
              _innerHash.Clear();      
          }
  
          /// <summary>
          /// Adds the specified key and value to the dictionary.
          /// </summary>
          /// <param name="key">The key of the element to add.</param>
          /// <param name="value">The value of the element to add.</param>
          public void Add(string key, DataTypeBase value) {
              _innerHash.Add (key, value);
          }
  
          /// <summary>
          /// Adds the specified key and value to the dictionary.
          /// </summary>
          /// <param name="key">The key of the element to add.</param>
          /// <param name="value">The value of the element to add.</param>
          void IDictionary.Add(object key, object value) {
              Add((string) key, (DataTypeBase) value);
          }
  
          /// <summary>
          /// Gets a value indicating whether the <see cref="T:System.Collections.IDictionary" /> object is read-only.
          /// </summary>
          public bool IsReadOnly {
              get { return _innerHash.IsReadOnly; }
          }
  
          /// <summary>
          /// Gets or sets the <see cref="DataTypeBase"/> with the specified key.
          /// </summary>
          /// <value>
          /// The <see cref="DataTypeBase"/>.
          /// </value>
          /// <param name="key">The key.</param>
          /// <returns></returns>
          public DataTypeBase this[string key] {
              get { return (DataTypeBase) _innerHash[key]; }
              set { _innerHash[key] = value; }
          }
  
          /// <summary>
          /// Gets or sets the element with the specified key.
          /// </summary>
          /// <param name="key">The key.</param>
          /// <returns></returns>
          object IDictionary.this[object key] {
              get { return this[(string) key]; }
              set { this[(string) key] = (DataTypeBase) value; }
          }
  
          /// <summary>
          /// Gets an <see cref="T:System.Collections.ICollection" /> object containing the values in the <see cref="T:System.Collections.IDictionary" /> object.
          /// </summary>
          public ICollection Values {
              get { return _innerHash.Values; }
          }
  
          /// <summary>
          /// Gets an <see cref="T:System.Collections.ICollection" /> object containing the keys of the <see cref="T:System.Collections.IDictionary" /> object.
          /// </summary>
          public ICollection Keys {
              get { return _innerHash.Keys; }
          }
  
          /// <summary>
          /// Gets a value indicating whether the <see cref="T:System.Collections.IDictionary" /> object has a fixed size.
          /// </summary>
          public bool IsFixedSize {
  
gt:             get { return _innerHash.IsFixedSize; }