IGNITE-2099: Finished .NET part.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/22322fa0 Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/22322fa0 Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/22322fa0 Branch: refs/heads/ignite-2099 Commit: 22322fa0dced1dae4d859f3d3b09dc7027824d96 Parents: 821953d Author: vozerov-gridgain <[email protected]> Authored: Wed Dec 9 17:47:30 2015 +0300 Committer: vozerov-gridgain <[email protected]> Committed: Wed Dec 9 17:47:30 2015 +0300 ---------------------------------------------------------------------- .../Impl/Binary/BinaryUtils.cs | 64 +++----------------- 1 file changed, 7 insertions(+), 57 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ignite/blob/22322fa0/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryUtils.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryUtils.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryUtils.cs index 55e7dfe..1ae5722 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryUtils.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryUtils.cs @@ -19,7 +19,6 @@ namespace Apache.Ignite.Core.Impl.Binary { using System; using System.Collections; - using System.Collections.Concurrent; using System.Collections.Generic; using System.Diagnostics; using System.Diagnostics.CodeAnalysis; @@ -196,34 +195,13 @@ namespace Apache.Ignite.Core.Impl.Binary /** Collection: linked list. */ public const byte CollectionLinkedList = 2; - - /** Collection: hash set. */ - public const byte CollectionHashSet = 3; - - /** Collection: hash set. */ - public const byte CollectionLinkedHashSet = 4; - - /** Collection: sorted set. */ - public const byte CollectionSortedSet = 5; - - /** Collection: concurrent bag. */ - public const byte CollectionConcurrentBag = 6; - + /** Map: custom. */ public const byte MapCustom = 0; /** Map: hash map. */ public const byte MapHashMap = 1; - - /** Map: linked hash map. */ - public const byte MapLinkedHashMap = 2; - - /** Map: sorted map. */ - public const byte MapSortedMap = 3; - - /** Map: concurrent hash map. */ - public const byte MapConcurrentHashMap = 4; - + /** Byte "0". */ public const byte ByteZero = 0; @@ -1093,10 +1071,6 @@ namespace Apache.Ignite.Core.Impl.Binary colType = CollectionArrayList; else if (genType == typeof (LinkedList<>)) colType = CollectionLinkedList; - else if (genType == typeof (SortedSet<>)) - colType = CollectionSortedSet; - else if (genType == typeof (ConcurrentBag<>)) - colType = CollectionConcurrentBag; else colType = CollectionCustom; } @@ -1144,10 +1118,6 @@ namespace Apache.Ignite.Core.Impl.Binary { if (colType == CollectionLinkedList) res = new LinkedList<object>(); - else if (colType == CollectionSortedSet) - res = new SortedSet<object>(); - else if (colType == CollectionConcurrentBag) - res = new ConcurrentBag<object>(); else res = new ArrayList(len); } @@ -1178,14 +1148,7 @@ namespace Apache.Ignite.Core.Impl.Binary { var genType = valType.GetGenericTypeDefinition(); - if (genType == typeof (Dictionary<,>)) - dictType = MapHashMap; - else if (genType == typeof (SortedDictionary<,>)) - dictType = MapSortedMap; - else if (genType == typeof (ConcurrentDictionary<,>)) - dictType = MapConcurrentHashMap; - else - dictType = MapCustom; + dictType = genType == typeof (Dictionary<,>) ? MapHashMap : MapCustom; } else dictType = valType == typeof (Hashtable) ? MapHashMap : MapCustom; @@ -1218,29 +1181,16 @@ namespace Apache.Ignite.Core.Impl.Binary * <param name="factory">Factory delegate.</param> * <returns>Dictionary.</returns> */ - public static IDictionary ReadDictionary(BinaryReader ctx, - DictionaryFactory factory) + public static IDictionary ReadDictionary(BinaryReader ctx, DictionaryFactory factory) { IBinaryStream stream = ctx.Stream; int len = stream.ReadInt(); - byte colType = ctx.Stream.ReadByte(); - - IDictionary res; - - if (factory == null) - { - if (colType == MapSortedMap) - res = new SortedDictionary<object, object>(); - else if (colType == MapConcurrentHashMap) - res = new ConcurrentDictionary<object, object>(Environment.ProcessorCount, len); - else - res = new Hashtable(len); - } - else - res = factory.Invoke(len); + // Skip dictionary type as we can do nothing with it here. + ctx.Stream.ReadByte(); + var res = factory == null ? new Hashtable(len) : factory.Invoke(len); for (int i = 0; i < len; i++) {
