refactor: Renaming OrderedDictionary to SortedDictionary for consistency with .Net

This commit is contained in:
Chris Cameron
2021-03-29 16:23:29 -04:00
parent 370cadbaeb
commit a7ab2ab3fe
4 changed files with 14 additions and 14 deletions

View File

@@ -5,14 +5,14 @@ using NUnit.Framework;
namespace ICD.Common.Utils.Tests.Collections namespace ICD.Common.Utils.Tests.Collections
{ {
[TestFixture] [TestFixture]
public sealed class IcdOrderedDictionaryTest public sealed class IcdSortedDictionaryTest
{ {
#region Properties #region Properties
[Test] [Test]
public void CountTest() public void CountTest()
{ {
IcdOrderedDictionary<int, int> dict = new IcdOrderedDictionary<int, int> IcdSortedDictionary<int, int> dict = new IcdSortedDictionary<int, int>
{ {
{0, 0}, {0, 0},
{1, 10}, {1, 10},
@@ -25,7 +25,7 @@ namespace ICD.Common.Utils.Tests.Collections
[Test] [Test]
public void IsReadOnlyTest() public void IsReadOnlyTest()
{ {
IcdOrderedDictionary<int, int> dict = new IcdOrderedDictionary<int, int>(); IcdSortedDictionary<int, int> dict = new IcdSortedDictionary<int, int>();
Assert.IsFalse(dict.IsReadOnly); Assert.IsFalse(dict.IsReadOnly);
} }
@@ -33,7 +33,7 @@ namespace ICD.Common.Utils.Tests.Collections
[Test] [Test]
public void KeysTest() public void KeysTest()
{ {
IcdOrderedDictionary<int, int> dict = new IcdOrderedDictionary<int, int> IcdSortedDictionary<int, int> dict = new IcdSortedDictionary<int, int>
{ {
{0, 0}, {0, 0},
{1, 10}, {1, 10},
@@ -51,7 +51,7 @@ namespace ICD.Common.Utils.Tests.Collections
[Test] [Test]
public void ValuesTest() public void ValuesTest()
{ {
IcdOrderedDictionary<int, int> dict = new IcdOrderedDictionary<int, int> IcdSortedDictionary<int, int> dict = new IcdSortedDictionary<int, int>
{ {
{0, 0}, {0, 0},
{1, 10}, {1, 10},
@@ -70,7 +70,7 @@ namespace ICD.Common.Utils.Tests.Collections
public void IndexerTest() public void IndexerTest()
{ {
// ReSharper disable UseObjectOrCollectionInitializer // ReSharper disable UseObjectOrCollectionInitializer
IcdOrderedDictionary<int, int> dict = new IcdOrderedDictionary<int, int>(); IcdSortedDictionary<int, int> dict = new IcdSortedDictionary<int, int>();
// ReSharper restore UseObjectOrCollectionInitializer // ReSharper restore UseObjectOrCollectionInitializer
dict[0] = 0; dict[0] = 0;

View File

@@ -13,7 +13,7 @@ namespace ICD.Common.Utils.Collections
#if !SIMPLSHARP #if !SIMPLSHARP
[DebuggerDisplay("Count = {Count}")] [DebuggerDisplay("Count = {Count}")]
#endif #endif
public sealed class IcdOrderedDictionary<TKey, TValue> : IDictionary<TKey, TValue> public sealed class IcdSortedDictionary<TKey, TValue> : IDictionary<TKey, TValue>
{ {
private readonly List<TKey> m_OrderedKeys; private readonly List<TKey> m_OrderedKeys;
private readonly List<TValue> m_ValuesOrderedByKey; private readonly List<TValue> m_ValuesOrderedByKey;
@@ -52,7 +52,7 @@ namespace ICD.Common.Utils.Collections
/// <summary> /// <summary>
/// Constructor. /// Constructor.
/// </summary> /// </summary>
public IcdOrderedDictionary() public IcdSortedDictionary()
: this(Comparer<TKey>.Default) : this(Comparer<TKey>.Default)
{ {
} }
@@ -61,7 +61,7 @@ namespace ICD.Common.Utils.Collections
/// Constructor. /// Constructor.
/// </summary> /// </summary>
/// <param name="comparer"></param> /// <param name="comparer"></param>
public IcdOrderedDictionary([NotNull] IComparer<TKey> comparer) public IcdSortedDictionary([NotNull] IComparer<TKey> comparer)
: this(comparer, EqualityComparer<TKey>.Default) : this(comparer, EqualityComparer<TKey>.Default)
{ {
} }
@@ -71,7 +71,7 @@ namespace ICD.Common.Utils.Collections
/// </summary> /// </summary>
/// <param name="comparer"></param> /// <param name="comparer"></param>
/// <param name="equalityComparer"></param> /// <param name="equalityComparer"></param>
public IcdOrderedDictionary([NotNull] IComparer<TKey> comparer, [NotNull] IEqualityComparer<TKey> equalityComparer) public IcdSortedDictionary([NotNull] IComparer<TKey> comparer, [NotNull] IEqualityComparer<TKey> equalityComparer)
{ {
if (comparer == null) if (comparer == null)
throw new ArgumentNullException("comparer"); throw new ArgumentNullException("comparer");
@@ -89,7 +89,7 @@ namespace ICD.Common.Utils.Collections
/// Constructor. /// Constructor.
/// </summary> /// </summary>
/// <param name="dictionary"></param> /// <param name="dictionary"></param>
public IcdOrderedDictionary([NotNull] IEnumerable<KeyValuePair<TKey, TValue>> dictionary) public IcdSortedDictionary([NotNull] IEnumerable<KeyValuePair<TKey, TValue>> dictionary)
: this() : this()
{ {
if (dictionary == null) if (dictionary == null)

View File

@@ -18,7 +18,7 @@ namespace ICD.Common.Utils.Collections
#endif #endif
public sealed class PriorityQueue<T> : IEnumerable<T>, ICollection public sealed class PriorityQueue<T> : IEnumerable<T>, ICollection
{ {
private readonly IcdOrderedDictionary<int, List<T>> m_PriorityToQueue; private readonly IcdSortedDictionary<int, List<T>> m_PriorityToQueue;
private int m_Count; private int m_Count;
#region Properties #region Properties
@@ -46,7 +46,7 @@ namespace ICD.Common.Utils.Collections
/// </summary> /// </summary>
public PriorityQueue() public PriorityQueue()
{ {
m_PriorityToQueue = new IcdOrderedDictionary<int, List<T>>(); m_PriorityToQueue = new IcdSortedDictionary<int, List<T>>();
} }
#region Methods #region Methods

View File

@@ -80,7 +80,7 @@
<Compile Include="Attributes\IIcdAttribute.cs" /> <Compile Include="Attributes\IIcdAttribute.cs" />
<Compile Include="Attributes\RangeAttribute.cs" /> <Compile Include="Attributes\RangeAttribute.cs" />
<Compile Include="Collections\BiDictionary.cs" /> <Compile Include="Collections\BiDictionary.cs" />
<Compile Include="Collections\IcdOrderedDictionary.cs" /> <Compile Include="Collections\IcdSortedDictionary.cs" />
<Compile Include="Collections\INotifyCollectionChanged.cs" /> <Compile Include="Collections\INotifyCollectionChanged.cs" />
<Compile Include="Collections\PriorityQueue.cs" /> <Compile Include="Collections\PriorityQueue.cs" />
<Compile Include="Collections\RateLimitedEventQueue.cs" /> <Compile Include="Collections\RateLimitedEventQueue.cs" />