private static void writeLines(final ISourceNode source, final ReportElement parent) throws IOException { final int last = source.getLastLine(); for (int nr = source.getFirstLine(); nr <= last; nr++) { final ILine line = source.getLine(nr); if (line.getStatus() != ICounter.EMPTY) { parent.line(nr, line); } } }
/** * Increments all counters by the values of the given child. When * incrementing the line counter it is assumed that the child refers to the * same source file. * * @param child * child node to add */ public void increment(final ISourceNode child) { instructionCounter = instructionCounter.increment(child .getInstructionCounter()); branchCounter = branchCounter.increment(child.getBranchCounter()); complexityCounter = complexityCounter.increment(child .getComplexityCounter()); methodCounter = methodCounter.increment(child.getMethodCounter()); classCounter = classCounter.increment(child.getClassCounter()); final int firstLine = child.getFirstLine(); if (firstLine != UNKNOWN_LINE) { final int lastLine = child.getLastLine(); ensureCapacity(firstLine, lastLine); for (int i = firstLine; i <= lastLine; i++) { final ILine line = child.getLine(i); incrementLine(line.getInstructionCounter(), line.getBranchCounter(), i); } } }