Skip to content

Commit 01172be

Browse files
committed
2 parents 63c84f1 + 2793bee commit 01172be

File tree

7 files changed

+137
-21
lines changed

7 files changed

+137
-21
lines changed

csharp/Platform.Collections.Tests/Platform.Collections.Tests.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@
1111
</ItemGroup>
1212

1313
<ItemGroup>
14-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.8.3" />
14+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.9.1" />
1515
<PackageReference Include="xunit" Version="2.4.1" />
1616
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3" PrivateAssets="All" />
17-
<PackageReference Include="coverlet.collector" Version="1.3.0" PrivateAssets="All" />
17+
<PackageReference Include="coverlet.collector" Version="3.0.3" PrivateAssets="All" />
1818
</ItemGroup>
1919

2020
<ItemGroup>

csharp/Platform.Collections/Arrays/ArrayFiller[TElement, TReturnConstant].cs

Lines changed: 55 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,82 @@
11
using System.Collections.Generic;
22
using System.Runtime.CompilerServices;
33

4-
#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member
5-
64
namespace Platform.Collections.Arrays
75
{
6+
/// <summary>
7+
/// <para>Represents <see cref="T:TElement[]"/> array filler with additional methods that return a given constant of type <typeparamref cref="TReturnConstant"/>.</para>
8+
/// <para>Представляет заполнитель массива <see cref="T:TElement[]"/> c дополнительными методами, возвращающими заданную константу типа <typeparamref cref="TReturnConstant"/>.</para>
9+
/// </summary>
10+
/// <typeparam name="TElement"><para>The elements' type.</para><para>Тип элементов массива.</para></typeparam>
11+
/// <typeparam name="TReturnConstant"><para>The return constant's type.</para><para>Тип возвращаемой константы.</para></typeparam>
812
public class ArrayFiller<TElement, TReturnConstant> : ArrayFiller<TElement>
913
{
1014
protected readonly TReturnConstant _returnConstant;
1115

16+
/// <summary>
17+
/// <para>Initializes a new instance of the <see cref="ArrayFiller"/> class using the specified array, the offset from which filling will start and the constant returned when elements are being filled.</para>
18+
/// <para>Инициализирует новый экземпляр класса <see cref="ArrayFiller"/>, используя указанный массив, смещение с которого начнётся заполнение и константу возвращаемую при заполнении элементов.</para>
19+
/// </summary>
20+
/// <param name="array"><para>The array to fill.</para><para>Массив для заполнения.</para></param>
21+
/// <param name="offset"><para>The offset from which to start the array filling.</para><para>Смещение с которого начнётся заполнение массива.</para></param>
22+
/// <param name="returnConstant"><para>The constant's value.</para><para>Значение константы.</para></param>
1223
[MethodImpl(MethodImplOptions.AggressiveInlining)]
1324
public ArrayFiller(TElement[] array, long offset, TReturnConstant returnConstant) : base(array, offset) => _returnConstant = returnConstant;
1425

26+
/// <summary>
27+
/// <para>Initializes a new instance of the <see cref="ArrayFiller"/> class using the specified array and the constant returned when elements are being filled. Filling will start from the beginning of the array.</para>
28+
/// <para>Инициализирует новый экземпляр класса <see cref="ArrayFiller"/>, используя указанный массив и константу возвращаемую при заполнении элементов. Заполнение начнётся с начала массива.</para>
29+
/// </summary>
30+
/// <param name="array"><para>The array to fill.</para><para>Массив для заполнения.</para></param>
31+
/// <param name="returnConstant"><para>The constant's value.</para><para>Значение константы.</para></param>
1532
[MethodImpl(MethodImplOptions.AggressiveInlining)]
1633
public ArrayFiller(TElement[] array, TReturnConstant returnConstant) : this(array, 0, returnConstant) { }
1734

35+
/// <summary>
36+
/// <para>Adds an item into the array and returns the constant.</para>
37+
/// <para>Добавляет элемент в массив и возвращает константу.</para>
38+
/// </summary>
39+
/// <param name="element"><para>The element to add.</para><para>Добавляемый элемент.</para></param>
40+
/// <returns>
41+
/// <para>The constant's value.</para>
42+
/// <para>Значение константы.</para>
43+
/// </returns>
1844
[MethodImpl(MethodImplOptions.AggressiveInlining)]
1945
public TReturnConstant AddAndReturnConstant(TElement element) => _array.AddAndReturnConstant(ref _position, element, _returnConstant);
2046

47+
/// <summary>
48+
/// <para>Adds the first element from the specified list to the filled array and returns the constant.</para>
49+
/// <para>Добавляет первый элемент из указанного списка в заполняемый массив и возвращает константу.</para>
50+
/// </summary>
51+
/// <param name="element"><para>The list from which the first item will be added.</para><para>Список из которого будет добавлен первый элемент.</para></param>
52+
/// <returns>
53+
/// <para>The constant's value.</para>
54+
/// <para>Значение константы.</para>
55+
/// <returns>
2156
[MethodImpl(MethodImplOptions.AggressiveInlining)]
2257
public TReturnConstant AddFirstAndReturnConstant(IList<TElement> elements) => _array.AddFirstAndReturnConstant(ref _position, elements, _returnConstant);
2358

59+
/// <summary>
60+
/// <para>Adds all elements from the specified list to the filled array and returns the constant.</para>
61+
/// <para>Добавляет все элементы из указанного списка в заполняемый массив и возвращает константу.</para>
62+
/// </summary>
63+
/// <param name="elements"><para>The list of values to add.</para><para>Список значений для добавления.</para></param>
64+
/// <returns>
65+
/// <para>The constant's value.</para>
66+
/// <para>Значение константы.</para>
67+
/// <returns>
2468
[MethodImpl(MethodImplOptions.AggressiveInlining)]
2569
public TReturnConstant AddAllAndReturnConstant(IList<TElement> elements) => _array.AddAllAndReturnConstant(ref _position, elements, _returnConstant);
2670

71+
/// <summary>
72+
/// <para>Adds the elements of the list to the array, skipping the first element and returns the constant.</para>
73+
/// <para>Добавляет элементы списка в массив пропуская первый элемент и возвращает константу.</para>
74+
/// </summary>
75+
/// <param name="elements"><para>The list of values to add.</para><para>Список значений для добавления.</para></param>
76+
/// <returns>
77+
/// <para>The constant's value.</para>
78+
/// <para>Значение константы.</para>
79+
/// </returns>
2780
[MethodImpl(MethodImplOptions.AggressiveInlining)]
2881
public TReturnConstant AddSkipFirstAndReturnConstant(IList<TElement> elements) => _array.AddSkipFirstAndReturnConstant(ref _position, elements, _returnConstant);
2982
}

csharp/Platform.Collections/Arrays/ArrayFiller[TElement].cs

Lines changed: 58 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,92 @@
11
using System.Collections.Generic;
22
using System.Runtime.CompilerServices;
33

4-
#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member
5-
64
namespace Platform.Collections.Arrays
75
{
6+
/// <summary>
7+
/// <para>Represents an <see cref="T:TElement[]"/> array filler.</para>
8+
/// <para>Представляет заполнитель массива <see cref="T:TElement[]"/>.</para>
9+
/// </summary>
10+
/// <typeparam name="TElement"><para>The elements' type.</para><para>Тип элементов массива.</para></typeparam>
811
public class ArrayFiller<TElement>
912
{
1013
protected readonly TElement[] _array;
1114
protected long _position;
1215

16+
/// <summary>
17+
/// <para>Initializes a new instance of the <see cref="ArrayFiller"/> class using the specified array as the array to fill and the offset from which to start filling.</para></para>
18+
/// <para>Инициализирует новый экземпляр класса <see cref="ArrayFiller"/>, используя указанный массив в качестве заполняемого и смещение с которого начнётся заполнение.</para>
19+
/// </summary>
20+
/// <param name="array"><para>The array to fill.</para><para>Массив для заполнения.</para></param>
21+
/// <param name="offset"><para>The offset from which to start filling the array.</para><para>Смещение с которого начнётся заполнение массива.</para></param>
1322
[MethodImpl(MethodImplOptions.AggressiveInlining)]
1423
public ArrayFiller(TElement[] array, long offset)
1524
{
1625
_array = array;
1726
_position = offset;
1827
}
1928

29+
/// <summary>
30+
/// <para>Initializes a new instance of the <see cref="ArrayFiller"/> class using the specified array. Filling will start from the beginning of the array.</para>
31+
/// <para>Инициализирует новый экземпляр класса <see cref="ArrayFiller"/>, используя указанный массив. Заполнение начнётся с начала массива.</para>
32+
/// </summary>
33+
/// <param name="array"><para>The array to fill.</para><para>Массив для заполнения.</para></param>
2034
[MethodImpl(MethodImplOptions.AggressiveInlining)]
2135
public ArrayFiller(TElement[] array) : this(array, 0) { }
2236

37+
/// <summary>
38+
/// <para>Adds an item into the array.</para>
39+
/// <para>Добавляет элемент в массив.</para>
40+
/// </summary>
41+
/// <param name="element"><para>The element to add.</para><para>Добавляемый элемент.</para></param>
2342
[MethodImpl(MethodImplOptions.AggressiveInlining)]
2443
public void Add(TElement element) => _array[_position++] = element;
2544

45+
/// <summary>
46+
/// <para>Adds an item into the array and returns <see langword="true"/>.</para>
47+
/// <para>Добавляет элемент в массив и возвращает <see langword="true"/>.</para>
48+
/// </summary>
49+
/// <param name="element"><para>The element to add.</para><para>Добавляемый элемент.</para></param>
50+
/// <returns>
51+
/// <para>The <see langword="true"/> value.</para>
52+
/// <para>Значение <see langword="true"/>.</para>
53+
/// </returns>
2654
[MethodImpl(MethodImplOptions.AggressiveInlining)]
2755
public bool AddAndReturnTrue(TElement element) => _array.AddAndReturnConstant(ref _position, element, true);
2856

57+
/// <summary>
58+
/// <para>Adds the first element from the specified list to the array to fill and returns <see langword="true"/>.</para>
59+
/// <para>Добавляет первый элемент из указанного списка в заполняемый массив и возвращает <see langword="true"/>.</para>
60+
/// </summary>
61+
/// <param name="element"><para>The list from which the first item will be added.</para><para>Список из которого будет добавлен первый элемент.</para></param>
62+
/// <returns>
63+
/// <para>The <see langword="true"/> value.</para>
64+
/// <para>Значение <see langword="true"/>.</para>
65+
/// </returns>
2966
[MethodImpl(MethodImplOptions.AggressiveInlining)]
3067
public bool AddFirstAndReturnTrue(IList<TElement> elements) => _array.AddFirstAndReturnConstant(ref _position, elements, true);
31-
68+
69+
/// <summary>
70+
/// <para>Adds all elements from the specified list to the array to fill and returns <see langword="true"/>.</para>
71+
/// <para>Добавляет все элементы из указанного списка в заполняемый массив и возвращает <see langword="true"/>.</para>
72+
/// </summary>
73+
/// <param name="elements"><para>The list of values to add.</para><para>Список значений которые необходимо добавить.</para></param>
74+
/// <returns>
75+
/// <para>The <see langword="true"/> value.</para>
76+
/// <para>Значение <see langword="true"/>.</para>
77+
/// </returns>
3278
[MethodImpl(MethodImplOptions.AggressiveInlining)]
3379
public bool AddAllAndReturnTrue(IList<TElement> elements) => _array.AddAllAndReturnConstant(ref _position, elements, true);
3480

81+
/// <summary>
82+
/// <para>Adds values to the array skipping the first element and returns <see langword="true"/>.</para>
83+
/// <para>Добавляет значения в массив пропуская первый элемент и возвращает <see langword="true"/>.</para>
84+
/// </summary>
85+
/// <param name="elements"><para>A list from which elements will be added except the first.</para><para>Список из которого будут добавлены элементы кроме первого.</para></param>
86+
/// <returns>
87+
/// <para>The <see langword="true"/> value.</para>
88+
/// <para>Значение <see langword="true"/>.</para>
89+
/// </returns>
3590
[MethodImpl(MethodImplOptions.AggressiveInlining)]
3691
public bool AddSkipFirstAndReturnTrue(IList<TElement> elements) => _array.AddSkipFirstAndReturnConstant(ref _position, elements, true);
3792
}

csharp/Platform.Collections/Arrays/ArrayPool.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
namespace Platform.Collections.Arrays
44
{
5+
/// <summary>
6+
/// <para>Represents a set of wrapper methods over <see cref="ArrayPool{T}"/> class methods to simplify access to them.</para>
7+
/// <para>Представляет набор методов обёрток над методами класса <see cref="ArrayPool{T}"> для упрощения доступа к ним.</para>
8+
/// </summary>
59
public static class ArrayPool
610
{
711
public static readonly int DefaultSizesAmount = 512;

csharp/Platform.Collections/Arrays/CharArrayExtensions.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ public static int GenerateHashCode(this char[] array, int offset, int length)
4343
/// <param name="right"><para>The second compared array.</para><para>Второй массив для сравнения.</para></param>
4444
/// <param name="rightOffset"><para>The offset from which reading of the specified number of elements in the second array starts.</para><para>Смещение, с которого начинается чтение элементов в втором массиве.</para></param>
4545
/// <returns>
46-
/// <para>True if the segments of the passed arrays are equal to each other otherwise false.</para>
47-
/// <para>True, если сегменты переданных массивов равны друг другу, иначе же false.</para>
46+
/// <para><see langword="true"/> if the segments of the passed arrays are equal to each other otherwise <see langword="false"/>.</para>
47+
/// <para><see langword="true"/>, если сегменты переданных массивов равны друг другу, иначе же <see langword="false"/>.</para>
4848
/// </returns>
4949
/// <remarks>
5050
/// Based on https://github.com/Microsoft/referencesource/blob/3b1eaf5203992df69de44c783a3eda37d3d4cd10/mscorlib/system/string.cs#L364

0 commit comments

Comments
 (0)