Functional coverage tree: Difference between revisions

Content added Content deleted
(New post.)
m (Improved output format.)
Line 800: Line 800:
final double overallCoverage = cleaning.getCoverage();
final double overallCoverage = cleaning.getCoverage();
System.out.println("OVERALL COVERAGE = " + String.format("%.6f", overallCoverage) + System.lineSeparator());
System.out.println("OVERALL COVERAGE = " + String.format("%.6f", overallCoverage) + System.lineSeparator());
System.out.println("NAME HIERARCHY | WEIGHT | COVERAGE |");
System.out.println("NAME HIERARCHY | WEIGHT | COVERAGE |" );
System.out.println("--------------------------------|--------|----------|");
cleaning.display();
cleaning.display();
System.out.println();
System.out.println();
Line 861: Line 862:
private void display(int aLevel) {
private void display(int aLevel) {
final String initial = " ".repeat(4 * aLevel) + name;
final String initial = " ".repeat(4 * aLevel) + name;
final String padding = " ".repeat(32 - initial.length());
final String padding = " ".repeat(NAME_FIELD_WIDTH - initial.length());
System.out.print(initial + padding + "|");
System.out.print(initial + padding + "|");
System.out.print(" " + String.format("%3d", weight) + " |");
System.out.print(" " + String.format("%3d", weight) + " |");
Line 876: Line 877:
private FCNode parent;
private FCNode parent;
private List<FCNode> children = new ArrayList<FCNode>();
private List<FCNode> children = new ArrayList<FCNode>();
private static final int NAME_FIELD_WIDTH = 32;
}
}
Line 884: Line 887:


NAME HIERARCHY | WEIGHT | COVERAGE |
NAME HIERARCHY | WEIGHT | COVERAGE |
--------------------------------|--------|----------|
Cleaning | 1 | 0.409167 |
Cleaning | 1 | 0.409167 |
House_1 | 40 | 0.331250 |
House_1 | 40 | 0.331250 |