IReportVisitor.java revision ae52ceefd83777c3eb5d8e3d9ddeca32ed93e3b8
1/*******************************************************************************
2 * Copyright (c) 2009 Mountainminds GmbH & Co. KG and others
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors:
9 *    Marc R. Hoffmann - initial API and implementation
10 *
11 * $Id: $
12 *******************************************************************************/
13package org.jacoco.report;
14
15import java.io.IOException;
16
17import org.jacoco.core.analysis.ICoverageNode;
18
19/**
20 * Output-Interface for hierarchical coverage data information. To allow data
21 * streaming and to save memory {@link ICoverageNode}s are traversed in a
22 * deep-first fashion. The interface is implemented by the different report
23 * writers.
24 *
25 * @author Marc R. Hoffmann
26 * @version $Revision: $
27 */
28public interface IReportVisitor {
29
30	/**
31	 * Called for every direct child.
32	 *
33	 * @param node
34	 *            Node for the child in the implementation class specific to
35	 *            this type. The counters are may yet be populated.
36	 *
37	 * @return visitor instance for processing the child node
38	 *
39	 * @throws IOException
40	 *             in case of IO problems with the report writer
41	 */
42	IReportVisitor visitChild(ICoverageNode node) throws IOException;
43
44	/**
45	 * Called at the very end, when all child node have been processed and the
46	 * counters for this node are properly populated.
47	 *
48	 * @param sourceFileLocator
49	 *            source file locator valid for this node
50	 * @throws IOException
51	 *             in case of IO problems with the report writer
52	 */
53	void visitEnd(ISourceFileLocator sourceFileLocator) throws IOException;
54
55}
56