Skip to content

Commit

Permalink
Fixed some of the doc comments on Enumerators. In particular rewrote …
Browse files Browse the repository at this point in the history
…the `ChunkRangeEnumerator` comment, which was previously just copied from `QueryChunkEnumerator`. (#158)
  • Loading branch information
martindevans authored Oct 27, 2023
1 parent 353f7f6 commit 2e37009
Showing 1 changed file with 14 additions and 23 deletions.
37 changes: 14 additions & 23 deletions src/Arch/Core/Enumerators.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
using Arch.Core.Extensions;
using Arch.Core.Extensions.Internal;
using CommunityToolkit.HighPerformance;

Expand Down Expand Up @@ -106,7 +105,7 @@ public ref struct QueryArchetypeEnumerator
private readonly Query _query;
private Enumerator<Archetype> _archetypes;

/// <summary>
/// <summary>
/// Initializes a new instance of the <see cref="QueryArchetypeEnumerator"/> struct.
/// </summary>
/// <param name="query">The <see cref="Query"/> which contains a description and tells which <see cref="Archetype"/>'s fit.</param>
Expand Down Expand Up @@ -311,22 +310,23 @@ public QueryChunkEnumerator GetEnumerator()
}

/// <summary>
/// The <see cref="QueryChunkEnumerator"/> struct
/// represents an enumerator with which one can iterate over all non empty <see cref="Chunk"/>'s that matches the given <see cref="Query"/>.
/// The <see cref="ChunkRangeEnumerator"/> struct
/// represents an enumerator which can enumerate all the <see cref="Chunk"/>'s in an Archetype
/// </summary>
[SkipLocalsInit]
public ref struct ChunkRangeEnumerator
{
private Archetype _archetype;
private readonly Archetype _archetype;

private int _chunkIndex;
private int _toChunkIndex;
private readonly int _toChunkIndex;

/// <summary>
/// Initializes a new instance of the <see cref="QueryChunkEnumerator"/> struct.
/// </summary>
/// <param name="query">The <see cref="Query"/> which contains a description and tells which <see cref="Chunk"/>'s fit.</param>
/// <param name="archetypes">A <see cref="Span{T}"/> of <see cref="Archetype"/>'s which <see cref="Chunk"/>'s are checked using the <see cref="Query"/>.</param>
/// <param name="from">The index of the chunk to begin enumerating from</param>
/// <param name="archetype">The <see cref="Archetype"/> to retrieve <see cref="Chunk"/>'s from.</param>
/// <param name="to">The index of the last chunk to return</param>
[SkipLocalsInit]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
internal ChunkRangeEnumerator(Archetype archetype, int from, int to)
Expand Down Expand Up @@ -373,8 +373,8 @@ public readonly ref Chunk Current
}

/// <summary>
/// The <see cref="QueryChunkIterator"/> struct
/// represents an iterator wich wraps the <see cref="QueryChunkEnumerator"/> for using it in foreach loops.
/// The <see cref="ChunkRangeIterator"/> struct
/// represents an iterator wich wraps the <see cref="ChunkRangeEnumerator"/> for using it in foreach loops.
/// </summary>
[SkipLocalsInit]
public readonly ref struct ChunkRangeIterator
Expand All @@ -383,24 +383,15 @@ public readonly ref struct ChunkRangeIterator
private readonly int _from;
private readonly int _to;

/// <summary>
/// Initializes a new instance of the <see cref="QueryChunkIterator"/> struct
/// </summary>
/// <param name="query">The <see cref="Query"/> each <see cref="QueryChunkEnumerator"/> will use.</param>
/// <param name="archetypes">The <see cref="Archetype"/>'s each <see cref="QueryChunkEnumerator"/> will use.</param>
[SkipLocalsInit]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public ChunkRangeIterator(Archetype archetype, int from, int to)
{
_archetype = archetype;
this._from = from;
this._to = to;
_from = from;
_to = to;
}

/// <summary>
/// Creates a new instance of <see cref="QueryChunkEnumerator"/> with the given <see cref="_query"/> and <see cref="_archetypes"/>.
/// </summary>
/// <returns>The new <see cref="QueryChunkEnumerator"/> instance.</returns>
[SkipLocalsInit]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public ChunkRangeEnumerator GetEnumerator()
Expand All @@ -411,7 +402,7 @@ public ChunkRangeEnumerator GetEnumerator()

/// <summary>
/// The <see cref="EntityEnumerator"/> struct
/// represents an enumerator with which one can iterate over all <see cref="Entity"/>'s in a given <see cref="Chunk"/>.
/// represents an enumerator which one can iterate over all <see cref="Entity"/>'s in a given <see cref="Chunk"/>.
/// Each <see cref="Entity"/> is represented by its index inside the <see cref="Chunk"/>.
/// </summary>
[SkipLocalsInit]
Expand Down Expand Up @@ -491,7 +482,7 @@ public EntityEnumerator GetEnumerator()

/// <summary>
/// The <see cref="RangeEnumerator"/> struct
/// is sed to iterate over sections of a range to split them into pieces.
/// is used to iterate over sections of a range to split them into pieces.
/// Mostly used to partition arrays.
/// </summary>
public ref struct RangeEnumerator
Expand Down

0 comments on commit 2e37009

Please sign in to comment.