< Summary

Information
Class: Pozitron.QuerySpecification.SpecIterator<T>
Assembly: Pozitron.QuerySpecification
File(s): /home/runner/work/QuerySpecification/QuerySpecification/src/QuerySpecification/Internals/SpecIterator.cs
Tag: 52_11740816328
Line coverage
100%
Covered lines: 16
Uncovered lines: 0
Coverable lines: 16
Total lines: 41
Line coverage: 100%
Branch coverage
100%
Covered branches: 6
Total branches: 6
Branch coverage: 100%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
.ctor(...)100%11100%
Clone()100%11100%
MoveNext()100%66100%

File(s)

/home/runner/work/QuerySpecification/QuerySpecification/src/QuerySpecification/Internals/SpecIterator.cs

#LineLine coverage
 1using System.Diagnostics;
 2
 3namespace Pozitron.QuerySpecification;
 4
 5internal sealed class SpecIterator<TObject> : Iterator<TObject>
 6{
 7    private readonly SpecItem[] _source;
 8    private readonly int _type;
 9
 510    public SpecIterator(SpecItem[] source, int type)
 11    {
 12        Debug.Assert(source != null && source.Length > 0);
 513        _type = type;
 514        _source = source;
 515    }
 16
 17    public override Iterator<TObject> Clone() =>
 318        new SpecIterator<TObject>(_source, _type);
 19
 20    public override bool MoveNext()
 21    {
 1222        var index = _state - 1;
 1223        var source = _source;
 1224        var type = _type;
 25
 2626        while (unchecked((uint)index < (uint)source.Length))
 27        {
 2328            var item = source[index];
 2329            index = _state++;
 30
 2331            if (item.Type == type && item.Reference is TObject reference)
 32            {
 933                _current = reference;
 934                return true;
 35            }
 36        }
 37
 338        Dispose();
 339        return false;
 40    }
 41}