fix spacing
parent
b6485f345b
commit
11488eba60
|
@ -9,7 +9,7 @@ namespace MoonTools.ECS
|
||||||
private Dictionary<T, int> indices;
|
private Dictionary<T, int> indices;
|
||||||
private T[] array;
|
private T[] array;
|
||||||
public int Count { get; private set; }
|
public int Count { get; private set; }
|
||||||
public Enumerator GetEnumerator() => new Enumerator(this);
|
public Enumerator GetEnumerator() => new Enumerator(this);
|
||||||
|
|
||||||
public IndexableSet(int size = 32)
|
public IndexableSet(int size = 32)
|
||||||
{
|
{
|
||||||
|
@ -70,41 +70,41 @@ namespace MoonTools.ECS
|
||||||
}
|
}
|
||||||
|
|
||||||
public struct Enumerator
|
public struct Enumerator
|
||||||
{
|
{
|
||||||
/// <summary>The set being enumerated.</summary>
|
/// <summary>The set being enumerated.</summary>
|
||||||
private readonly IndexableSet<T> _set;
|
private readonly IndexableSet<T> _set;
|
||||||
/// <summary>The next index to yield.</summary>
|
/// <summary>The next index to yield.</summary>
|
||||||
private int _index;
|
private int _index;
|
||||||
|
|
||||||
/// <summary>Initialize the enumerator.</summary>
|
/// <summary>Initialize the enumerator.</summary>
|
||||||
/// <param name="set">The set to enumerate.</param>
|
/// <param name="set">The set to enumerate.</param>
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
internal Enumerator(IndexableSet<T> set)
|
internal Enumerator(IndexableSet<T> set)
|
||||||
{
|
{
|
||||||
_set = set;
|
_set = set;
|
||||||
_index = _set.Count;
|
_index = _set.Count;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Advances the enumerator to the next element of the span.</summary>
|
/// <summary>Advances the enumerator to the next element of the span.</summary>
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public bool MoveNext()
|
public bool MoveNext()
|
||||||
{
|
{
|
||||||
int index = _index - 1;
|
int index = _index - 1;
|
||||||
if (index >= 0)
|
if (index >= 0)
|
||||||
{
|
{
|
||||||
_index = index;
|
_index = index;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Gets the element at the current position of the enumerator.</summary>
|
/// <summary>Gets the element at the current position of the enumerator.</summary>
|
||||||
public T Current
|
public T Current
|
||||||
{
|
{
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
get => _set[_index];
|
get => _set[_index];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue