Skip to content

Commit 8b7b161

Browse files
some smaller touchups
1 parent 59a63e6 commit 8b7b161

10 files changed

Lines changed: 47 additions & 16 deletions

File tree

CommonExtendedObjectsTests/ExtendedSystemObjects.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
using System.Diagnostics;
1616
using System.Linq;
1717
using ExtendedSystemObjects;
18+
using ExtendedSystemObjects.Interfaces;
1819
using Mathematics;
1920
using Microsoft.VisualStudio.TestTools.UnitTesting;
2021

CommonExtendedObjectsTests/IntArrayTests.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
using System;
1010
using System.Diagnostics;
1111
using ExtendedSystemObjects;
12+
using ExtendedSystemObjects.Interfaces;
1213
using Microsoft.VisualStudio.TestTools.UnitTesting;
1314

1415
namespace CommonExtendedObjectsTests

ExtendedSystemObjects/ExtendedDictionary.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,13 @@
77
*/
88

99
// ReSharper disable UnusedMethodReturnValue.Global
10+
// ReSharper disable MemberCanBeInternal
1011

1112
using System;
1213
using System.Collections.Generic;
1314
using System.Linq;
1415
using System.Runtime.CompilerServices;
16+
using ExtendedSystemObjects.Interfaces;
1517

1618
namespace ExtendedSystemObjects
1719
{

ExtendedSystemObjects/ExtendedList.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
using System.Linq;
1616
using System.Runtime.CompilerServices;
1717
using System.Security.Cryptography;
18+
using ExtendedSystemObjects.Interfaces;
1819

1920
namespace ExtendedSystemObjects
2021
{

ExtendedSystemObjects/IntArray.cs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
using System;
1212
using System.Runtime.CompilerServices;
1313
using System.Runtime.InteropServices;
14+
using ExtendedSystemObjects.Interfaces;
1415

1516
namespace ExtendedSystemObjects
1617
{
@@ -57,11 +58,22 @@ public IntArray(int size)
5758
/// </summary>
5859
private int Capacity { get; set; }
5960

61+
/// <inheritdoc />
6062
/// <summary>
6163
/// Gets the current number of elements in the array.
6264
/// </summary>
6365
public int Length { get; private set; }
6466

67+
/// <inheritdoc />
68+
/// <summary>
69+
/// Gets or sets the <see cref="!:T" /> at the specified index.
70+
/// </summary>
71+
/// <value>
72+
/// The <see cref="!:T" />.
73+
/// </value>
74+
/// <param name="i">The i.</param>
75+
/// <returns>Value at index.</returns>
76+
/// <exception cref="T:System.IndexOutOfRangeException"></exception>
6577
public int this[int i]
6678
{
6779
[MethodImpl(MethodImplOptions.AggressiveInlining)]
@@ -88,6 +100,7 @@ public int this[int i]
88100
}
89101
}
90102

103+
/// <inheritdoc />
91104
/// <summary>
92105
/// Resizes the internal buffer to the new capacity.
93106
/// If newSize is smaller than current Length, Length is reduced.
@@ -125,6 +138,7 @@ public void Resize(int newSize)
125138
}
126139

127140

141+
/// <inheritdoc />
128142
/// <summary>
129143
/// Clears all elements to zero.
130144
/// </summary>
@@ -136,6 +150,7 @@ public void Clear()
136150
}
137151
}
138152

153+
/// <inheritdoc />
139154
/// <summary>
140155
/// Frees unmanaged memory.
141156
/// </summary>
@@ -188,6 +203,7 @@ public void InsertAt(int index, int value, int count = 1)
188203
Length += count;
189204
}
190205

206+
/// <inheritdoc />
191207
/// <summary>
192208
/// Removes the element at the specified index by shifting remaining elements left.
193209
/// </summary>

ExtendedSystemObjects/IntList.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
using System;
1515
using System.Runtime.InteropServices;
16+
using ExtendedSystemObjects.Interfaces;
1617

