Skip to content

Commit 3474f14

Browse files
committed
Update
1 parent d1724b5 commit 3474f14

File tree

208 files changed

+2542
-1206
lines changed

Some content is hidden

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

208 files changed

+2542
-1206
lines changed

DataCommander.Foundation/Collections/BinarySearch.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,12 @@ public static int IndexOf(
2626
Contract.Requires<ArgumentOutOfRangeException>(minIndex <= maxIndex);
2727
Contract.Requires<ArgumentNullException>(compareTo != null);
2828

29-
int result = -1;
29+
var result = -1;
3030

3131
while (minIndex <= maxIndex)
3232
{
33-
int midIndex = minIndex + (maxIndex - minIndex)/2;
34-
int comparisonResult = compareTo(midIndex);
33+
var midIndex = minIndex + (maxIndex - minIndex)/2;
34+
var comparisonResult = compareTo(midIndex);
3535
if (comparisonResult == 0)
3636
{
3737
result = midIndex;
@@ -61,12 +61,12 @@ public static void Search(int minIndex, int maxIndex,
6161
Func<int, bool> lessThan,
6262
Func<int, bool> equals)
6363
{
64-
int currentMinIndex = minIndex;
65-
int currentMaxIndex = maxIndex;
64+
var currentMinIndex = minIndex;
65+
var currentMaxIndex = maxIndex;
6666

6767
while (currentMinIndex < currentMaxIndex)
6868
{
69-
int midIndex = currentMinIndex + (currentMaxIndex - currentMinIndex)/2;
69+
var midIndex = currentMinIndex + (currentMaxIndex - currentMinIndex)/2;
7070

7171
if (lessThan(midIndex))
7272
{

DataCommander.Foundation/Collections/BitVector64.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,13 @@ public bool this[int index]
3131
{
3232
get
3333
{
34-
UInt64 bit = 1UL << index;
34+
var bit = 1UL << index;
3535
return (this.Value & bit) == bit;
3636
}
3737

3838
set
3939
{
40-
UInt64 bit = 1UL << index;
40+
var bit = 1UL << index;
4141

4242
if (value)
4343
{
@@ -56,7 +56,7 @@ public bool this[int index]
5656
/// <returns></returns>
5757
public override string ToString()
5858
{
59-
string value = this.Value.ToString("X");
59+
var value = this.Value.ToString("X");
6060
value = value.PadLeft(16, '0');
6161
return value;
6262
}

DataCommander.Foundation/Collections/CircuralBuffer.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ public void SetCapacity(int capacity)
162162
}
163163
else
164164
{
165-
int headCount = this.array.Length - this.head;
165+
var headCount = this.array.Length - this.head;
166166
Array.Copy(this.array, this.head, target, 0, headCount);
167167
Array.Copy(this.array, 0, target, headCount, this.tail + 1);
168168
}
@@ -260,7 +260,7 @@ IEnumerator<T> IEnumerable<T>.GetEnumerator()
260260
{
261261
if (this.Count > 0)
262262
{
263-
int current = this.head;
263+
var current = this.head;
264264
while (true)
265265
{
266266
var item = this.array[current];

DataCommander.Foundation/Collections/DisposableCollection.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public class DisposableCollection<T> : Collection<T>, IDisposable where T : IDis
1616
/// </summary>
1717
public void Dispose()
1818
{
19-
foreach (T item in this)
19+
foreach (var item in this)
2020
{
2121
if (item != null)
2222
{

DataCommander.Foundation/Collections/DynamicArray.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ public void Add(T item)
8686

8787
if (this.Count == this.array.Length)
8888
{
89-
int newSize = this.Count == 0 ? 1 : 2*this.Count;
89+
var newSize = this.Count == 0 ? 1 : 2*this.Count;
9090

9191
if (newSize > this.maxSize)
9292
{
@@ -158,7 +158,7 @@ bool ICollection<T>.Remove(T item)
158158
/// <returns></returns>
159159
public IEnumerator<T> GetEnumerator()
160160
{
161-
for (int i = 0; i < this.Count; i++)
161+
for (var i = 0; i < this.Count; i++)
162162
{
163163
yield return this.array[i];
164164
}

DataCommander.Foundation/Collections/IndexableCollection/IndexCollection.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ public void CopyTo(ICollectionIndex<T>[] array, int arrayIndex)
8484
public bool Remove(ICollectionIndex<T> item)
8585
{
8686
bool succeeded;
87-
bool contains = this.dictionary.ContainsValue(item);
87+
var contains = this.dictionary.ContainsValue(item);
8888

8989
if (contains)
9090
{

DataCommander.Foundation/Collections/IndexableCollection/IndexableCollection-2.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public partial class IndexableCollection<T> : ICollection<T>
2323
/// <param name="item"></param>
2424
public void Add(T item)
2525
{
26-
foreach (ICollectionIndex<T> index in this.Indexes)
26+
foreach (var index in this.Indexes)
2727
{
2828
index.Add(item);
2929
}
@@ -34,7 +34,7 @@ public void Add(T item)
3434
/// </summary>
3535
public void Clear()
3636
{
37-
foreach (ICollectionIndex<T> index in this.Indexes)
37+
foreach (var index in this.Indexes)
3838
{
3939
index.Clear();
4040
}

DataCommander.Foundation/Collections/IndexableCollection/LinkedListIndex.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public LinkedListIndex(string name)
4141
/// <param name="item"></param>
4242
void ICollection<T>.Add( T item )
4343
{
44-
LinkedListNode<T> node = this.linkedList.AddLast(item);
44+
var node = this.linkedList.AddLast(item);
4545
}
4646

4747
/// <summary>

DataCommander.Foundation/Collections/IndexableCollection/NonUniqueIndex.cs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ public NonUniqueIndex(
102102
public bool TryGetFirstValue(TKey key, out T value)
103103
{
104104
ICollection<T> collection;
105-
bool contains = this.dictionary.TryGetValue(key, out collection);
105+
var contains = this.dictionary.TryGetValue(key, out collection);
106106

107107
if (contains)
108108
{
@@ -130,15 +130,15 @@ public bool TryGetFirstValue(TKey key, out T value)
130130
///
131131
/// </summary>
132132
/// <param name="item"></param>
133-
void ICollection<T>.Add(T item)
133+
public void Add(T item)
134134
{
135135
var response = this.getKey(item);
136136

137137
if (response.HasKey)
138138
{
139139
var key = response.Key;
140140
ICollection<T> collection;
141-
bool contains = this.dictionary.TryGetValue(key, out collection);
141+
var contains = this.dictionary.TryGetValue(key, out collection);
142142

143143
if (!contains)
144144
{
@@ -202,20 +202,20 @@ void ICollection<T>.CopyTo(T[] array, int arrayIndex)
202202
/// </summary>
203203
/// <param name="item"></param>
204204
/// <returns></returns>
205-
bool ICollection<T>.Remove(T item)
205+
public bool Remove(T item)
206206
{
207207
var response = this.getKey(item);
208-
bool removed = false;
208+
var removed = false;
209209

210210
if (response.HasKey)
211211
{
212212
var key = response.Key;
213213
ICollection<T> collection;
214-
bool contains = this.dictionary.TryGetValue(key, out collection);
214+
var contains = this.dictionary.TryGetValue(key, out collection);
215215

216216
if (contains)
217217
{
218-
bool succeeded = collection.Remove(item);
218+
var succeeded = collection.Remove(item);
219219
Contract.Assert(succeeded, "collection.Remove");
220220

221221
if (collection.Count == 0)
@@ -239,11 +239,11 @@ bool ICollection<T>.Remove(T item)
239239
///
240240
/// </summary>
241241
/// <returns></returns>
242-
IEnumerator<T> IEnumerable<T>.GetEnumerator()
242+
public IEnumerator<T> GetEnumerator()
243243
{
244-
foreach (ICollection<T> collection in this.dictionary.Values)
244+
foreach (var collection in this.dictionary.Values)
245245
{
246-
foreach (T item in collection)
246+
foreach (var item in collection)
247247
{
248248
yield return item;
249249
}

DataCommander.Foundation/Collections/IndexableCollection/SequenceIndex.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public SequenceIndex(
5050

5151
void ICollection<T>.Add(T item)
5252
{
53-
TKey key = this.getNextKey();
53+
var key = this.getNextKey();
5454
this.dictionary.Add(key, item);
5555
}
5656

@@ -79,8 +79,8 @@ void ICollection<T>.CopyTo(T[] array, int arrayIndex)
7979

8080
bool ICollection<T>.Remove(T item)
8181
{
82-
TKey key = this.getKey(item);
83-
bool removed = this.dictionary.Remove(key);
82+
var key = this.getKey(item);
83+
var removed = this.dictionary.Remove(key);
8484
return removed;
8585
}
8686

0 commit comments

Comments
 (0)