Example #1
0
 public override void Promote(FrugalMapBase newMap)
 {
     if (newMap.InsertEntry(_loneEntry.Key, _loneEntry.Value) != FrugalMapStoreState.Success)
     {
         throw new ArgumentException(nameof(newMap));
     }
 }
Example #2
0
 public override void Promote(FrugalMapBase newMap)
 {
     if (newMap.InsertEntry(_entry0.Key, _entry0.Value) != FrugalMapStoreState.Success)
     {
         throw new ArgumentException(nameof(newMap));
     }
     if (newMap.InsertEntry(_entry1.Key, _entry1.Value) != FrugalMapStoreState.Success)
     {
         throw new ArgumentException(nameof(newMap));
     }
     if (newMap.InsertEntry(_entry2.Key, _entry2.Value) != FrugalMapStoreState.Success)
     {
         throw new ArgumentException(nameof(newMap));
     }
     if (newMap.InsertEntry(_entry3.Key, _entry3.Value) != FrugalMapStoreState.Success)
     {
         throw new ArgumentException(nameof(newMap));
     }
     if (newMap.InsertEntry(_entry4.Key, _entry4.Value) != FrugalMapStoreState.Success)
     {
         throw new ArgumentException(nameof(newMap));
     }
     if (newMap.InsertEntry(_entry5.Key, _entry5.Value) != FrugalMapStoreState.Success)
     {
         throw new ArgumentException(nameof(newMap));
     }
 }
Example #3
0
 public override void Promote(FrugalMapBase newMap)
 {
     for (int index = 0; index < _entries.Length; ++index)
     {
         if (newMap.InsertEntry(_entries[index].Key, _entries[index].Value) != FrugalMapStoreState.Success)
         {
             throw new ArgumentException(nameof(newMap));
         }
     }
 }
Example #4
0
 public object this[int key]
 {
     get
     {
         if (MapStore != null)
         {
             return(MapStore.Search(key));
         }
         return(DependencyProperty.UnsetValue);
     }
     set
     {
         if (value != DependencyProperty.UnsetValue)
         {
             if (MapStore == null)
             {
                 MapStore = new SingleObjectMap();
             }
             var state = MapStore.InsertEntry(key, value);
             if (state == FrugalMapStoreState.Success)
             {
                 return;
             }
             FrugalMapBase newMap;
             if (FrugalMapStoreState.ThreeObjectMap == state)
             {
                 newMap = new ThreeObjectMap();
             }
             else if (FrugalMapStoreState.SixObjectMap == state)
             {
                 newMap = new SixObjectMap();
             }
             else if (FrugalMapStoreState.Array == state)
             {
                 newMap = new ArrayObjectMap();
             }
             else if (FrugalMapStoreState.SortedArray == state)
             {
                 newMap = new SortedObjectMap();
             }
             else
             {
                 if (FrugalMapStoreState.Hashtable != state)
                 {
                     throw new InvalidOperationException();
                 }
                 newMap = new HashObjectMap();
             }
             MapStore.Promote(newMap);
             MapStore = newMap;
             int num = (int)MapStore.InsertEntry(key, value);
         }
         else
         {
             if (MapStore == null)
             {
                 return;
             }
             MapStore.RemoveEntry(key);
             if (MapStore.Count != 0)
             {
                 return;
             }
             MapStore = null;
         }
     }
 }
Example #5
0
 public abstract void Promote(FrugalMapBase newMap);
Example #6
0
 public override void Promote(FrugalMapBase newMap)
 {
     throw new InvalidOperationException();
 }