1718
namespace ExtendedSystemObjects
1819
{

ExtendedSystemObjects/IIdHandling.cs renamed to ExtendedSystemObjects/Interfaces/IIdHandling.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
/*
22
* COPYRIGHT: See COPYING in the top level directory
3-
* PROJECT: ExtendedSystemObjects
4-
* FILE: ExtendedSystemObjects/IIdHandling.cs
3+
* PROJECT: ExtendedSystemObjects.Interfaces
4+
* FILE: ExtendedSystemObjects.Interfaces/IIdHandling.cs
55
* PURPOSE: Interface to smooth out my way of switching between Lists and Dictionaries
66
* PROGRAMER: Peter Geinitz (Wayfarer)
77
*/
88

9-
namespace ExtendedSystemObjects
9+
namespace ExtendedSystemObjects.Interfaces
1010
{
1111
/// <summary>
1212
/// Interface Id handling, for better handling of Dictionaries and list elements

ExtendedSystemObjects/IUnmanagedArray.cs renamed to ExtendedSystemObjects/Interfaces/IUnmanagedArray.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
/*
22
* COPYRIGHT: See COPYING in the top level directory
3-
* PROJECT: ExtendedSystemObjects
4-
* FILE: ExtendedSystemObjects/IUnmanagedArray.cs
3+
* PROJECT: ExtendedSystemObjects.Interfaces
4+
* FILE: ExtendedSystemObjects.Interfaces/IUnmanagedArray.cs
55
* PURPOSE: An Abstraction for UnmanagedArray and IntArray to make both exchangeable.
66
* PROGRAMMER: Peter Geinitz (Wayfarer)
77
*/
88

99
using System;
1010

11-
namespace ExtendedSystemObjects
11+
namespace ExtendedSystemObjects.Interfaces
1212
{
1313
/// <inheritdoc />
1414
/// <summary>
@@ -33,7 +33,7 @@ public interface IUnmanagedArray<T> : IDisposable
3333
/// The <see cref="T"/>.
3434
/// </value>
3535
/// <param name="index">The index.</param>
36-
/// <returns>Value at intex</returns>
36+
/// <returns>Value at index</returns>
3737
T this[int index] { get; set; }
3838

3939
/// <summary>

ExtendedSystemObjects/TransactionLogs.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -164,14 +164,15 @@ public int GetPredecessor(int id)
164164
lock (_lock)
165165
{
166166
if (!Changelog.TryGetValue(id, out var reference)) return -1;
167+
167168
var unique = reference.UniqueIdentifier;
168169

169-
foreach (var item in Changelog.Reverse())
170+
foreach (var (key, logEntry) in Changelog.Reverse())
170171
{
171-
if (item.Key >= id) continue;
172+
if (key >= id) continue;
172173

173-
if (item.Value.UniqueIdentifier == unique && item.Value.State == LogState.Add)
174-
return item.Key;
174+
if (logEntry.UniqueIdentifier == unique && logEntry.State == LogState.Add)
175+
return key;
175176
}
176177

177178
return -1;

ExtendedSystemObjects/UnmanagedArray.cs

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,12 @@
77
*/
88

99
// ReSharper disable MemberCanBeInternal
10+
// ReSharper disable UnusedMember.Global
11+
// ReSharper disable MemberCanBePrivate.Global
1012

1113
using System;
1214
using System.Runtime.InteropServices;
15+
using ExtendedSystemObjects.Interfaces;
1316

1417
namespace ExtendedSystemObjects
1518
{
@@ -62,15 +65,16 @@ public UnmanagedArray(int size)
6265
Clear();
6366
}
6467

68+
/// <inheritdoc />
6569
/// <summary>
66-
/// Gets or sets the <see cref="T" /> at the specified index.
70+
/// Gets or sets the <see cref="!:T" /> at the specified index.
6771
/// </summary>
6872
/// <value>
69-
/// The <see cref="T" />.
73+
/// The <see cref="!:T" />.
7074
/// </value>
7175
/// <param name="index">The index.</param>
7276
/// <returns>The value at the specified index.</returns>
73-
/// <exception cref="System.IndexOutOfRangeException"></exception>
77+
/// <exception cref="T:System.IndexOutOfRangeException"></exception>
7478
public T this[int index]
7579
{
7680
get
@@ -137,11 +141,12 @@ public void InsertAt(int index, T value, int count = 1)
137141
Length += count;
138142
}
139143

144+
/// <inheritdoc />
140145
/// <summary>
141146
/// Removes at.
142147
/// </summary>
143148
/// <param name="index">The index.</param>
144-
/// <exception cref="System.ArgumentOutOfRangeException">index</exception>
149+
/// <exception cref="T:System.ArgumentOutOfRangeException">index</exception>
145150
public void RemoveAt(int index)
146151
{
147152
if (index < 0 || index >= Length)
@@ -161,6 +166,7 @@ public void RemoveAt(int index)
161166
Length--;
162167
}
163168

169+
/// <inheritdoc />
164170
/// <summary>
165171
/// Resizes the internal array to the specified new size.
166172
/// Contents will be preserved up to the minimum of old and new size.
@@ -175,6 +181,7 @@ public void Resize(int newSize)
175181
Length = newSize;
176182
}
177183

184+
/// <inheritdoc />
178185
/// <summary>
179186
/// Clears the array by setting all elements to zero.
180187
/// </summary>
@@ -201,14 +208,15 @@ public void EnsureCapacity(int minCapacity)
201208
}
202209

203210
/// <summary>
204-
/// Ases the span.
211+
/// Access the span.
205212
/// </summary>
206213
/// <returns>Return all Values as Span</returns>
207214
public Span<T> AsSpan()
208215
{
209216
return new(_ptr, Length);
210217
}
211218

219+
/// <inheritdoc />
212220
/// <summary>
213221
/// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
214222
/// </summary>

0 commit comments

Comments
 (0)