Skip to content

Commit c11a861

Browse files
committed
cleanup via resharper
1 parent c41d71f commit c11a861

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+494
-731
lines changed

Advanced.Algorithms.Tests/BitAlgorithms/GCD_Tests.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ public class GCD_Tests
1414
[TestMethod]
1515
public void GCD_Smoke_Test()
1616
{
17-
Assert.AreEqual(3, GCD.Find(-9, 3));
18-
Assert.AreEqual(15, GCD.Find(45, 30));
17+
Assert.AreEqual(3, Gcd.Find(-9, 3));
18+
Assert.AreEqual(15, Gcd.Find(45, 30));
1919

20-
Assert.AreEqual(1, GCD.Find(3, 5));
20+
Assert.AreEqual(1, Gcd.Find(3, 5));
2121

2222
}
2323
}

Advanced.Algorithms.Tests/DataStructures/Dictionary/Dictionary_Tests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ public class Dictionary_Tests
1414
[TestMethod]
1515
public void Dictionary_SeparateChaining_Test()
1616
{
17-
var Dictionary = new AsDictionary<int, int>(DictionaryType.SeparateChaining);
17+
var Dictionary = new Dictionary<int, int>(DictionaryType.SeparateChaining);
1818
int nodeCount = 1000 * 10;
1919
//insert test
2020

@@ -60,7 +60,7 @@ public void Dictionary_SeparateChaining_Test()
6060
[TestMethod]
6161
public void Dictionary_OpenAddressing_Test()
6262
{
63-
var Dictionary = new AsDictionary<int, int>(DictionaryType.OpenAddressing);
63+
var Dictionary = new Dictionary<int, int>(DictionaryType.OpenAddressing);
6464
int nodeCount = 1000 * 10;
6565
//insert test
6666

Advanced.Algorithms.Tests/DataStructures/Dictionary/TreeDictionary_Tests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ public class TreeDictionary_Tests
1414
[TestMethod]
1515
public void TreeDictionary_Test()
1616
{
17-
var Dictionary = new AsTreeDictionary<int, int>();
17+
var Dictionary = new TreeDictionary<int, int>();
1818

1919
int nodeCount = 1000;
2020
//insert test

Advanced.Algorithms.Tests/DataStructures/HashSet/HashSet_Tests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ public class HashSet_Tests
1414
[TestMethod]
1515
public void HashSet_SeparateChaining_Test()
1616
{
17-
var HashSet = new AsHashSet<int>(HashSetType.SeparateChaining);
17+
var HashSet = new HashSet<int>(HashSetType.SeparateChaining);
1818
int nodeCount = 1000 * 10;
1919
//insert test
2020

@@ -60,7 +60,7 @@ public void HashSet_SeparateChaining_Test()
6060
[TestMethod]
6161
public void HashSet_OpenAddressing_Test()
6262
{
63-
var HashSet = new AsHashSet<int>(HashSetType.OpenAddressing);
63+
var HashSet = new HashSet<int>(HashSetType.OpenAddressing);
6464
int nodeCount = 1000 * 10;
6565
//insert test
6666

Advanced.Algorithms.Tests/DataStructures/Queues/Queue_Tests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ public class Queue_Tests
1111
[TestMethod]
1212
public void ArrayQueue_Test()
1313
{
14-
var Queue = new AsQueue<string>();
14+
var Queue = new Queue<string>();
1515

1616
Queue.Enqueue("a");
1717
Queue.Enqueue("b");
@@ -39,7 +39,7 @@ public void ArrayQueue_Test()
3939
[TestMethod]
4040
public void LinkedListQueue_Test()
4141
{
42-
var Queue = new AsQueue<string>(QueueType.LinkedList);
42+
var Queue = new Queue<string>(QueueType.LinkedList);
4343

4444
Queue.Enqueue("a");
4545
Queue.Enqueue("b");

Advanced.Algorithms.Tests/DataStructures/Stack_Tests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ public class Stack_Tests
1010
[TestMethod]
1111
public void ArrayStack_Test()
1212
{
13-
var stack = new AsStack<string>();
13+
var stack = new Stack<string>();
1414

1515
stack.Push("a");
1616
stack.Push("b");
@@ -35,7 +35,7 @@ public void ArrayStack_Test()
3535
[TestMethod]
3636
public void LinkedListStack_Test()
3737
{
38-
var stack = new AsStack<string>(StackType.LinkedList);
38+
var stack = new Stack<string>(StackType.LinkedList);
3939

4040
stack.Push("a");
4141
stack.Push("b");

Advanced.Algorithms/BitAlgorithms/BaseConversion.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
using System;
2-
using System.Collections.Generic;
3-
using System.Linq;
42
using System.Text;
5-
using System.Threading.Tasks;
63

74
namespace Advanced.Algorithms.BitAlgorithms
85
{
@@ -14,6 +11,7 @@ public class BaseConversion
1411
/// <param name="srcNumber">input number in source base system</param>
1512
/// <param name="srcBaseChars">Should be in correct order => eg. 0123456789 for decimal</param>
1613
/// <param name="dstBaseChars">>Should be in correct order => eg. 01 for binary</param>
14+
/// <param name="precision">Precision.</param>
1715
/// <returns></returns>
1816
public static string Convert(string srcNumber,
1917
string srcBaseChars,

Advanced.Algorithms/BitAlgorithms/BitHacks.cs

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ public class BitHacks
1111
/// <summary>
1212
/// Checks if given number is even
1313
/// </summary>
14-
/// <param name="number"></param>
1514
/// <returns></returns>
1615
public static bool IsEven(int x)
1716
{
@@ -21,7 +20,6 @@ public static bool IsEven(int x)
2120
/// <summary>
2221
/// Checks if given number is a power of 2
2322
/// </summary>
24-
/// <param name="number"></param>
2523
/// <returns></returns>
2624
public static bool IsPowerOf2(int x)
2725
{
@@ -36,7 +34,7 @@ public static bool IsPowerOf2(int x)
3634
/// <returns></returns>
3735
public static bool HasOppositeSigns(int x, int y)
3836
{
39-
var mask = 1 << 31;
37+
const int mask = 1 << 31;
4038

4139
return ((x & mask) == 0 && (y & mask) != 0)
4240
|| ((x & mask) != 0 && (y & mask) == 0);
@@ -45,7 +43,6 @@ public static bool HasOppositeSigns(int x, int y)
4543
/// <summary>
4644
/// Checks if nth bit from right is set, with rightmost being 0th bit
4745
/// </summary>
48-
/// <param name="number"></param>
4946
/// <param name="n"></param>
5047
/// <returns></returns>
5148
public static bool IsSet(int x, int n)
@@ -57,7 +54,6 @@ public static bool IsSet(int x, int n)
5754
/// <summary>
5855
/// Sets nth bit from right, with rightmost being 0th bit
5956
/// </summary>
60-
/// <param name="number"></param>
6157
/// <param name="n"></param>
6258
/// <returns></returns>
6359
public static int SetBit(int x, int n)
@@ -70,7 +66,6 @@ public static int SetBit(int x, int n)
7066
/// <summary>
7167
/// Unsets nth bit from right, with rightmost being 0th bit
7268
/// </summary>
73-
/// <param name="number"></param>
7469
/// <param name="n"></param>
7570
/// <returns></returns>
7671
public static int UnsetBit(int x, int n)
@@ -82,7 +77,6 @@ public static int UnsetBit(int x, int n)
8277
/// <summary>
8378
/// Toggles nth bit from right, with rightmost being 0th bit
8479
/// </summary>
85-
/// <param name="number"></param>
8680
/// <param name="n"></param>
8781
/// <returns></returns>
8882
public static int ToggleBit(int x, int n)
@@ -93,7 +87,6 @@ public static int ToggleBit(int x, int n)
9387
/// <summary>
9488
/// Turns On first Unset bit from right, with rightmost being 0th bit
9589
/// </summary>
96-
/// <param name="number"></param>
9790
/// <returns></returns>
9891
public static int TurnOnBitAfterRightmostSetBit(int x)
9992
{
@@ -107,7 +100,6 @@ public static int TurnOnBitAfterRightmostSetBit(int x)
107100
/// <summary>
108101
/// Turns Off first set bit from right, with rightmost being 0th bit
109102
/// </summary>
110-
/// <param name="number"></param>
111103
/// <returns></returns>
112104
public static int TurnOffRightmostSetBit(int x)
113105
{
@@ -121,7 +113,6 @@ public static int TurnOffRightmostSetBit(int x)
121113
/// <summary>
122114
/// Gets the first right most sub bits starting with a set bit, with rightmost being 0th bit
123115
/// </summary>
124-
/// <param name="number"></param>
125116
/// <returns></returns>
126117
public static int GetRightmostSubBitsStartingWithASetBit(int x)
127118
{
@@ -136,7 +127,6 @@ public static int GetRightmostSubBitsStartingWithASetBit(int x)
136127
/// Gets the first right most sub bits starting with a Unset bit, with rightmost being 0th bit
137128
/// eg. 1011 => 0011
138129
/// </summary>
139-
/// <param name="number"></param>
140130
/// <returns></returns>
141131
public static int GetRightmostSubBitsStartingWithAnUnsetBit(int x)
142132
{
@@ -177,7 +167,6 @@ public static int GetRightmostSubBitsStartingWithAnUnsetBit(int x)
177167
/// <summary>
178168
/// Sets all the first right most sub bits starting with a set bit, with rightmost being 0th bit
179169
/// </summary>
180-
/// <param name="number"></param>
181170
/// <returns></returns>
182171
public static int RightPropogateRightmostSetBit(int x)
183172
{
@@ -191,7 +180,6 @@ public static int RightPropogateRightmostSetBit(int x)
191180
/// <summary>
192181
/// UnSets all the first right most sub bits starting with a unset bit, with rightmost being 0th bit
193182
/// </summary>
194-
/// <param name="number"></param>
195183
/// <returns></returns>
196184
public static int RightPropogateRightmostUnsetBit(int x)
197185
{
@@ -204,7 +192,6 @@ public static int RightPropogateRightmostUnsetBit(int x)
204192
/// <summary>
205193
/// Update the nth bit from right with given boolean value, with rightmost being 0th bit
206194
/// </summary>
207-
/// <param name="number"></param>
208195
/// <param name="n"></param>
209196
/// <param name="value"></param>
210197
/// <returns></returns>
@@ -213,13 +200,13 @@ public static int UpdateBitToValue(int x, int n, bool value)
213200
if (value)
214201
{
215202
//1011 (n=2) => 1111
216-
var mask = 1;
203+
const int mask = 1;
217204
return x | (mask << n);
218205
}
219206
else
220207
{
221208
//1111 (n=2) => 1011
222-
var mask = 1;
209+
const int mask = 1;
223210
return x & ~(mask << n);
224211
}
225212

@@ -232,7 +219,7 @@ public static int UpdateBitToValue(int x, int n, bool value)
232219
/// <returns></returns>
233220
public static int CountSetBits(int x)
234221
{
235-
int count = 0;
222+
var count = 0;
236223
while (x > 0)
237224
{
238225
//unset the LSB in each step
@@ -302,7 +289,6 @@ public static int CountTrailingZerosByBinarySearch(int x)
302289

303290
return count;
304291

305-
306292
}
307293

308294
}

Advanced.Algorithms/BitAlgorithms/CalcLogarithm.cs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,4 @@
1-
using System;
2-
using System.Collections.Generic;
3-
using System.Linq;
4-
using System.Text;
5-
using System.Threading.Tasks;
6-
7-
namespace Advanced.Algorithms.BitAlgorithms
1+
namespace Advanced.Algorithms.BitAlgorithms
82
{
93
public class CalcLogarithm
104
{

Advanced.Algorithms/BitAlgorithms/DivisionModulus.cs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
11
using System;
2-
using System.Collections.Generic;
3-
using System.Linq;
4-
using System.Text;
5-
using System.Threading.Tasks;
62

73
namespace Advanced.Algorithms.BitAlgorithms
84
{

0 commit comments

Comments
 (0)