Esempio n. 1
0
        private void SetMapProvider(bool readOnly)
        {
            int         count    = m_mapProvider.m_count;
            MapProvider provider = m_mapProvider;

            if (readOnly)
            {
                SortedMapProvider pr = m_mapProvider as SortedMapProvider;
                if (pr.m_lastKey <= MAXINDEX)
                {
                    provider = new IndexMapProvider();
                }
                else if (count <= MAXARRAYCOUNT)
                {
                    provider = new ArrayMapProvider(m_mapProvider.m_count);
                }
            }
            else
            {
                if (!(provider is SortedMapProvider))
                {
                    provider = new SortedMapProvider(m_mapProvider.m_count);
                }
            }
            if (provider != m_mapProvider)
            {
                for (int i = 0; i < count; i++)
                {
                    Entry entry = m_mapProvider.GetEntry(i);
                    provider.Add(entry.Key, entry.Value);
                }
                m_mapProvider = provider;
            }
        }
Esempio n. 2
0
 private void SetMapProvider(bool readOnly)
 {
     int count = m_mapProvider.m_count;
     MapProvider provider = m_mapProvider;
     if (readOnly)
     {
         SortedMapProvider pr = m_mapProvider as SortedMapProvider;
         if (pr.m_lastKey <= MAXINDEX)
         {
             provider = new IndexMapProvider();
         }
         else if (count <= MAXARRAYCOUNT)
         {
             provider = new ArrayMapProvider(m_mapProvider.m_count);
         }
     }
     else
     {
         if (! (provider is SortedMapProvider))
         {
             provider = new SortedMapProvider(m_mapProvider.m_count);
         }
     }
     if (provider != m_mapProvider)
     {
         for (int i = 0; i < count; i++)
         {
             Entry entry = m_mapProvider.GetEntry(i);
             provider.Add(entry.Key, entry.Value);
         }
         m_mapProvider = provider;
     }
 }
Esempio n. 3
0
		private void SetMapProvider(Boolean readOnly)
		{
			Int32 count = m_MapProvider.Count;
			MapProvider provider = m_MapProvider;
			if (readOnly)
			{
				var pr = (SortedMapProvider)m_MapProvider;
				if (pr.LastKey <= MAXINDEX)
				{
					provider = new IndexMapProvider();
				}
				else if (count <= MAXARRAYCOUNT)
				{
					provider = new ArrayMapProvider(m_MapProvider.Count);
				}
			}
			else
			{
				if (!(provider is SortedMapProvider))
				{
					provider = new SortedMapProvider(m_MapProvider.Count);
				}
			}
			if (provider != m_MapProvider)
			{
				for (Int32 i = 0; i < count; i++)
				{
					Entry entry = m_MapProvider.GetEntry(i);
					provider.Add(entry.Key, entry.Value);
				}
				m_MapProvider = provider;
			}
		}
Esempio n. 4
0
		/// <summary>
		/// Creates new instance of <see cref="ObjectMap"/> class.
		/// </summary>
		internal ObjectMap()
		{
			m_MapProvider = new SortedMapProvider(MINSIZE);
		}