Search in sources :

Example 1 with LineSgnificantCode

use of org.sonar.scanner.protocol.output.ScannerReport.LineSgnificantCode in project sonarqube by SonarSource.

the class SignificantCodeRepository method toArray.

private static LineRange[] toArray(CloseableIterator<LineSgnificantCode> lineRanges, int numLines) {
    LineRange[] ranges = new LineRange[numLines];
    LineSgnificantCode currentLine = null;
    for (int i = 0; i < numLines; i++) {
        if (currentLine == null) {
            if (!lineRanges.hasNext()) {
                break;
            }
            currentLine = lineRanges.next();
        }
        if (currentLine.getLine() == i + 1) {
            ranges[i] = new LineRange(currentLine.getStartOffset(), currentLine.getEndOffset());
            currentLine = null;
        }
    }
    return ranges;
}
Also used : LineRange(org.sonar.core.hash.LineRange) LineSgnificantCode(org.sonar.scanner.protocol.output.ScannerReport.LineSgnificantCode)

Aggregations

LineRange (org.sonar.core.hash.LineRange)1 LineSgnificantCode (org.sonar.scanner.protocol.output.ScannerReport.LineSgnificantCode)1