diff --git a/src/SharedAssemblyInfo.cs b/src/SharedAssemblyInfo.cs index 1bb533c409b..fdfe472f63f 100644 --- a/src/SharedAssemblyInfo.cs +++ b/src/SharedAssemblyInfo.cs @@ -4,5 +4,5 @@ [assembly: AssemblyCompanyAttribute("Akka.NET Team")] [assembly: AssemblyCopyrightAttribute("Copyright © 2013-2016 Akka.NET Team")] [assembly: AssemblyTrademarkAttribute("")] -[assembly: AssemblyVersionAttribute("1.0.6.0")] -[assembly: AssemblyFileVersionAttribute("1.0.6.0")] +[assembly: AssemblyVersionAttribute("1.0.7.0")] +[assembly: AssemblyFileVersionAttribute("1.0.7.0")] diff --git a/src/contrib/cluster/Akka.Cluster.Sharding.Tests/Akka.Cluster.Sharding.Tests.csproj b/src/contrib/cluster/Akka.Cluster.Sharding.Tests/Akka.Cluster.Sharding.Tests.csproj index 169729204e5..32776af0def 100644 --- a/src/contrib/cluster/Akka.Cluster.Sharding.Tests/Akka.Cluster.Sharding.Tests.csproj +++ b/src/contrib/cluster/Akka.Cluster.Sharding.Tests/Akka.Cluster.Sharding.Tests.csproj @@ -31,8 +31,8 @@ - - ..\..\..\packages\System.Collections.Immutable.1.1.37\lib\dotnet\System.Collections.Immutable.dll + + ..\..\..\packages\System.Collections.Immutable.1.1.36\lib\portable-net45+win8+wp8+wpa81\System.Collections.Immutable.dll True diff --git a/src/contrib/cluster/Akka.Cluster.Sharding.Tests/packages.config b/src/contrib/cluster/Akka.Cluster.Sharding.Tests/packages.config index 7f6c4f5a269..6c8d4c70d34 100644 --- a/src/contrib/cluster/Akka.Cluster.Sharding.Tests/packages.config +++ b/src/contrib/cluster/Akka.Cluster.Sharding.Tests/packages.config @@ -1,7 +1,7 @@  - + diff --git a/src/contrib/cluster/Akka.Cluster.Sharding/Akka.Cluster.Sharding.csproj b/src/contrib/cluster/Akka.Cluster.Sharding/Akka.Cluster.Sharding.csproj index 4cde8d898be..53665c45662 100644 --- a/src/contrib/cluster/Akka.Cluster.Sharding/Akka.Cluster.Sharding.csproj +++ b/src/contrib/cluster/Akka.Cluster.Sharding/Akka.Cluster.Sharding.csproj @@ -40,8 +40,8 @@ True - - ..\..\..\packages\System.Collections.Immutable.1.1.37\lib\dotnet\System.Collections.Immutable.dll + + ..\..\..\packages\System.Collections.Immutable.1.1.36\lib\portable-net45+win8+wp8+wpa81\System.Collections.Immutable.dll True diff --git a/src/contrib/cluster/Akka.Cluster.Sharding/packages.config b/src/contrib/cluster/Akka.Cluster.Sharding/packages.config index 4ae7e7e980b..7c0785d2c1c 100644 --- a/src/contrib/cluster/Akka.Cluster.Sharding/packages.config +++ b/src/contrib/cluster/Akka.Cluster.Sharding/packages.config @@ -2,7 +2,7 @@ - + diff --git a/src/contrib/cluster/Akka.Cluster.Tools.Tests/Akka.Cluster.Tools.Tests.csproj b/src/contrib/cluster/Akka.Cluster.Tools.Tests/Akka.Cluster.Tools.Tests.csproj index 7f9eab4b1cc..73444858fb3 100644 --- a/src/contrib/cluster/Akka.Cluster.Tools.Tests/Akka.Cluster.Tools.Tests.csproj +++ b/src/contrib/cluster/Akka.Cluster.Tools.Tests/Akka.Cluster.Tools.Tests.csproj @@ -47,8 +47,8 @@ True - - ..\..\..\packages\System.Collections.Immutable.1.1.37\lib\dotnet\System.Collections.Immutable.dll + + ..\..\..\packages\System.Collections.Immutable.1.1.36\lib\portable-net45+win8+wp8+wpa81\System.Collections.Immutable.dll True diff --git a/src/contrib/cluster/Akka.Cluster.Tools.Tests/packages.config b/src/contrib/cluster/Akka.Cluster.Tools.Tests/packages.config index 75cec136465..7016049c1a6 100644 --- a/src/contrib/cluster/Akka.Cluster.Tools.Tests/packages.config +++ b/src/contrib/cluster/Akka.Cluster.Tools.Tests/packages.config @@ -3,7 +3,7 @@ - + diff --git a/src/contrib/cluster/Akka.Cluster.Tools/Akka.Cluster.Tools.csproj b/src/contrib/cluster/Akka.Cluster.Tools/Akka.Cluster.Tools.csproj index dfb2f738b73..5288284b16e 100644 --- a/src/contrib/cluster/Akka.Cluster.Tools/Akka.Cluster.Tools.csproj +++ b/src/contrib/cluster/Akka.Cluster.Tools/Akka.Cluster.Tools.csproj @@ -40,8 +40,8 @@ True - - ..\..\..\packages\System.Collections.Immutable.1.1.37\lib\dotnet\System.Collections.Immutable.dll + + ..\..\..\packages\System.Collections.Immutable.1.1.36\lib\portable-net45+win8+wp8+wpa81\System.Collections.Immutable.dll True diff --git a/src/contrib/cluster/Akka.Cluster.Tools/packages.config b/src/contrib/cluster/Akka.Cluster.Tools/packages.config index 4ae7e7e980b..7c0785d2c1c 100644 --- a/src/contrib/cluster/Akka.Cluster.Tools/packages.config +++ b/src/contrib/cluster/Akka.Cluster.Tools/packages.config @@ -2,7 +2,7 @@ - + diff --git a/src/core/Akka.API.Tests/CoreAPISpec.ApproveCore.approved.txt b/src/core/Akka.API.Tests/CoreAPISpec.ApproveCore.approved.txt index 33be15258b7..5cd2b3c432f 100644 --- a/src/core/Akka.API.Tests/CoreAPISpec.ApproveCore.approved.txt +++ b/src/core/Akka.API.Tests/CoreAPISpec.ApproveCore.approved.txt @@ -1752,14 +1752,14 @@ namespace Akka.Actor.Internal } public abstract class ChildrenContainerBase : Akka.Actor.Internal.IChildrenContainer { - protected ChildrenContainerBase(Akka.Util.Internal.Collections.IImmutableMap children) { } + protected ChildrenContainerBase(System.Collections.Immutable.IImmutableDictionary children) { } public System.Collections.Generic.IReadOnlyList Children { get; } - protected Akka.Util.Internal.Collections.IImmutableMap InternalChildren { get; } + protected System.Collections.Immutable.IImmutableDictionary InternalChildren { get; } public virtual bool IsNormal { get; } public virtual bool IsTerminating { get; } public System.Collections.Generic.IReadOnlyList Stats { get; } public abstract Akka.Actor.Internal.IChildrenContainer Add(string name, Akka.Actor.Internal.ChildRestartStats stats); - protected void ChildStatsAppender(System.Text.StringBuilder sb, Akka.Util.Internal.Collections.IKeyValuePair kvp, int index) { } + protected void ChildStatsAppender(System.Text.StringBuilder sb, System.Collections.Generic.KeyValuePair kvp, int index) { } public bool Contains(Akka.Actor.IActorRef actor) { } public abstract Akka.Actor.Internal.IChildrenContainer Remove(Akka.Actor.IActorRef child); public abstract Akka.Actor.Internal.IChildrenContainer Reserve(string name); @@ -1831,7 +1831,7 @@ namespace Akka.Actor.Internal public class NormalChildrenContainer : Akka.Actor.Internal.ChildrenContainerBase { public override Akka.Actor.Internal.IChildrenContainer Add(string name, Akka.Actor.Internal.ChildRestartStats stats) { } - public static Akka.Actor.Internal.IChildrenContainer Create(Akka.Util.Internal.Collections.IImmutableMap children) { } + public static Akka.Actor.Internal.IChildrenContainer Create(System.Collections.Immutable.IImmutableDictionary children) { } public override Akka.Actor.Internal.IChildrenContainer Remove(Akka.Actor.IActorRef child) { } public override Akka.Actor.Internal.IChildrenContainer Reserve(string name) { } public override Akka.Actor.Internal.IChildrenContainer ShallDie(Akka.Actor.IActorRef actor) { } @@ -1871,8 +1871,8 @@ namespace Akka.Actor.Internal } public class TerminatingChildrenContainer : Akka.Actor.Internal.ChildrenContainerBase { - public TerminatingChildrenContainer(Akka.Util.Internal.Collections.IImmutableMap children, Akka.Actor.IActorRef toDie, Akka.Actor.Internal.SuspendReason reason) { } - public TerminatingChildrenContainer(Akka.Util.Internal.Collections.IImmutableMap children, Akka.Util.Internal.Collections.IImmutableSet toDie, Akka.Actor.Internal.SuspendReason reason) { } + public TerminatingChildrenContainer(System.Collections.Immutable.IImmutableDictionary children, Akka.Actor.IActorRef toDie, Akka.Actor.Internal.SuspendReason reason) { } + public TerminatingChildrenContainer(System.Collections.Immutable.IImmutableDictionary children, System.Collections.Immutable.ImmutableHashSet toDie, Akka.Actor.Internal.SuspendReason reason) { } public override bool IsNormal { get; } public override bool IsTerminating { get; } public Akka.Actor.Internal.SuspendReason Reason { get; } @@ -4841,12 +4841,6 @@ namespace Akka.Util.Internal } namespace Akka.Util.Internal.Collections { - public class EmptyReadOnlyCollections - { - public EmptyReadOnlyCollections() { } - public static System.Collections.Generic.IReadOnlyCollection Collection { get; } - public static System.Collections.Generic.IReadOnlyList List { get; } - } public class static EnumeratorExtensions { public static Akka.Util.Internal.Collections.Iterator Iterator(this System.Collections.Generic.IEnumerable enumerable) { } @@ -4856,124 +4850,11 @@ namespace Akka.Util.Internal.Collections Akka.Util.Internal.Collections.IBinaryTreeNode Left { get; } Akka.Util.Internal.Collections.IBinaryTreeNode Right { get; } } - public interface IImmutableMap - where TKey : System.IComparable<> - { - System.Collections.Generic.IEnumerable AllKeysMaxToMin { get; } - System.Collections.Generic.IEnumerable AllKeysMinToMax { get; } - System.Collections.Generic.IEnumerable> AllMaxToMin { get; } - System.Collections.Generic.IEnumerable> AllMinToMax { get; } - System.Collections.Generic.IEnumerable AllValuesMaxToMin { get; } - System.Collections.Generic.IEnumerable AllValuesMinToMax { get; } - int Count { get; } - bool IsEmpty { get; } - TValue this[TKey key] { get; } - Akka.Util.Internal.Collections.IImmutableMap Add(TKey key, TValue value); - Akka.Util.Internal.Collections.IImmutableMap AddOrUpdate(TKey key, TValue value); - bool Contains(TKey key); - Akka.Util.Internal.Collections.IImmutableMap Remove(TKey key); - bool TryAdd(TKey key, TValue value, out Akka.Util.Internal.Collections.IImmutableMap<, > newMap); - bool TryGet(TKey key, out TValue value); - bool TryRemove(TKey key, out Akka.Util.Internal.Collections.IImmutableMap<, > newMap); - } - public interface IImmutableSet : System.Collections.Generic.IEnumerable, System.Collections.IEnumerable - where TValue : System.IComparable<> - { - System.Collections.Generic.IEnumerable AllMaxToMin { get; } - System.Collections.Generic.IEnumerable AllMinToMax { get; } - int Count { get; } - bool IsEmpty { get; } - Akka.Util.Internal.Collections.IImmutableSet Add(TValue value); - bool Contains(TValue value); - Akka.Util.Internal.Collections.IImmutableSet Remove(TValue value); - Akka.Util.Internal.Collections.IImmutableSet Remove(System.Collections.Generic.IEnumerable values); - bool TryAdd(TValue value, out Akka.Util.Internal.Collections.IImmutableSet<> newMap); - bool TryRemove(TValue value, out Akka.Util.Internal.Collections.IImmutableSet<> newMap); - } public interface IKeyValuePair { TKey Key { get; } TValue Value { get; } } - public sealed class ImmutableAvlTree : Akka.Util.Internal.Collections.ImmutableAvlTreeBase - where TKey : System.IComparable<> - { - public static readonly Akka.Util.Internal.Collections.ImmutableAvlTree Empty; - public Akka.Util.Internal.Collections.ImmutableAvlTree Add(TKey key, TValue value) { } - public Akka.Util.Internal.Collections.ImmutableAvlTree AddOrUpdate(TKey key, TValue value) { } - public Akka.Util.Internal.Collections.ImmutableAvlTree Remove(TKey key) { } - public bool TryRemove(TKey key, out Akka.Util.Internal.Collections.ImmutableAvlTree<, > newMap) { } - } - public abstract class ImmutableAvlTreeBase : System.Collections.Generic.IEnumerable>, System.Collections.IEnumerable - where TKey : System.IComparable<> - { - protected ImmutableAvlTreeBase() { } - protected ImmutableAvlTreeBase(Akka.Util.Internal.Collections.ImmutableAvlTreeBase.Node node) { } - public System.Collections.Generic.IEnumerable AllKeysMaxToMin { get; } - public System.Collections.Generic.IEnumerable AllKeysMinToMax { get; } - public System.Collections.Generic.IEnumerable> AllMaxToMin { get; } - public System.Collections.Generic.IEnumerable> AllMinToMax { get; } - public System.Collections.Generic.IEnumerable AllValuesMaxToMin { get; } - public System.Collections.Generic.IEnumerable AllValuesMinToMax { get; } - public int Count { get; } - public bool IsEmpty { get; } - public TValue this[TKey key] { get; } - public Akka.Util.Internal.Collections.IBinaryTreeNode Root { get; } - public bool Contains(TKey key) { } - public System.Collections.Generic.IEnumerator> GetEnumerator() { } - public override string ToString() { } - protected bool TryAdd(TKey key, TValue value, out Akka.Util.Internal.Collections.ImmutableAvlTreeBase<, >.Node newNode, Akka.Util.Internal.Collections.ImmutableAvlTreeBase.AddOperation typeOfAdd) { } - protected static bool TryAdd(Akka.Util.Internal.Collections.ImmutableAvlTreeBase.Node node, TKey key, TValue value, out Akka.Util.Internal.Collections.ImmutableAvlTreeBase<, >.Node newNode, Akka.Util.Internal.Collections.ImmutableAvlTreeBase.AddOperation typeOfAdd) { } - public bool TryGet(TKey key, out TValue value) { } - protected bool TryRemove(TKey key, out Akka.Util.Internal.Collections.ImmutableAvlTreeBase<, >.Node newNode) { } - protected enum AddOperation - where TKey : System.IComparable<> - { - Add = 0, - AddOrUpdate = 1, - AddOnlyUnique = 2, - } - public class Node : Akka.Util.Internal.Collections.IBinaryTreeNode, Akka.Util.Internal.Collections.IKeyValuePair - where TKey : System.IComparable<> - { - public Node(TKey key, TValue value, Akka.Util.Internal.Collections.ImmutableAvlTreeBase.Node left, Akka.Util.Internal.Collections.ImmutableAvlTreeBase.Node right) { } - public int Count { get; } - public int Height { get; } - public TKey Key { get; } - public Akka.Util.Internal.Collections.ImmutableAvlTreeBase.Node Left { get; } - public Akka.Util.Internal.Collections.ImmutableAvlTreeBase.Node Right { get; } - public TValue Value { get; } - public override string ToString() { } - } - } - public class static ImmutableSetExtensions - { - public static Akka.Util.Internal.Collections.IImmutableSet Remove(this Akka.Util.Internal.Collections.IImmutableSet set, System.Predicate itemsToRemove) - where TValue : System.IComparable<> { } - } - public sealed class ImmutableTreeMap : Akka.Util.Internal.Collections.ImmutableAvlTreeBase, Akka.Util.Internal.Collections.IImmutableMap - where TKey : System.IComparable<> - { - public static readonly Akka.Util.Internal.Collections.ImmutableTreeMap Empty; - public Akka.Util.Internal.Collections.ImmutableTreeMap Add(TKey key, TValue value) { } - public Akka.Util.Internal.Collections.ImmutableTreeMap AddOrUpdate(TKey key, TValue value) { } - public Akka.Util.Internal.Collections.ImmutableTreeMap Remove(TKey key) { } - public bool TryAdd(TKey key, TValue value, out Akka.Util.Internal.Collections.ImmutableTreeMap<, > newTreeMap) { } - public bool TryRemove(TKey key, out Akka.Util.Internal.Collections.ImmutableTreeMap<, > newMap) { } - } - public class ImmutableTreeSet : Akka.Util.Internal.Collections.ImmutableAvlTreeBase, Akka.Util.Internal.Collections.IImmutableSet, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable - where TValue : System.IComparable<> - { - public static readonly Akka.Util.Internal.Collections.ImmutableTreeSet Empty; - public Akka.Util.Internal.Collections.ImmutableTreeSet Add(TValue value) { } - public Akka.Util.Internal.Collections.ImmutableTreeSet AddOrUpdate(TValue value) { } - public static Akka.Util.Internal.Collections.ImmutableTreeSet Create(TValue value, params TValue[] values) { } - public static Akka.Util.Internal.Collections.ImmutableTreeSet Create(System.Collections.Generic.IEnumerable values) { } - public Akka.Util.Internal.Collections.ImmutableTreeSet Remove(TValue value) { } - public Akka.Util.Internal.Collections.ImmutableTreeSet Remove(System.Collections.Generic.IEnumerable values) { } - public bool TryAdd(TValue value, out Akka.Util.Internal.Collections.ImmutableTreeSet<> newTreeMap) { } - public bool TryRemove(TValue value, out Akka.Util.Internal.Collections.ImmutableTreeSet<> newMap) { } - } public class Iterator { public Iterator(System.Collections.Generic.IEnumerable enumerator) { } diff --git a/src/core/Akka.Cluster.Tests.MultiNode/Akka.Cluster.Tests.MultiNode.csproj b/src/core/Akka.Cluster.Tests.MultiNode/Akka.Cluster.Tests.MultiNode.csproj index ef0c889964a..f6719550358 100644 --- a/src/core/Akka.Cluster.Tests.MultiNode/Akka.Cluster.Tests.MultiNode.csproj +++ b/src/core/Akka.Cluster.Tests.MultiNode/Akka.Cluster.Tests.MultiNode.csproj @@ -36,8 +36,8 @@ - - ..\..\packages\System.Collections.Immutable.1.1.37\lib\portable-net45+win8+wp8+wpa81\System.Collections.Immutable.dll + + ..\..\packages\System.Collections.Immutable.1.1.36\lib\portable-net45+win8+wp8+wpa81\System.Collections.Immutable.dll True diff --git a/src/core/Akka.Cluster.Tests.MultiNode/packages.config b/src/core/Akka.Cluster.Tests.MultiNode/packages.config index 15502b4d7f9..923f1ca5678 100644 --- a/src/core/Akka.Cluster.Tests.MultiNode/packages.config +++ b/src/core/Akka.Cluster.Tests.MultiNode/packages.config @@ -1,6 +1,6 @@  - + diff --git a/src/core/Akka.Cluster.Tests/Akka.Cluster.Tests.csproj b/src/core/Akka.Cluster.Tests/Akka.Cluster.Tests.csproj index ed1ee8458e1..49300c4c5e0 100644 --- a/src/core/Akka.Cluster.Tests/Akka.Cluster.Tests.csproj +++ b/src/core/Akka.Cluster.Tests/Akka.Cluster.Tests.csproj @@ -51,8 +51,8 @@ True - - ..\..\packages\System.Collections.Immutable.1.1.37\lib\portable-net45+win8+wp8+wpa81\System.Collections.Immutable.dll + + ..\..\packages\System.Collections.Immutable.1.1.36\lib\portable-net45+win8+wp8+wpa81\System.Collections.Immutable.dll True diff --git a/src/core/Akka.Cluster.Tests/packages.config b/src/core/Akka.Cluster.Tests/packages.config index 2f75d2350a3..503cd628f5c 100644 --- a/src/core/Akka.Cluster.Tests/packages.config +++ b/src/core/Akka.Cluster.Tests/packages.config @@ -2,7 +2,7 @@ - + diff --git a/src/core/Akka.Cluster/Akka.Cluster.csproj b/src/core/Akka.Cluster/Akka.Cluster.csproj index 0533f64ee94..65aefce2590 100644 --- a/src/core/Akka.Cluster/Akka.Cluster.csproj +++ b/src/core/Akka.Cluster/Akka.Cluster.csproj @@ -60,8 +60,8 @@ - - ..\..\packages\System.Collections.Immutable.1.1.37\lib\portable-net45+win8+wp8+wpa81\System.Collections.Immutable.dll + + ..\..\packages\System.Collections.Immutable.1.1.36\lib\portable-net45+win8+wp8+wpa81\System.Collections.Immutable.dll True diff --git a/src/core/Akka.Cluster/packages.config b/src/core/Akka.Cluster/packages.config index 8ede2c5fa7a..958eb3736e6 100644 --- a/src/core/Akka.Cluster/packages.config +++ b/src/core/Akka.Cluster/packages.config @@ -1,5 +1,5 @@  - + \ No newline at end of file diff --git a/src/core/Akka.FSharp/Properties/AssemblyInfo.fs b/src/core/Akka.FSharp/Properties/AssemblyInfo.fs index bd74aadf3c1..a84270f48ed 100644 --- a/src/core/Akka.FSharp/Properties/AssemblyInfo.fs +++ b/src/core/Akka.FSharp/Properties/AssemblyInfo.fs @@ -1,11 +1,4 @@ -//----------------------------------------------------------------------- -// -// Copyright (C) 2009-2016 Typesafe Inc. -// Copyright (C) 2013-2016 Akka.NET project -// -//----------------------------------------------------------------------- - -namespace System +namespace System open System open System.Reflection open System.Runtime.InteropServices @@ -17,9 +10,9 @@ open System.Runtime.InteropServices [] [] [] -[] -[] +[] +[] do () module internal AssemblyVersionInformation = - let [] Version = "1.0.6.0" + let [] Version = "1.0.7.0" diff --git a/src/core/Akka.Remote.TestKit.Tests/Akka.Remote.TestKit.Tests.csproj b/src/core/Akka.Remote.TestKit.Tests/Akka.Remote.TestKit.Tests.csproj index f524ad54eda..ec5b36cb813 100644 --- a/src/core/Akka.Remote.TestKit.Tests/Akka.Remote.TestKit.Tests.csproj +++ b/src/core/Akka.Remote.TestKit.Tests/Akka.Remote.TestKit.Tests.csproj @@ -40,8 +40,8 @@ True - - ..\..\packages\System.Collections.Immutable.1.1.37\lib\portable-net45+win8+wp8+wpa81\System.Collections.Immutable.dll + + ..\..\packages\System.Collections.Immutable.1.1.36\lib\portable-net45+win8+wp8+wpa81\System.Collections.Immutable.dll True diff --git a/src/core/Akka.Remote.TestKit.Tests/packages.config b/src/core/Akka.Remote.TestKit.Tests/packages.config index a56f6ab0c95..acb634a8f4b 100644 --- a/src/core/Akka.Remote.TestKit.Tests/packages.config +++ b/src/core/Akka.Remote.TestKit.Tests/packages.config @@ -1,7 +1,7 @@  - + diff --git a/src/core/Akka.Remote.TestKit/Akka.Remote.TestKit.csproj b/src/core/Akka.Remote.TestKit/Akka.Remote.TestKit.csproj index ff43528a9f5..139913b08b4 100644 --- a/src/core/Akka.Remote.TestKit/Akka.Remote.TestKit.csproj +++ b/src/core/Akka.Remote.TestKit/Akka.Remote.TestKit.csproj @@ -55,8 +55,8 @@ True - - ..\..\packages\System.Collections.Immutable.1.1.37\lib\portable-net45+win8+wp8+wpa81\System.Collections.Immutable.dll + + ..\..\packages\System.Collections.Immutable.1.1.36\lib\portable-net45+win8+wp8+wpa81\System.Collections.Immutable.dll True diff --git a/src/core/Akka.Remote.TestKit/packages.config b/src/core/Akka.Remote.TestKit/packages.config index 984d71f01bf..d3da1425ae3 100644 --- a/src/core/Akka.Remote.TestKit/packages.config +++ b/src/core/Akka.Remote.TestKit/packages.config @@ -3,7 +3,7 @@ - + diff --git a/src/core/Akka.Remote.Tests.MultiNode/Akka.Remote.Tests.MultiNode.csproj b/src/core/Akka.Remote.Tests.MultiNode/Akka.Remote.Tests.MultiNode.csproj index 534afbe42ef..95cadae7d95 100644 --- a/src/core/Akka.Remote.Tests.MultiNode/Akka.Remote.Tests.MultiNode.csproj +++ b/src/core/Akka.Remote.Tests.MultiNode/Akka.Remote.Tests.MultiNode.csproj @@ -36,8 +36,8 @@ - - ..\..\packages\System.Collections.Immutable.1.1.37\lib\portable-net45+win8+wp8+wpa81\System.Collections.Immutable.dll + + ..\..\packages\System.Collections.Immutable.1.1.36\lib\portable-net45+win8+wp8+wpa81\System.Collections.Immutable.dll True diff --git a/src/core/Akka.Remote.Tests.MultiNode/packages.config b/src/core/Akka.Remote.Tests.MultiNode/packages.config index 15502b4d7f9..923f1ca5678 100644 --- a/src/core/Akka.Remote.Tests.MultiNode/packages.config +++ b/src/core/Akka.Remote.Tests.MultiNode/packages.config @@ -1,6 +1,6 @@  - + diff --git a/src/core/Akka.Remote/Akka.Remote.csproj b/src/core/Akka.Remote/Akka.Remote.csproj index d67a93e8dfa..6c4eaef32a9 100644 --- a/src/core/Akka.Remote/Akka.Remote.csproj +++ b/src/core/Akka.Remote/Akka.Remote.csproj @@ -65,6 +65,10 @@ True + + ..\..\packages\System.Collections.Immutable.1.1.36\lib\portable-net45+win8+wp8+wpa81\System.Collections.Immutable.dll + True + diff --git a/src/core/Akka.Remote/RemoteDeploymentWatcher.cs b/src/core/Akka.Remote/RemoteDeploymentWatcher.cs index 98b38138cfe..1555452a59f 100644 --- a/src/core/Akka.Remote/RemoteDeploymentWatcher.cs +++ b/src/core/Akka.Remote/RemoteDeploymentWatcher.cs @@ -7,13 +7,13 @@ using System; using System.Collections.Generic; +using System.Collections.Immutable; using System.Linq; using System.Text; using System.Threading.Tasks; using Akka.Actor; using Akka.Dispatch; using Akka.Dispatch.SysMsg; -using Akka.Util.Internal.Collections; namespace Akka.Remote { @@ -24,8 +24,8 @@ namespace Akka.Remote internal class RemoteDeploymentWatcher : ActorBase, IRequiresMessageQueue { - private readonly IImmutableMap _supervisors = - ImmutableTreeMap.Empty; + private readonly IImmutableDictionary _supervisors = + ImmutableDictionary.Empty; protected override bool Receive(object message) { if (message == null) @@ -39,7 +39,7 @@ protected override bool Receive(object message) }).With(t => { IInternalActorRef supervisor; - if (_supervisors.TryGet(t.ActorRef, out supervisor)) + if (_supervisors.TryGetValue(t.ActorRef, out supervisor)) { supervisor.SendSystemMessage(new DeathWatchNotification(t.ActorRef, t.ExistenceConfirmed, t.AddressTerminated), supervisor); _supervisors.Remove(t.ActorRef); diff --git a/src/core/Akka.Remote/RemoteSystemDaemon.cs b/src/core/Akka.Remote/RemoteSystemDaemon.cs index 58cbad821fd..0ea0c747fbf 100644 --- a/src/core/Akka.Remote/RemoteSystemDaemon.cs +++ b/src/core/Akka.Remote/RemoteSystemDaemon.cs @@ -7,6 +7,7 @@ using System.Collections.Concurrent; using System.Collections.Generic; +using System.Collections.Immutable; using System.Linq; using Akka.Actor; using Akka.Actor.Internal; @@ -14,7 +15,6 @@ using Akka.Event; using Akka.Util; using Akka.Util.Internal; -using Akka.Util.Internal.Collections; namespace Akka.Remote { @@ -184,7 +184,7 @@ protected void OnReceive(object message, IActorRef sender) { _terminating.Locked(() => { - IImmutableSet children; + IImmutableSet children; if (_parent2Children.TryRemove(parent,out children)) { foreach (var c in children) @@ -303,7 +303,7 @@ private bool AddChildParentNeedsWatch(IActorRef parent, IActorRef child) const bool weDontHaveTailRecursion = true; while (weDontHaveTailRecursion) { - if (_parent2Children.TryAdd(parent, ImmutableTreeSet.Create(child))) + if (_parent2Children.TryAdd(parent, ImmutableHashSet.Empty.Add(child))) return true; //child was successfully added IImmutableSet children; diff --git a/src/core/Akka.Remote/packages.config b/src/core/Akka.Remote/packages.config index d7d4f187704..209fb1e6e61 100644 --- a/src/core/Akka.Remote/packages.config +++ b/src/core/Akka.Remote/packages.config @@ -2,4 +2,5 @@ + \ No newline at end of file diff --git a/src/core/Akka.Tests/Akka.Tests.csproj b/src/core/Akka.Tests/Akka.Tests.csproj index 17a71c92e4b..11534fe99f8 100644 --- a/src/core/Akka.Tests/Akka.Tests.csproj +++ b/src/core/Akka.Tests/Akka.Tests.csproj @@ -188,8 +188,6 @@ - - diff --git a/src/core/Akka.Tests/Util/Internal/Collections/ImmutableAvlTreeMapTests.cs b/src/core/Akka.Tests/Util/Internal/Collections/ImmutableAvlTreeMapTests.cs deleted file mode 100644 index 5748a610e0e..00000000000 --- a/src/core/Akka.Tests/Util/Internal/Collections/ImmutableAvlTreeMapTests.cs +++ /dev/null @@ -1,43 +0,0 @@ -//----------------------------------------------------------------------- -// -// Copyright (C) 2009-2016 Typesafe Inc. -// Copyright (C) 2013-2016 Akka.NET project -// -//----------------------------------------------------------------------- - -using System; -using Akka.TestKit; -using Akka.Util.Internal.Collections; -using Xunit; - -namespace Akka.Tests.Util.Internal.Collections -{ - public class ImmutableAvlTreeMapTests - { - [Fact] - public void AddingSamekeyTwiceAreNotAllowed() - { - var tree = ImmutableTreeMap.Empty - .Add(3, "c") - .Add(2, "b"); - - Assert.Throws(() => tree.Add(3, "XXXX")); - } - - [Fact] - public void Removing_last_item_returns_empty_map() - { - var map = ImmutableTreeMap.Empty - .Add(1, "a"); - - ImmutableTreeMap removedMap; - map.TryRemove(1, out removedMap).ShouldBeTrue(); - removedMap.IsEmpty.ShouldBeTrue(); - - ImmutableTreeMap removedMap2; - removedMap.TryRemove(1, out removedMap2).ShouldBeFalse(); - removedMap2.IsEmpty.ShouldBeTrue(); - } - } -} - diff --git a/src/core/Akka.Tests/Util/Internal/Collections/ImmutableAvlTreeTests.cs b/src/core/Akka.Tests/Util/Internal/Collections/ImmutableAvlTreeTests.cs deleted file mode 100644 index 4859a0d9300..00000000000 --- a/src/core/Akka.Tests/Util/Internal/Collections/ImmutableAvlTreeTests.cs +++ /dev/null @@ -1,286 +0,0 @@ -//----------------------------------------------------------------------- -// -// Copyright (C) 2009-2016 Typesafe Inc. -// Copyright (C) 2013-2016 Akka.NET project -// -//----------------------------------------------------------------------- - -using System; -using System.Linq; -using Akka.TestKit; -using Akka.Util.Internal.Collections; -using Xunit; - -namespace Akka.Tests.Util.Internal.Collections -{ - public class ImmutableAvlTreeTests - { - - [Fact] - public void CanGetSuccessfully() - { - var m = ImmutableAvlTree.Empty - .Add(1, 11) - .Add(2, 22) - .Add(3, 33); - - Assert.Equal(11, m[1]); - Assert.Equal(22, m[2]); - Assert.Equal(33, m[3]); - } - - [Fact] - public void LLCase() - { - var m = ImmutableAvlTree.Empty - .Add(5, 1) - .Add(4, 2) - .Add(3, 3); - - Assert.Equal(4, m.Root.Key); - Assert.Equal(3, m.Root.Left.Key); - Assert.Equal(5, m.Root.Right.Key); - } - - [Fact] - public void TreeRemainsBalancedAfterUnbalancedInsertIntoBalancedTree() - { - var m = ImmutableAvlTree.Empty - .Add(5, 1) - .Add(4, 2) - .Add(3, 3) - .Add(2, 4) - .Add(1, 5); - - Assert.Equal(4, m.Root.Key); - Assert.Equal(2, m.Root.Left.Key); - Assert.Equal(1, m.Root.Left.Left.Key); - Assert.Equal(3, m.Root.Left.Right.Key); - Assert.Equal(5, m.Root.Right.Key); - } - - [Fact] - public void LRCase() - { - var m = ImmutableAvlTree.Empty - .Add(5, 1) - .Add(3, 2) - .Add(4, 3); - - Assert.Equal(4, m.Root.Key); - Assert.Equal(3, m.Root.Left.Key); - Assert.Equal(5, m.Root.Right.Key); - } - - [Fact] - public void RRCase() - { - var m = ImmutableAvlTree.Empty - .Add(3, 1) - .Add(4, 2) - .Add(5, 3); - - Assert.Equal(4, m.Root.Key); - Assert.Equal(3, m.Root.Left.Key); - Assert.Equal(5, m.Root.Right.Key); - } - - [Fact] - public void RLCase() - { - var m = ImmutableAvlTree.Empty - .Add(3, 1) - .Add(5, 2) - .Add(4, 3); - - Assert.Equal(4, m.Root.Key); - Assert.Equal(3, m.Root.Left.Key); - Assert.Equal(5, m.Root.Right.Key); - } - - [Fact] - public void EnumerateInOrder() - { - var m = ImmutableAvlTree.Empty - .Add(3, "c") - .Add(2, "b") - .Add(1, "a") - .Add(5, "e") - .Add(6, "f") - .Add(0, ""); - m.AllMinToMax.Select(kvp => kvp.Value).ShouldOnlyContainInOrder("", "a", "b", "c", "e", "f"); - } - - [Fact] - public void EnumerateReversedInOrder() - { - var m = ImmutableAvlTree.Empty - .Add(3, "c") - .Add(2, "b") - .Add(1, "a") - .Add(5, "e") - .Add(6, "f") - .Add(0, ""); - m.AllMaxToMin.Select(kvp => kvp.Value).ShouldOnlyContainInOrder("f", "e", "c", "b", "a", ""); - } - - - [Fact] - public void AddingSamekeyTwiceAreAllowed() - { - var tree = ImmutableAvlTree.Empty - .Add(3, "c") - .Add(2, "b"); - - //Should not fail: - tree.Add(3, "XXXX"); - } - - [Fact] - public void WhenRemovingNodeThatCausesUnbalanceTheTreeIsRebalanced() - { - var tree = ImmutableAvlTree.Empty - .Add(17, 17) - .Add(32, 32) - .Add(44, 44) - .Add(48, 48) - .Add(50, 50) - .Add(62, 62) - .Add(78, 78) - .Add(88, 88); - Assert.Equal(48, tree.Root.Key); - Assert.Equal(32, tree.Root.Left.Key); - Assert.Equal(17, tree.Root.Left.Left.Key); - Assert.Equal(44, tree.Root.Left.Right.Key); - Assert.Equal(62, tree.Root.Right.Key); - Assert.Equal(50, tree.Root.Right.Left.Key); - Assert.Equal(78, tree.Root.Right.Right.Key); - Assert.Equal(88, tree.Root.Right.Right.Right.Key); - - ImmutableAvlTree newTree; - tree.TryRemove(50, out newTree).ShouldBeTrue(); - - Assert.Equal(48, newTree.Root.Key); - Assert.Equal(32, newTree.Root.Left.Key); - Assert.Equal(17, newTree.Root.Left.Left.Key); - Assert.Equal(44, newTree.Root.Left.Right.Key); - Assert.Equal(78, newTree.Root.Right.Key); - Assert.Equal(62, newTree.Root.Right.Left.Key); - Assert.Equal(88, newTree.Root.Right.Right.Key); - - } - - private static int TreeImbalance(ImmutableAvlTree tree) - { - var lh = NodeHeight(tree.Root.Left); - var rh = NodeHeight(tree.Root.Right); - return lh - rh; - } - - private static int NodeHeight(IBinaryTreeNode tree) - { - if (tree == null) return 0; - return Math.Max(NodeHeight(tree.Left), NodeHeight(tree.Right)) + 1; - } - - [Fact] - public void WhenRemovingNodeThatCausesLeftThenRightHeavyUnbalanceTheTreeIsRebalanced() - { - var tree = ImmutableAvlTree.Empty - .Add(60, 6) - .Add(20, 2) - .Add(80, 8) - .Add(10, 1) - .Add(70, 7) - .Add(40, 4) - .Add(30, 3) - .Add(50, 5); - Assert.Equal(60, tree.Root.Key); - Assert.Equal(20, tree.Root.Left.Key); - Assert.Equal(10, tree.Root.Left.Left.Key); - Assert.Equal(40, tree.Root.Left.Right.Key); - Assert.Equal(80, tree.Root.Right.Key); - Assert.Equal(70, tree.Root.Right.Left.Key); - Assert.Null(tree.Root.Right.Right); - tree = tree.Remove(70); - - Assert.InRange(TreeImbalance(tree), -1, 1); - - Assert.Equal(40, tree.Root.Key); - Assert.Equal(20, tree.Root.Left.Key); - Assert.Equal(60, tree.Root.Right.Key); - Assert.Equal(10, tree.Root.Left.Left.Key); - Assert.Equal(30, tree.Root.Left.Right.Key); - Assert.Equal(50, tree.Root.Right.Left.Key); - Assert.Equal(80, tree.Root.Right.Right.Key); - } - - [Fact] - public void WhenRemovingNodeThatCausesRightThenLeftHeavyUnbalanceTheTreeIsRebalanced() - { - var tree = ImmutableAvlTree.Empty - .Add(-60, 6) - .Add(-20, 2) - .Add(-80, 8) - .Add(-10, 1) - .Add(-70, 7) - .Add(-40, 4) - .Add(-30, 3) - .Add(-50, 5); - Assert.Equal(-60, tree.Root.Key); - Assert.Equal(-20, tree.Root.Right.Key); - Assert.Equal(-10, tree.Root.Right.Right.Key); - Assert.Equal(-40, tree.Root.Right.Left.Key); - Assert.Equal(-80, tree.Root.Left.Key); - Assert.Equal(-70, tree.Root.Left.Right.Key); - Assert.Null(tree.Root.Left.Left); - tree = tree.Remove(-70); - - Assert.InRange(TreeImbalance(tree), -1, 1); - - Assert.Equal(-40, tree.Root.Key); - Assert.Equal(-20, tree.Root.Right.Key); - Assert.Equal(-60, tree.Root.Left.Key); - Assert.Equal(-10, tree.Root.Right.Right.Key); - Assert.Equal(-30, tree.Root.Right.Left.Key); - Assert.Equal(-50, tree.Root.Left.Right.Key); - Assert.Equal(-80, tree.Root.Left.Left.Key); - } - - [Fact] - public void WhenRemovingNodeThatDoNotExistSameTreeIsReturned() - { - var tree = ImmutableAvlTree.Empty - .Add(17, 17) - .Add(32, 32) - .Add(44, 44) - .Add(48, 48) - .Add(50, 50) - .Add(62, 62) - .Add(78, 78) - .Add(88, 88); - - ImmutableAvlTree newTree; - tree.TryRemove(-4711, out newTree).ShouldBeFalse(); - Assert.Same(tree, newTree); - - } - - - [Fact] - public void Removing_last_item_returns_empty_map() - { - var tree = ImmutableAvlTree.Empty - .Add(1, "a"); - - ImmutableAvlTree removedTree; - tree.TryRemove(1, out removedTree).ShouldBeTrue(); - removedTree.IsEmpty.ShouldBeTrue(); - - ImmutableAvlTree removedTree2; - removedTree.TryRemove(1, out removedTree2).ShouldBeFalse(); - removedTree2.IsEmpty.ShouldBeTrue(); - } - } -} - diff --git a/src/core/Akka/Actor/Cell.cs b/src/core/Akka/Actor/Cell.cs index 264a0917e0b..5ca931d1cdf 100644 --- a/src/core/Akka/Actor/Cell.cs +++ b/src/core/Akka/Actor/Cell.cs @@ -8,7 +8,6 @@ using System; using System.Collections.Generic; using Akka.Actor.Internal; -using Akka.Actor.Internal; namespace Akka.Actor { diff --git a/src/core/Akka/Actor/ChildrenContainer/Internal/ChildrenContainerBase.cs b/src/core/Akka/Actor/ChildrenContainer/Internal/ChildrenContainerBase.cs index 092ae4a877d..e51eaf74749 100644 --- a/src/core/Akka/Actor/ChildrenContainer/Internal/ChildrenContainerBase.cs +++ b/src/core/Akka/Actor/ChildrenContainer/Internal/ChildrenContainerBase.cs @@ -6,6 +6,7 @@ //----------------------------------------------------------------------- using System.Collections.Generic; +using System.Collections.Immutable; using System.Linq; using System.Text; using Akka.Util.Internal.Collections; @@ -14,9 +15,9 @@ namespace Akka.Actor.Internal { public abstract class ChildrenContainerBase : IChildrenContainer { - private readonly IImmutableMap _children; + private readonly IImmutableDictionary _children; - protected ChildrenContainerBase(IImmutableMap children) + protected ChildrenContainerBase(IImmutableDictionary children) { _children = children; } @@ -33,7 +34,7 @@ public IReadOnlyList Children { get { - return (from stat in InternalChildren.AllValuesMinToMax + return (from stat in InternalChildren.Values let childRestartStats = stat as ChildRestartStats where childRestartStats != null select childRestartStats.Child).ToList(); @@ -44,18 +45,18 @@ public IReadOnlyList Stats { get { - return (from stat in InternalChildren.AllValuesMinToMax + return (from stat in InternalChildren.Values let childRestartStats = stat as ChildRestartStats where childRestartStats != null select childRestartStats).ToList(); } } - protected IImmutableMap InternalChildren { get { return _children; } } + protected IImmutableDictionary InternalChildren { get { return _children; } } public bool TryGetByName(string name, out IChildStats stats) { - if (InternalChildren.TryGet(name, out stats)) return true; + if (InternalChildren.TryGetValue(name, out stats)) return true; stats = null; return false; } @@ -63,7 +64,7 @@ public bool TryGetByName(string name, out IChildStats stats) public bool TryGetByRef(IActorRef actor, out ChildRestartStats childRestartStats) { IChildStats stats; - if (InternalChildren.TryGet(actor.Path.Name, out stats)) + if (InternalChildren.TryGetValue(actor.Path.Name, out stats)) { //Since the actor exists, ChildRestartStats is the only valid ChildStats. var crStats = stats as ChildRestartStats; @@ -83,7 +84,7 @@ public bool Contains(IActorRef actor) return TryGetByRef(actor, out stats); } - protected void ChildStatsAppender(StringBuilder sb, IKeyValuePair kvp, int index) + protected void ChildStatsAppender(StringBuilder sb, KeyValuePair kvp, int index) { sb.Append('<'); var childStats = kvp.Value; diff --git a/src/core/Akka/Actor/ChildrenContainer/Internal/EmptyChildrenContainer.cs b/src/core/Akka/Actor/ChildrenContainer/Internal/EmptyChildrenContainer.cs index b014e56f637..7317cc2ce8c 100644 --- a/src/core/Akka/Actor/ChildrenContainer/Internal/EmptyChildrenContainer.cs +++ b/src/core/Akka/Actor/ChildrenContainer/Internal/EmptyChildrenContainer.cs @@ -6,6 +6,7 @@ //----------------------------------------------------------------------- using System.Collections.Generic; +using System.Collections.Immutable; using Akka.Util.Internal.Collections; namespace Akka.Actor.Internal @@ -15,7 +16,7 @@ namespace Akka.Actor.Internal /// public class EmptyChildrenContainer : IChildrenContainer { - private static readonly ImmutableTreeMap _emptyStats = ImmutableTreeMap.Empty; + private static readonly ImmutableDictionary _emptyStats = ImmutableDictionary.Empty; private static readonly IChildrenContainer _instance = new EmptyChildrenContainer(); protected EmptyChildrenContainer() @@ -53,9 +54,9 @@ public bool Contains(IActorRef actor) return false; } - public IReadOnlyList Children { get { return EmptyReadOnlyCollections.List; } } + public IReadOnlyList Children { get { return ImmutableList.Empty; } } - public IReadOnlyList Stats { get { return EmptyReadOnlyCollections.List; } } + public IReadOnlyList Stats { get { return ImmutableList.Empty; } } public IChildrenContainer ShallDie(IActorRef actor) { diff --git a/src/core/Akka/Actor/ChildrenContainer/Internal/NormalChildrenContainer.cs b/src/core/Akka/Actor/ChildrenContainer/Internal/NormalChildrenContainer.cs index 5487e6b02ee..87630166f30 100644 --- a/src/core/Akka/Actor/ChildrenContainer/Internal/NormalChildrenContainer.cs +++ b/src/core/Akka/Actor/ChildrenContainer/Internal/NormalChildrenContainer.cs @@ -5,6 +5,7 @@ // //----------------------------------------------------------------------- +using System.Collections.Immutable; using System.Text; using Akka.Util.Internal; using Akka.Util.Internal.Collections; @@ -18,20 +19,20 @@ namespace Akka.Actor.Internal /// public class NormalChildrenContainer : ChildrenContainerBase { - private NormalChildrenContainer(IImmutableMap children) + private NormalChildrenContainer(IImmutableDictionary children) : base(children) { } - public static IChildrenContainer Create(IImmutableMap children) + public static IChildrenContainer Create(IImmutableDictionary children) { - if (children.IsEmpty) return EmptyChildrenContainer.Instance; + if (children.Count == 0) return EmptyChildrenContainer.Instance; return new NormalChildrenContainer(children); } public override IChildrenContainer Add(string name, ChildRestartStats stats) { - return Create(InternalChildren.AddOrUpdate(name, stats)); + return Create(InternalChildren.SetItem(name, stats)); } public override IChildrenContainer Remove(IActorRef child) @@ -46,15 +47,15 @@ public override IChildrenContainer ShallDie(IActorRef actor) public override IChildrenContainer Reserve(string name) { - if (InternalChildren.Contains(name)) + if (InternalChildren.ContainsKey(name)) throw new InvalidActorNameException(string.Format("Actor name \"{0}\" is not unique!", name)); - return new NormalChildrenContainer(InternalChildren.AddOrUpdate(name, ChildNameReserved.Instance)); + return new NormalChildrenContainer(InternalChildren.SetItem(name, ChildNameReserved.Instance)); } public override IChildrenContainer Unreserve(string name) { IChildStats stats; - if (InternalChildren.TryGet(name, out stats) && (stats is ChildNameReserved)) + if (InternalChildren.TryGetValue(name, out stats) && (stats is ChildNameReserved)) { return Create(InternalChildren.Remove(name)); } @@ -67,7 +68,7 @@ public override string ToString() if (numberOfChildren > 20) return numberOfChildren + " children"; var sb = new StringBuilder(); - sb.Append("Children:\n ").AppendJoin("\n ", InternalChildren.AllMinToMax, ChildStatsAppender); + sb.Append("Children:\n ").AppendJoin("\n ", InternalChildren, ChildStatsAppender); return sb.ToString(); } diff --git a/src/core/Akka/Actor/ChildrenContainer/Internal/TerminatingChildrenContainer.cs b/src/core/Akka/Actor/ChildrenContainer/Internal/TerminatingChildrenContainer.cs index d437865872d..6304c6fee64 100644 --- a/src/core/Akka/Actor/ChildrenContainer/Internal/TerminatingChildrenContainer.cs +++ b/src/core/Akka/Actor/ChildrenContainer/Internal/TerminatingChildrenContainer.cs @@ -6,6 +6,7 @@ //----------------------------------------------------------------------- using System; +using System.Collections.Immutable; using System.Text; using Akka.Util.Internal; using Akka.Util.Internal.Collections; @@ -23,15 +24,15 @@ namespace Akka.Actor.Internal /// public class TerminatingChildrenContainer : ChildrenContainerBase { - private readonly IImmutableSet _toDie; + private readonly ImmutableHashSet _toDie; private readonly SuspendReason _reason; - public TerminatingChildrenContainer(IImmutableMap children, IActorRef toDie, SuspendReason reason) - : this(children, ImmutableTreeSet.Create(toDie), reason) + public TerminatingChildrenContainer(IImmutableDictionary children, IActorRef toDie, SuspendReason reason) + : this(children, ImmutableHashSet.Empty.Add(toDie), reason) { //Intentionally left blank } - public TerminatingChildrenContainer(IImmutableMap children, IImmutableSet toDie, SuspendReason reason) + public TerminatingChildrenContainer(IImmutableDictionary children, ImmutableHashSet toDie, SuspendReason reason) : base(children) { _toDie = toDie; @@ -42,7 +43,7 @@ public TerminatingChildrenContainer(IImmutableMap children, public override IChildrenContainer Add(string name, ChildRestartStats stats) { - var newMap = InternalChildren.AddOrUpdate(name, stats); + var newMap = InternalChildren.SetItem(name, stats); return new TerminatingChildrenContainer(newMap, _toDie, _reason); } @@ -65,16 +66,16 @@ public override IChildrenContainer ShallDie(IActorRef actor) public override IChildrenContainer Reserve(string name) { if (_reason is SuspendReason.Termination) throw new InvalidOperationException(string.Format("Cannot reserve actor name\"{0}\". Is terminating.", name)); - if (InternalChildren.Contains(name)) + if (InternalChildren.ContainsKey(name)) throw new InvalidActorNameException(string.Format("Actor name \"{0}\" is not unique!", name)); else - return new TerminatingChildrenContainer(InternalChildren.AddOrUpdate(name, ChildNameReserved.Instance), _toDie, _reason); + return new TerminatingChildrenContainer(InternalChildren.SetItem(name, ChildNameReserved.Instance), _toDie, _reason); } public override IChildrenContainer Unreserve(string name) { IChildStats stats; - if (!InternalChildren.TryGet(name, out stats)) + if (!InternalChildren.TryGetValue(name, out stats)) return this; return new TerminatingChildrenContainer(InternalChildren.Remove(name), _toDie, _reason); } @@ -97,11 +98,11 @@ public override string ToString() if (numberOfChildren > 10) sb.Append(numberOfChildren).Append(" children\n"); else - sb.Append("Children:\n ").AppendJoin("\n ", InternalChildren.AllMinToMax, ChildStatsAppender).Append('\n'); + sb.Append("Children:\n ").AppendJoin("\n ", InternalChildren, ChildStatsAppender).Append('\n'); var numberToDie = _toDie.Count; sb.Append(numberToDie).Append(" children terminating:\n "); - sb.AppendJoin("\n ", _toDie.AllMinToMax); + sb.AppendJoin("\n ", _toDie); return sb.ToString(); } diff --git a/src/core/Akka/Akka.csproj b/src/core/Akka/Akka.csproj index 6c29d125ad2..2bdb175908a 100644 --- a/src/core/Akka/Akka.csproj +++ b/src/core/Akka/Akka.csproj @@ -59,6 +59,10 @@ ..\..\packages\Newtonsoft.Json.7.0.1\lib\net45\Newtonsoft.Json.dll + + ..\..\packages\System.Collections.Immutable.1.1.36\lib\portable-net45+win8+wp8+wpa81\System.Collections.Immutable.dll + True + @@ -275,15 +279,8 @@ - - - - - - - diff --git a/src/core/Akka/Event/EventStream.cs b/src/core/Akka/Event/EventStream.cs index 5bdfe544a6c..e8241ebc356 100644 --- a/src/core/Akka/Event/EventStream.cs +++ b/src/core/Akka/Event/EventStream.cs @@ -7,12 +7,13 @@ using System; using System.Collections.Generic; +using System.Collections.Immutable; using System.Linq; using Akka.Actor; using Akka.Actor.Internal; using Akka.Util; using Akka.Util.Internal; -using Akka.Util.Internal.Collections; + namespace Akka.Event { diff --git a/src/core/Akka/Util/Internal/Collections/IImmutableMap.cs b/src/core/Akka/Util/Internal/Collections/IImmutableMap.cs deleted file mode 100644 index dde3fff5dfb..00000000000 --- a/src/core/Akka/Util/Internal/Collections/IImmutableMap.cs +++ /dev/null @@ -1,42 +0,0 @@ -//----------------------------------------------------------------------- -// -// Copyright (C) 2009-2016 Typesafe Inc. -// Copyright (C) 2013-2016 Akka.NET project -// -//----------------------------------------------------------------------- - -using System; -using System.Collections.Generic; - -namespace Akka.Util.Internal.Collections -{ - public interface IImmutableMap where TKey : IComparable - { - bool IsEmpty { get; } - int Count { get; } - - bool TryGet(TKey key, out TValue value); - TValue this[TKey key] { get; } - - bool Contains(TKey key); - - bool TryAdd(TKey key, TValue value, out IImmutableMap newMap); - IImmutableMap Add(TKey key, TValue value); - - IImmutableMap AddOrUpdate(TKey key, TValue value); - - IEnumerable> AllMinToMax { get; } - IEnumerable> AllMaxToMin { get; } - - IEnumerable AllKeysMinToMax { get; } - IEnumerable AllKeysMaxToMin { get; } - - IEnumerable AllValuesMinToMax { get; } - IEnumerable AllValuesMaxToMin { get; } - - IImmutableMap Remove(TKey key); - bool TryRemove(TKey key, out IImmutableMap newMap); - - } -} - diff --git a/src/core/Akka/Util/Internal/Collections/IImmutableSet.cs b/src/core/Akka/Util/Internal/Collections/IImmutableSet.cs deleted file mode 100644 index 9f8441c1d0b..00000000000 --- a/src/core/Akka/Util/Internal/Collections/IImmutableSet.cs +++ /dev/null @@ -1,51 +0,0 @@ -//----------------------------------------------------------------------- -// -// Copyright (C) 2009-2016 Typesafe Inc. -// Copyright (C) 2013-2016 Akka.NET project -// -//----------------------------------------------------------------------- - -using System; -using System.Collections.Generic; -using System.Diagnostics.Contracts; -using System.Linq; - -namespace Akka.Util.Internal.Collections -{ - public interface IImmutableSet : IEnumerable where TValue : IComparable - { - bool IsEmpty { get; } - int Count { get; } - - - [Pure] - bool Contains(TValue value); - - bool TryAdd(TValue value, out IImmutableSet newMap); - - [Pure] - IImmutableSet Add(TValue value); - - - IEnumerable AllMinToMax { get; } - IEnumerable AllMaxToMin { get; } - - [Pure] - IImmutableSet Remove(TValue value); - - [Pure] - IImmutableSet Remove(IEnumerable values); - - bool TryRemove(TValue value, out IImmutableSet newMap); - } - - public static class ImmutableSetExtensions - { - [Pure] - public static IImmutableSet Remove(this IImmutableSet set, Predicate itemsToRemove) where TValue : IComparable - { - return set.Remove(set.Where(v => itemsToRemove(v))); - } - } -} - diff --git a/src/core/Akka/Util/Internal/Collections/ImmutableAvlTree.cs b/src/core/Akka/Util/Internal/Collections/ImmutableAvlTree.cs deleted file mode 100644 index 403c993ab5b..00000000000 --- a/src/core/Akka/Util/Internal/Collections/ImmutableAvlTree.cs +++ /dev/null @@ -1,65 +0,0 @@ -//----------------------------------------------------------------------- -// -// Copyright (C) 2009-2016 Typesafe Inc. -// Copyright (C) 2013-2016 Akka.NET project -// -//----------------------------------------------------------------------- - -using System; - -namespace Akka.Util.Internal.Collections -{ - /// - /// An immutable AVL tree. - /// Originally from http://justinmchase.com/2011/12/13/immutable-avl-tree-in-c/ - /// - /// The type of the keys. - /// The type of the values. - public sealed class ImmutableAvlTree : ImmutableAvlTreeBase where TKey : IComparable - { - public static readonly ImmutableAvlTree Empty = new ImmutableAvlTree(); - - private ImmutableAvlTree(){} - - private ImmutableAvlTree(ImmutableAvlTreeBase.Node node) : base(node) - { - //Intentionally left blank - } - - - public ImmutableAvlTree Add(TKey key, TValue value) - { - Node newNode; - TryAdd(key, value, out newNode, AddOperation.Add); - return new ImmutableAvlTree(newNode); - } - - - public ImmutableAvlTree AddOrUpdate(TKey key, TValue value) - { - Node newNode; - TryAdd(key, value, out newNode, AddOperation.AddOrUpdate); - return new ImmutableAvlTree(newNode); - } - - - public ImmutableAvlTree Remove(TKey key) - { - ImmutableAvlTree newMap; - return TryRemove(key, out newMap) ? newMap : this; - } - - public bool TryRemove(TKey key, out ImmutableAvlTree newMap) - { - Node newNode; - if (TryRemove(key, out newNode)) - { - newMap = newNode == null ? Empty : new ImmutableAvlTree(newNode); - return true; - } - newMap = this; - return false; - } - } -} - diff --git a/src/core/Akka/Util/Internal/Collections/ImmutableAvlTreeBase.cs b/src/core/Akka/Util/Internal/Collections/ImmutableAvlTreeBase.cs deleted file mode 100644 index cef0a8159a3..00000000000 --- a/src/core/Akka/Util/Internal/Collections/ImmutableAvlTreeBase.cs +++ /dev/null @@ -1,471 +0,0 @@ -//----------------------------------------------------------------------- -// -// Copyright (C) 2009-2016 Typesafe Inc. -// Copyright (C) 2013-2016 Akka.NET project -// -//----------------------------------------------------------------------- - -using System; -using System.Collections; -using System.Collections.Generic; -using System.Linq; -using System.Text; - -namespace Akka.Util.Internal.Collections -{ - /// - /// An immutable AVL tree. - /// Originally from http://justinmchase.com/2011/12/13/immutable-avl-tree-in-c/ - /// - /// The type of the keys. - /// The type of the values. - public abstract class ImmutableAvlTreeBase : IEnumerable> where TKey : IComparable - { - private readonly Node _node; - - - public IBinaryTreeNode Root - { - get { return _node; } - } - - protected ImmutableAvlTreeBase() - { - _node = null; - } - - protected ImmutableAvlTreeBase(Node node) - { - if (node == null) throw new ArgumentNullException("node"); - _node = node; - } - - public bool IsEmpty { get { return _node == null; } } - public int Count { get { return _node == null ? 0 : _node.Count; } } - - public bool Contains(TKey key) - { - Node node; - var wasFound = TryGet(key, _node, out node); - return wasFound; - } - - public bool TryGet(TKey key, out TValue value) - { - Node node; - var wasFound = TryGet(key, _node, out node); - if (wasFound) - { - value = node.Value; - return true; - } - value = default(TValue); - return false; - } - - public TValue this[TKey key] - { - get - { - TValue value; - TryGet(key, out value); - return value; - } - } - - - private static bool TryGet(TKey key, Node startNode, out Node node) - { - var currentNode = startNode; - while (currentNode != null) - { - var comparison = currentNode.Key.CompareTo(key); - if (comparison == 0) - { - node = currentNode; - return true; - } - if (comparison > 0) - currentNode = currentNode.Left; - else - currentNode = currentNode.Right; - } - node = null; - return false; - } - - protected bool TryAdd(TKey key, TValue value, out Node newNode, AddOperation typeOfAdd) - { - return TryAdd(_node, key, value, out newNode, typeOfAdd); - } - - protected enum AddOperation { Add, AddOrUpdate, AddOnlyUnique } - protected static bool TryAdd(Node node, TKey key, TValue value, out Node newNode, AddOperation typeOfAdd) - { - if (node == null) - { - newNode = new Node(key, value, null, null); - return true; - } - - var comparison = node.Key.CompareTo(key); - var keyAlreadyExists = comparison == 0; - if (keyAlreadyExists) - { - switch (typeOfAdd) - { - - case AddOperation.AddOrUpdate: - newNode = new Node(key, value, node.Left, node.Right); - return true; - case AddOperation.AddOnlyUnique: - newNode = null; - return false; - //case AddOperation.Add: - //default: - // //Intentionally left blank - // break; - } - } - - var l = node.Left; - var r = node.Right; - - if (comparison > 0) - { - Node nd; - var couldAdd = TryAdd(node.Left, key, value, out nd, typeOfAdd); - if (!couldAdd) - { - newNode = null; - return false; - } - l = nd; - } - else - { - Node nd; - var couldAdd = TryAdd(node.Right, key, value, out nd, typeOfAdd); - if (!couldAdd) - { - newNode = null; - return false; - } - r = nd; - } - - var n = new Node(node.Key, node.Value, l, r); - var lh = n.Left == null ? 0 : n.Left.Height; - var rh = n.Right == null ? 0 : n.Right.Height; - var b = lh - rh; - - if (Math.Abs(b) == 2) // 2 or -2 means unbalanced - { - if (b == 2) // L - { - var llh = n.Left.Left == null ? 0 : n.Left.Left.Height; - var lrh = n.Left.Right == null ? 0 : n.Left.Right.Height; - var lb = llh - lrh; - if (lb == 1) // LL - { - // rotate right - n = RotateRight(n); - } - else // LR - { - // rotate left - // rotate right - l = RotateLeft(l); - n = new Node(n.Key, n.Value, l, r); - n = RotateRight(n); - } - } - else // R - { - var rlh = n.Right.Left == null ? 0 : n.Right.Left.Height; - var rrh = n.Right.Right == null ? 0 : n.Right.Right.Height; - var rb = rlh - rrh; - if (rb == 1) // RL - { - // rotate right - // rotate left - r = RotateRight(r); - n = new Node(n.Key, n.Value, l, r); - n = RotateLeft(n); - } - else // RR - { - // rotate left - n = RotateLeft(n); - } - } - } - newNode = n; - return true; - } - - private static Node RotateRight(Node node) - { - // (5) 4 - // / \ / \ - // 4 D / \ - // / \ 3 5 - // 3 C --> / \ / \ - // / \ A B C D - // A B - - var L = node.Left.Left; - var R = new Node(node.Key, node.Value, node.Left.Right, node.Right); - var N = new Node(node.Left.Key, node.Left.Value, L, R); - return N; - } - - private static Node RotateLeft(Node node) - { - // (3) 4 - // / \ / \ - // A 4 / \ - // / \ 3 5 - // B 5 --> / \ / \ - // / \ A B C D - // C D - - var L = new Node(node.Key, node.Value, node.Left, node.Right.Left); - var R = node.Right.Right; - var N = new Node(node.Right.Key, node.Right.Value, L, R); - return N; - } - - private static Node DoubleRightRotation(Node node) - { - if (node.Left == null) return node; - var rotatedLeftChild = new Node(node.Key, node.Value, RotateLeft(node.Left), node.Right); - return RotateRight(rotatedLeftChild); - } - private static Node DoubleLeftRotation(Node node) - { - if (node.Right == null) return node; - var rotatedRightChild = new Node(node.Key, node.Value, node.Left, RotateRight(node.Right)); - return RotateLeft(rotatedRightChild); - } - - public IEnumerable> AllMinToMax { get { return EnumerateMinToMax(); } } - public IEnumerable> AllMaxToMin { get { return EnumerateMaxToMin(); } } - - public IEnumerable AllValuesMinToMax { get { return EnumerateMinToMax().Select(kvp => kvp.Value); } } - public IEnumerable AllValuesMaxToMin { get { return EnumerateMaxToMin().Select(kvp => kvp.Value); ; } } - - public IEnumerable AllKeysMinToMax { get { return EnumerateMinToMax().Select(kvp => kvp.Key); } } - public IEnumerable AllKeysMaxToMin { get { return EnumerateMaxToMin().Select(kvp => kvp.Key); ; } } - - - - public IEnumerator> GetEnumerator() - { - return EnumerateMinToMax().GetEnumerator(); - } - - IEnumerator IEnumerable.GetEnumerator() - { - return GetEnumerator(); - } - - private IEnumerable> EnumerateMinToMax() - { - var stack = new Stack(8); - for (var current = _node; current != null || stack.Count != 0; current = current.Right) - { - while (current != null) - { - stack.Push(current); - current = current.Left; - } - current = stack.Pop(); - yield return current; - } - } - private IEnumerable> EnumerateMaxToMin() - { - var stack = new Stack(8); - for (var current = _node; current != null || stack.Count != 0; current = current.Left) - { - while (current != null) - { - stack.Push(current); - current = current.Right; - } - current = stack.Pop(); - yield return current; - } - } - - public override string ToString() - { - return _node.ToString(); - } - - public class Node : IBinaryTreeNode - { - private readonly Node _left; - private readonly Node _right; - private readonly int _height; - private readonly TKey _key; - private readonly TValue _value; - private readonly int _count; - - public TKey Key { get { return _key; } } - public TValue Value { get { return _value; } } - public int Height { get { return _height; } } - public Node Left { get { return _left; } } - public Node Right { get { return _right; } } - public int Count { get { return _count; } } - - IBinaryTreeNode IBinaryTreeNode.Left { get { return _left; } } - IBinaryTreeNode IBinaryTreeNode.Right { get { return _right; } } - - public Node(TKey key, TValue value, Node left, Node right) - { - _key = key; - _value = value; - _left = left; - _right = right; - - var leftHeight = 0; - var leftCount = 0; - var rightHeight = 0; - var rightCount = 0; - if (left != null) - { - leftHeight = left.Height; - leftCount = left.Count; - } if (right != null) - { - rightHeight = right.Height; - rightCount = right.Count; - } - _height = Math.Max(leftHeight, rightHeight) + 1; - _count = leftCount + rightCount + 1; - } - - public override string ToString() - { - var sb = new StringBuilder(); - sb.Append('<').Append(_key).Append(", ").Append(_value).Append('>'); - if (_left != null) sb.Append(" L=<").Append(_left.Key).Append('>'); - if (_right != null) sb.Append(" R=<").Append(_right.Key).Append('>'); - return sb.ToString(); - } - } - - protected bool TryRemove(TKey key, out Node newNode) - { - if (_node == null) - { - newNode = null; - return false; - } - return TryRemove(key, _node, out newNode); - } - - private bool TryRemove(TKey key, Node node, out Node newNode) - { - Node result; - int compare = key.CompareTo(node.Key); - var left = node.Left; - var right = node.Right; - if (compare == 0) - { - var rightIsEmpty = right == null; - if (rightIsEmpty) - { - newNode = left; //Note, if node is a leaf, Left will be null too. - return true; - } - var leftIsEmpty = left == null; - - if (leftIsEmpty) - { - newNode = right; - return true; - } - // We have two children. Remove the next-highest node and replace - // this node with it. - var successor = right; - while (successor.Left != null) - { - successor = successor.Left; - } - Node newRight; - TryRemove(successor.Key, right, out newRight); //right is always!=null - result = new Node(successor.Key, successor.Value, left, newRight); - } - else - { - if (compare < 0) - { - Node newLeft = null; - var wasRemovedFromLeft = false; - if (left != null) - { - wasRemovedFromLeft = TryRemove(key, left, out newLeft); - } - if (!wasRemovedFromLeft) - { - newNode = null; - return false; - } - result = new Node(node.Key, node.Value, newLeft, right); - } - else - { - Node newRight = null; - var wasRemovedFromRight = false; - if (right != null) - { - wasRemovedFromRight = TryRemove(key, right, out newRight); - } - if (!wasRemovedFromRight) - { - newNode = null; - return false; - } - result = new Node(node.Key, node.Value, left, newRight); - } - } - newNode = MakeBalanced(result); - return true; - } - - private Node MakeBalanced(Node tree) - { - Node result; - if (IsRightHeavyAndUnbalanced(tree)) - { - result = IsLeftHeavy(tree.Right) ? DoubleLeftRotation(tree) : RotateLeft(tree); - } - else if (IsLeftHeavyAndUnbalanced(tree)) - { - result = IsRightHeavy(tree.Left) ? DoubleRightRotation(tree) : RotateRight(tree); - } - else - result = tree; - return result; - } - - private bool IsRightHeavyAndUnbalanced(Node tree) { return Balance(tree) >= 2; } - private bool IsLeftHeavyAndUnbalanced(Node tree) { return Balance(tree) <= -2; } - private bool IsRightHeavy(Node tree) { return Balance(tree) >= 1; } - private bool IsLeftHeavy(Node tree) { return Balance(tree) <= -1; } - - private int Balance(Node tree) - { - if (tree == null) return 0; - var right = tree.Right; - var rightHeight = right == null ? 0 : right.Height; - var left = tree.Left; - var leftHeight = left == null ? 0 : left.Height; - return rightHeight - leftHeight; - } - } -} - diff --git a/src/core/Akka/Util/Internal/Collections/ImmutableAvlTreeMap.cs b/src/core/Akka/Util/Internal/Collections/ImmutableAvlTreeMap.cs deleted file mode 100644 index bcdcc955449..00000000000 --- a/src/core/Akka/Util/Internal/Collections/ImmutableAvlTreeMap.cs +++ /dev/null @@ -1,104 +0,0 @@ -//----------------------------------------------------------------------- -// -// Copyright (C) 2009-2016 Typesafe Inc. -// Copyright (C) 2013-2016 Akka.NET project -// -//----------------------------------------------------------------------- - -using System; - -namespace Akka.Util.Internal.Collections -{ - public sealed class ImmutableTreeMap : ImmutableAvlTreeBase, IImmutableMap where TKey : IComparable - { - public static readonly ImmutableTreeMap Empty = new ImmutableTreeMap(); - - private ImmutableTreeMap(){} - - private ImmutableTreeMap(ImmutableAvlTreeBase.Node node) : base(node) - { - //Intentionally left blank - } - - bool IImmutableMap.TryAdd(TKey key, TValue value, out IImmutableMap newTreeMap) - { - ImmutableTreeMap newMap; - var result=TryAdd(key, value, out newMap); - newTreeMap = newMap; - return result; - } - - IImmutableMap IImmutableMap.Add(TKey key, TValue value) - { - return Add(key, value); - } - - public bool TryAdd(TKey key, TValue value, out ImmutableTreeMap newTreeMap) - { - Node newNode; - var couldAdd = TryAdd(key, value, out newNode, AddOperation.AddOnlyUnique); - if(!couldAdd) - { - newTreeMap = this; - return false; - } - newTreeMap = new ImmutableTreeMap(newNode); - return true; - } - - public ImmutableTreeMap Add(TKey key, TValue value) - { - ImmutableTreeMap newTree; - var couldAdd = TryAdd(key, value, out newTree); - if(!couldAdd) throw new InvalidOperationException(string.Format("Duplicate keys are not allowed. The tree already contains the key \"{0}\".", key)); - return newTree; - } - - public ImmutableTreeMap AddOrUpdate(TKey key, TValue value) - { - Node newNode; - TryAdd(key, value, out newNode, AddOperation.AddOrUpdate); - return new ImmutableTreeMap(newNode); - } - - - IImmutableMap IImmutableMap.AddOrUpdate(TKey key, TValue value) - { - return AddOrUpdate(key, value); - } - - - - IImmutableMap IImmutableMap.Remove(TKey key) - { - return Remove(key); - } - - bool IImmutableMap.TryRemove(TKey key, out IImmutableMap newMap) - { - ImmutableTreeMap newTreeMap; - var result = TryRemove(key, out newTreeMap); - newMap = newTreeMap; - return result; - } - - public ImmutableTreeMap Remove(TKey key) - { - ImmutableTreeMap newMap; - return TryRemove(key, out newMap) ? newMap : this; - } - - public bool TryRemove(TKey key, out ImmutableTreeMap newMap) - { - Node newNode; - if(TryRemove(key, out newNode)) - { - newMap=newNode==null ? Empty : new ImmutableTreeMap(newNode); - return true; - } - newMap = this; - return false; - } - } -} - diff --git a/src/core/Akka/Util/Internal/Collections/ImmutableTreeSet.cs b/src/core/Akka/Util/Internal/Collections/ImmutableTreeSet.cs deleted file mode 100644 index 0bf5626088e..00000000000 --- a/src/core/Akka/Util/Internal/Collections/ImmutableTreeSet.cs +++ /dev/null @@ -1,128 +0,0 @@ -//----------------------------------------------------------------------- -// -// Copyright (C) 2009-2016 Typesafe Inc. -// Copyright (C) 2013-2016 Akka.NET project -// -//----------------------------------------------------------------------- - -using System; -using System.Collections.Generic; -using System.Linq; - -namespace Akka.Util.Internal.Collections -{ - public class ImmutableTreeSet : ImmutableAvlTreeBase, IImmutableSet where TValue : IComparable - { - public static readonly ImmutableTreeSet Empty = new ImmutableTreeSet(); - - private ImmutableTreeSet(){} - - private ImmutableTreeSet(ImmutableAvlTreeBase.Node node) : base(node) - { - //Intentionally left blank - } - - bool IImmutableSet.TryAdd(TValue value, out IImmutableSet newSet) - { - ImmutableTreeSet newTreeSet; - var result = TryAdd(value, out newTreeSet); - newSet = newTreeSet; - return result; - } - - public bool TryAdd(TValue value, out ImmutableTreeSet newTreeMap) - { - Node newNode; - var couldAdd = TryAdd(value, value, out newNode, AddOperation.AddOnlyUnique); - if (!couldAdd) - { - newTreeMap = this; - return false; - } - newTreeMap = new ImmutableTreeSet(newNode); - return true; - } - - - IImmutableSet IImmutableSet.Add(TValue value) - { - return Add(value); - } - - public ImmutableTreeSet Add(TValue value) - { - ImmutableTreeSet newTree; - TryAdd(value, out newTree); - return newTree; - } - - public ImmutableTreeSet AddOrUpdate(TValue value) - { - Node newNode; - TryAdd(value, value, out newNode, AddOperation.AddOrUpdate); - var newTreeMap = new ImmutableTreeSet(newNode); - return newTreeMap; - } - - IImmutableSet IImmutableSet.Remove(TValue value) - { - return Remove(value); - } - - bool IImmutableSet.TryRemove(TValue value, out IImmutableSet newMap) - { - ImmutableTreeSet newTreeMap; - var result = TryRemove(value, out newTreeMap); - newMap = newTreeMap; - return result; - } - - public ImmutableTreeSet Remove(TValue value) - { - ImmutableTreeSet newMap; - return TryRemove(value, out newMap) ? newMap : this; - } - - IImmutableSet IImmutableSet.Remove(IEnumerable values) - { - return Remove(values); - } - - public ImmutableTreeSet Remove(IEnumerable values) - { - return values.Aggregate(this, (current, value) => current.Remove(value)); - } - - public bool TryRemove(TValue value, out ImmutableTreeSet newMap) - { - Node newNode; - if (TryRemove(value, out newNode)) - { - newMap = newNode==null ? Empty : new ImmutableTreeSet(newNode); - return true; - } - newMap = this; - return false; - } - - - IEnumerator IEnumerable.GetEnumerator() - { - return AllValuesMinToMax.GetEnumerator(); - } - - IEnumerable IImmutableSet.AllMinToMax { get { return base.AllValuesMinToMax; } } - IEnumerable IImmutableSet.AllMaxToMin { get { return base.AllValuesMaxToMin; } } - - public static ImmutableTreeSet Create(TValue value,params TValue[] values) - { - var tree = Empty.Add(value); - return values.Aggregate(tree, (current, v) => current.Add(v)); - } - public static ImmutableTreeSet Create(IEnumerable values) - { - return values.Aggregate(Empty, (current, v) => current.Add(v)); - } - } -} - diff --git a/src/core/Akka/packages.config b/src/core/Akka/packages.config index 505e58836ba..791fde074d2 100644 --- a/src/core/Akka/packages.config +++ b/src/core/Akka/packages.config @@ -1,4 +1,5 @@  + \ No newline at end of file diff --git a/src/examples/Cluster/ClusterSharding/ClusterSharding.Node/ClusterSharding.Node.csproj b/src/examples/Cluster/ClusterSharding/ClusterSharding.Node/ClusterSharding.Node.csproj index b25abd187a3..efb696a906b 100644 --- a/src/examples/Cluster/ClusterSharding/ClusterSharding.Node/ClusterSharding.Node.csproj +++ b/src/examples/Cluster/ClusterSharding/ClusterSharding.Node/ClusterSharding.Node.csproj @@ -51,8 +51,8 @@ True - - ..\..\..\..\packages\System.Collections.Immutable.1.1.37\lib\dotnet\System.Collections.Immutable.dll + + ..\..\..\..\packages\System.Collections.Immutable.1.1.36\lib\portable-net45+win8+wp8+wpa81\System.Collections.Immutable.dll True diff --git a/src/examples/Cluster/ClusterSharding/ClusterSharding.Node/packages.config b/src/examples/Cluster/ClusterSharding/ClusterSharding.Node/packages.config index 3fc2555c509..f06809f7d12 100644 --- a/src/examples/Cluster/ClusterSharding/ClusterSharding.Node/packages.config +++ b/src/examples/Cluster/ClusterSharding/ClusterSharding.Node/packages.config @@ -4,7 +4,7 @@ - + diff --git a/src/examples/Cluster/ClusterTools/ClusterToolsExample.Node/ClusterToolsExample.Node.csproj b/src/examples/Cluster/ClusterTools/ClusterToolsExample.Node/ClusterToolsExample.Node.csproj index a93f3d2cb54..ccf34083c5f 100644 --- a/src/examples/Cluster/ClusterTools/ClusterToolsExample.Node/ClusterToolsExample.Node.csproj +++ b/src/examples/Cluster/ClusterTools/ClusterToolsExample.Node/ClusterToolsExample.Node.csproj @@ -49,8 +49,8 @@ True - - ..\..\..\..\packages\System.Collections.Immutable.1.1.37\lib\dotnet\System.Collections.Immutable.dll + + ..\..\..\..\packages\System.Collections.Immutable.1.1.36\lib\portable-net45+win8+wp8+wpa81\System.Collections.Immutable.dll True diff --git a/src/examples/Cluster/ClusterTools/ClusterToolsExample.Node/packages.config b/src/examples/Cluster/ClusterTools/ClusterToolsExample.Node/packages.config index 092ab5f1865..a06cffa6d41 100644 --- a/src/examples/Cluster/ClusterTools/ClusterToolsExample.Node/packages.config +++ b/src/examples/Cluster/ClusterTools/ClusterToolsExample.Node/packages.config @@ -4,7 +4,7 @@ - + diff --git a/src/examples/Cluster/ClusterTools/ClusterToolsExample.Seed/ClusterToolsExample.Seed.csproj b/src/examples/Cluster/ClusterTools/ClusterToolsExample.Seed/ClusterToolsExample.Seed.csproj index e36ce9c9bcc..f92346ba982 100644 --- a/src/examples/Cluster/ClusterTools/ClusterToolsExample.Seed/ClusterToolsExample.Seed.csproj +++ b/src/examples/Cluster/ClusterTools/ClusterToolsExample.Seed/ClusterToolsExample.Seed.csproj @@ -49,8 +49,8 @@ True - - ..\..\..\..\packages\System.Collections.Immutable.1.1.37\lib\dotnet\System.Collections.Immutable.dll + + ..\..\..\..\packages\System.Collections.Immutable.1.1.36\lib\portable-net45+win8+wp8+wpa81\System.Collections.Immutable.dll True diff --git a/src/examples/Cluster/ClusterTools/ClusterToolsExample.Seed/packages.config b/src/examples/Cluster/ClusterTools/ClusterToolsExample.Seed/packages.config index 092ab5f1865..a06cffa6d41 100644 --- a/src/examples/Cluster/ClusterTools/ClusterToolsExample.Seed/packages.config +++ b/src/examples/Cluster/ClusterTools/ClusterToolsExample.Seed/packages.config @@ -4,7 +4,7 @@ - + diff --git a/src/examples/Cluster/ClusterTools/ClusterToolsExample.Shared/ClusterToolsExample.Shared.csproj b/src/examples/Cluster/ClusterTools/ClusterToolsExample.Shared/ClusterToolsExample.Shared.csproj index ccfae8efe43..6303a2e691b 100644 --- a/src/examples/Cluster/ClusterTools/ClusterToolsExample.Shared/ClusterToolsExample.Shared.csproj +++ b/src/examples/Cluster/ClusterTools/ClusterToolsExample.Shared/ClusterToolsExample.Shared.csproj @@ -47,8 +47,8 @@ True - - ..\..\..\..\packages\System.Collections.Immutable.1.1.37\lib\dotnet\System.Collections.Immutable.dll + + ..\..\..\..\packages\System.Collections.Immutable.1.1.36\lib\portable-net45+win8+wp8+wpa81\System.Collections.Immutable.dll True diff --git a/src/examples/Cluster/ClusterTools/ClusterToolsExample.Shared/packages.config b/src/examples/Cluster/ClusterTools/ClusterToolsExample.Shared/packages.config index 092ab5f1865..a06cffa6d41 100644 --- a/src/examples/Cluster/ClusterTools/ClusterToolsExample.Shared/packages.config +++ b/src/examples/Cluster/ClusterTools/ClusterToolsExample.Shared/packages.config @@ -4,7 +4,7 @@ - + diff --git a/src/examples/Cluster/Roles/Samples.Cluster.Transformation/Samples.Cluster.Transformation.csproj b/src/examples/Cluster/Roles/Samples.Cluster.Transformation/Samples.Cluster.Transformation.csproj index 286cd23f4a4..214afa8be72 100644 --- a/src/examples/Cluster/Roles/Samples.Cluster.Transformation/Samples.Cluster.Transformation.csproj +++ b/src/examples/Cluster/Roles/Samples.Cluster.Transformation/Samples.Cluster.Transformation.csproj @@ -35,8 +35,8 @@ - - ..\..\..\..\packages\System.Collections.Immutable.1.1.37\lib\portable-net45+win8+wp8+wpa81\System.Collections.Immutable.dll + + ..\..\..\..\packages\System.Collections.Immutable.1.1.36\lib\portable-net45+win8+wp8+wpa81\System.Collections.Immutable.dll True diff --git a/src/examples/Cluster/Roles/Samples.Cluster.Transformation/packages.config b/src/examples/Cluster/Roles/Samples.Cluster.Transformation/packages.config index 8a2bcdbc2dd..835f33a705d 100644 --- a/src/examples/Cluster/Roles/Samples.Cluster.Transformation/packages.config +++ b/src/examples/Cluster/Roles/Samples.Cluster.Transformation/packages.config @@ -1,4 +1,4 @@  - + \ No newline at end of file diff --git a/src/examples/Cluster/Routing/Samples.Cluster.ConsistentHashRouting/Samples.Cluster.ConsistentHashRouting.csproj b/src/examples/Cluster/Routing/Samples.Cluster.ConsistentHashRouting/Samples.Cluster.ConsistentHashRouting.csproj index 4314cc9a1fa..0e435945d7f 100644 --- a/src/examples/Cluster/Routing/Samples.Cluster.ConsistentHashRouting/Samples.Cluster.ConsistentHashRouting.csproj +++ b/src/examples/Cluster/Routing/Samples.Cluster.ConsistentHashRouting/Samples.Cluster.ConsistentHashRouting.csproj @@ -35,8 +35,8 @@ - - ..\..\..\..\packages\System.Collections.Immutable.1.1.37\lib\portable-net45+win8+wp8+wpa81\System.Collections.Immutable.dll + + ..\..\..\..\packages\System.Collections.Immutable.1.1.36\lib\portable-net45+win8+wp8+wpa81\System.Collections.Immutable.dll True diff --git a/src/examples/Cluster/Routing/Samples.Cluster.ConsistentHashRouting/packages.config b/src/examples/Cluster/Routing/Samples.Cluster.ConsistentHashRouting/packages.config index 8a2bcdbc2dd..835f33a705d 100644 --- a/src/examples/Cluster/Routing/Samples.Cluster.ConsistentHashRouting/packages.config +++ b/src/examples/Cluster/Routing/Samples.Cluster.ConsistentHashRouting/packages.config @@ -1,4 +1,4 @@  - + \ No newline at end of file diff --git a/src/examples/Cluster/Samples.Cluster.Simple/Samples.Cluster.Simple.csproj b/src/examples/Cluster/Samples.Cluster.Simple/Samples.Cluster.Simple.csproj index 1b142a16c8e..2c2a8b041f0 100644 --- a/src/examples/Cluster/Samples.Cluster.Simple/Samples.Cluster.Simple.csproj +++ b/src/examples/Cluster/Samples.Cluster.Simple/Samples.Cluster.Simple.csproj @@ -35,8 +35,8 @@ - - ..\..\..\packages\System.Collections.Immutable.1.1.37\lib\portable-net45+win8+wp8+wpa81\System.Collections.Immutable.dll + + ..\..\..\packages\System.Collections.Immutable.1.1.36\lib\portable-net45+win8+wp8+wpa81\System.Collections.Immutable.dll True diff --git a/src/examples/Cluster/Samples.Cluster.Simple/packages.config b/src/examples/Cluster/Samples.Cluster.Simple/packages.config index 8a2bcdbc2dd..835f33a705d 100644 --- a/src/examples/Cluster/Samples.Cluster.Simple/packages.config +++ b/src/examples/Cluster/Samples.Cluster.Simple/packages.config @@ -1,4 +1,4 @@  - + \ No newline at end of file diff --git a/src/examples/Stocks/SymbolLookup/SymbolLookup.csproj b/src/examples/Stocks/SymbolLookup/SymbolLookup.csproj index 61da7d29b32..e05c0a5f49c 100644 --- a/src/examples/Stocks/SymbolLookup/SymbolLookup.csproj +++ b/src/examples/Stocks/SymbolLookup/SymbolLookup.csproj @@ -66,8 +66,8 @@ True - - ..\..\..\packages\System.Collections.Immutable.1.1.37\lib\portable-net45+win8+wp8+wpa81\System.Collections.Immutable.dll + + ..\..\..\packages\System.Collections.Immutable.1.1.36\lib\portable-net45+win8+wp8+wpa81\System.Collections.Immutable.dll True diff --git a/src/examples/Stocks/SymbolLookup/packages.config b/src/examples/Stocks/SymbolLookup/packages.config index 6aa2a478aed..ca8f7380506 100644 --- a/src/examples/Stocks/SymbolLookup/packages.config +++ b/src/examples/Stocks/SymbolLookup/packages.config @@ -2,5 +2,5 @@ - + \ No newline at end of file