Skip to content

Commit 72dc01d

Browse files
author
LoneWandererProductions
committed
Do some cleanup
1 parent a4ffddf commit 72dc01d

8 files changed

Lines changed: 42 additions & 34 deletions

File tree

ExtendedSystemObjects/CategorizedDictionary.cs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
using System.Collections.Generic;
1717
using System.Linq;
1818
using System.Threading;
19+
using ExtendedSystemObjects.Helper;
1920

2021
namespace ExtendedSystemObjects
2122
{
@@ -381,17 +382,17 @@ public static bool AreEqual<TKey, TValue>(CategorizedDictionary<TKey, TValue> ex
381382
{
382383
if (expected == null || actual == null)
383384
{
384-
message = ExtendedSystemObjectsResources.NullDictionaries;
385+
message = SharedResources.NullDictionaries;
385386
return false;
386387
}
387388

388389
if (expected.Equals(actual))
389390
{
390-
message = ExtendedSystemObjectsResources.DictionariesEqual;
391+
message = SharedResources.DictionariesEqual;
391392
return true;
392393
}
393394

394-
message = ExtendedSystemObjectsResources.DictionaryComparisonFailed;
395+
message = SharedResources.DictionaryComparisonFailed;
395396
return false;
396397
}
397398

@@ -406,7 +407,7 @@ public override string ToString()
406407
try
407408
{
408409
var entries = _data.Select(entry =>
409-
string.Format(ExtendedSystemObjectsResources.KeyCategoryValueFormat, entry.Key,
410+
string.Format(SharedResources.KeyCategoryValueFormat, entry.Key,
410411
entry.Value.Category,
411412
entry.Value.Value));
412413

@@ -483,7 +484,7 @@ private void AddInternal(string category, TK key, TV value)
483484
{
484485
if (_data.ContainsKey(key))
485486
{
486-
throw new ArgumentException($"{ExtendedSystemObjectsResources.ErrorKeyExists}{key}");
487+
throw new ArgumentException($"{SharedResources.ErrorKeyExists}{key}");
487488
}
488489

489490
_data[key] = (category, value);

ExtendedSystemObjects/ExtendedDictionary.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -130,13 +130,13 @@ public static void AddDistinctKeyValue<TKey, TValue>(this Dictionary<TKey, TValu
130130
{
131131
if (dic.ContainsKey(key))
132132
{
133-
throw new ArgumentException(string.Concat(ExtendedSystemObjectsResources.ErrorKeyExists,
133+
throw new ArgumentException(string.Concat(SharedResources.ErrorKeyExists,
134134
nameof(value)));
135135
}
136136

137137
if (dic.ContainsValue(value))
138138
{
139-
throw new ArgumentException(string.Concat(ExtendedSystemObjectsResources.ErrorValueExists,
139+
throw new ArgumentException(string.Concat(SharedResources.ErrorValueExists,
140140
nameof(value)));
141141
}
142142

@@ -235,7 +235,7 @@ public static TKey GetFirstKeyByValue<TKey, TValue>(this IDictionary<TKey, TValu
235235
return pair.Key;
236236
}
237237

238-
throw new ValueNotFoundException(ExtendedSystemObjectsResources.ErrorValueNotFound);
238+
throw new ValueNotFoundException(SharedResources.ErrorValueNotFound);
239239
}
240240

241241
/// <summary>
@@ -253,7 +253,7 @@ public static List<TKey> GetKeysByValue<TKey, TValue>(this IDictionary<TKey, TVa
253253

254254
if (collection.Count == 0)
255255
{
256-
throw new ValueNotFoundException(ExtendedSystemObjectsResources.ErrorValueNotFound);
256+
throw new ValueNotFoundException(SharedResources.ErrorValueNotFound);
257257
}
258258

259259
return collection;
@@ -277,7 +277,7 @@ public static Dictionary<TKey, TValue> GetDictionaryByValues<TKey, TValue>(this
277277

278278
if (collection.Count == 0)
279279
{
280-
throw new ValueNotFoundException(ExtendedSystemObjectsResources.ErrorNoValueFound);
280+
throw new ValueNotFoundException(SharedResources.ErrorNoValueFound);
281281
}
282282

283283
return collection;

ExtendedSystemObjects/Helper/SharedResources.cs

Lines changed: 0 additions & 14 deletions
This file was deleted.

ExtendedSystemObjects/ExtendedSystemObjectsRessources.cs renamed to ExtendedSystemObjects/Helper/SharedRessources.cs

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
/*
22
* COPYRIGHT: See COPYING in the top level directory
3-
* PROJECT: ExtendedSystemObjects
4-
* FILE: ExtendedSystemObjects/ExtendedSystemObjectsResources.cs
5-
* PURPOSE: Generic System Functions for ListsCollection of Strings
3+
* PROJECT: ExtendedSystemObjects.Helper
4+
* FILE: ExtendedSystemObjects.Helper/SharedResources.cs
5+
* PURPOSE: Generic System Functions for ListsCollection of Strings and constants.
66
* PROGRAMER: Peter Geinitz (Wayfarer)
77
*/
88

9-
namespace ExtendedSystemObjects
9+
namespace ExtendedSystemObjects.Helper
1010
{
1111
/// <summary>
1212
/// The extended system objects Resources class.
1313
/// </summary>
14-
internal static class ExtendedSystemObjectsResources
14+
internal static class SharedResources
1515
{
1616
/// <summary>
1717
/// Error value not found (const). "Value not found in the dictionary".
@@ -62,5 +62,14 @@ internal static class ExtendedSystemObjectsResources
6262
/// The key category value format (const). Value: "Key: {0}, Category: {1}, Value: {2}".
6363
/// </summary>
6464
internal const string KeyCategoryValueFormat = "Key: {0}, Category: {1}, Value: {2}";
65+
66+
/// <summary>
67+
/// The small primes
68+
/// </summary>
69+
internal static readonly int[] SmallPrimes =
70+
{
71+
2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101,
72+
103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199
73+
};
6574
}
6675
}

ExtendedSystemObjects/ImmutableLookupMap.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ public TValue Get(TKey key)
134134
}
135135
}
136136

137-
throw new KeyNotFoundException(ExtendedSystemObjectsResources.ErrorValueNotFound);
137+
throw new KeyNotFoundException(SharedResources.ErrorValueNotFound);
138138
}
139139

140140
/// <summary>

ExtendedSystemObjects/ImmutableLookupMapUnmanaged.cs

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,19 @@
1-
using System;
1+
/*
2+
* COPYRIGHT: See COPYING in the top level directory
3+
* PROJECT: ExtendedSystemObjects
4+
* FILE: ExtendedSystemObjects/ImmutableLookupMap.cs
5+
* PURPOSE: A high-performance, immutable lookup map that uses an array-based internal structure for fast key-value lookups. Tis one is for unmanaged only. It uses my UnmanagedArray.
6+
* PROGRAMER: Peter Geinitz (Wayfarer)
7+
*/
8+
9+
// ReSharper disable UnusedMember.Global
10+
// ReSharper disable MemberCanBeInternal
11+
12+
using System;
213
using System.Collections;
314
using System.Collections.Generic;
415
using System.Runtime.CompilerServices;
516
using ExtendedSystemObjects.Helper;
6-
using ExtendedSystemObjects.Interfaces;
717

818
namespace ExtendedSystemObjects
919
{

ExtendedSystemObjects/MultiArray.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
using System;
1515
using System.Text;
16+
using ExtendedSystemObjects.Helper;
1617

1718
namespace ExtendedSystemObjects
1819
{
@@ -85,7 +86,7 @@ public static unsafe string ToText<TValue>(this TValue[,] array) where TValue :
8586
}
8687
else
8788
{
88-
_ = str.Append(ExtendedSystemObjectsResources.Separator);
89+
_ = str.Append(SharedResources.Separator);
8990
}
9091
}
9192
}

ExtendedSystemObjects/Utility.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
using System.Diagnostics.CodeAnalysis;
1616
using System.Linq;
1717
using System.Runtime.CompilerServices;
18+
using ExtendedSystemObjects.Helper;
1819

1920
namespace ExtendedSystemObjects
2021
{
@@ -187,7 +188,7 @@ public static List<int> GetAvailableIndexes(List<int> lst, int count)
187188
if (count < 0)
188189
{
189190
throw new ArgumentOutOfRangeException(nameof(count),
190-
ExtendedSystemObjectsResources.ErrorValueNotAllowed);
191+
SharedResources.ErrorValueNotAllowed);
191192
}
192193

193194
var keys = new List<int>();

0 commit comments

Comments
 (0)