Clover coverage report - Dependency Finder
Coverage timestamp: Mon Nov 29 2010 15:00:50 PST
file stats: LOC: 179   Methods: 28
NCLOC: 112   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
Printer.java 100% 61% 60.7% 62%
coverage coverage
 1    /*
 2    * Copyright (c) 2001-2009, Jean Tessier
 3    * All rights reserved.
 4    *
 5    * Redistribution and use in source and binary forms, with or without
 6    * modification, are permitted provided that the following conditions
 7    * are met:
 8    *
 9    * * Redistributions of source code must retain the above copyright
 10    * notice, this list of conditions and the following disclaimer.
 11    *
 12    * * Redistributions in binary form must reproduce the above copyright
 13    * notice, this list of conditions and the following disclaimer in the
 14    * documentation and/or other materials provided with the distribution.
 15    *
 16    * * Neither the name of Jean Tessier nor the names of his contributors
 17    * may be used to endorse or promote products derived from this software
 18    * without specific prior written permission.
 19    *
 20    * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 21    * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 22    * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
 23    * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR
 24    * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
 25    * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
 26    * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
 27    * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
 28    * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
 29    * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
 30    * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 31    */
 32   
 33    package com.jeantessier.metrics;
 34   
 35    import java.io.*;
 36    import java.util.*;
 37   
 38    public abstract class Printer implements MeasurementVisitor {
 39    public static final String DEFAULT_INDENT_TEXT = " ";
 40   
 41    private PrintWriter out;
 42   
 43    private boolean showEmptyMetrics = false;
 44    private boolean showHiddenMeasurements = false;
 45    private String indentText = DEFAULT_INDENT_TEXT;
 46    private int indentLevel = 0;
 47   
 48  5 public Printer(PrintWriter out) {
 49  5 this.out = out;
 50    }
 51   
 52  3912 public String getIndentText() {
 53  3912 return indentText;
 54    }
 55   
 56  0 public void setIndentText(String indentText) {
 57  0 this.indentText = indentText;
 58    }
 59   
 60  5 public boolean isShowEmptyMetrics() {
 61  5 return showEmptyMetrics;
 62    }
 63   
 64  0 public void setShowEmptyMetrics(boolean showEmptyMetrics) {
 65  0 this.showEmptyMetrics = showEmptyMetrics;
 66    }
 67   
 68  145 public boolean isShowHiddenMeasurements() {
 69  145 return showHiddenMeasurements;
 70    }
 71   
 72  0 public void setShowHiddenMeasurements(boolean showHiddenMeasurements) {
 73  0 this.showHiddenMeasurements = showHiddenMeasurements;
 74    }
 75   
 76  0 protected Printer append(boolean b) {
 77  0 out.print(b);
 78  0 return this;
 79    }
 80   
 81  0 protected Printer append(char c) {
 82  0 out.print(c);
 83  0 return this;
 84    }
 85   
 86  0 protected Printer append(char[] s) {
 87  0 out.print(s);
 88  0 return this;
 89    }
 90   
 91  114 protected Printer append(double d) {
 92  114 out.print(d);
 93  114 return this;
 94    }
 95   
 96  0 protected Printer append(float f) {
 97  0 out.print(f);
 98  0 return this;
 99    }
 100   
 101  19 protected Printer append(int i) {
 102  19 out.print(i);
 103  19 return this;
 104    }
 105   
 106  0 protected Printer append(long l) {
 107  0 out.print(l);
 108  0 return this;
 109    }
 110   
 111  153 protected Printer append(Object obj) {
 112  153 out.print(obj);
 113  153 return this;
 114    }
 115   
 116  5691 protected Printer append(String s) {
 117  5691 out.print(s);
 118  5691 return this;
 119    }
 120   
 121  901 protected Printer indent() {
 122  901 for (int i=0; i<indentLevel; i++) {
 123  3912 append(getIndentText());
 124    }
 125   
 126  901 return this;
 127    }
 128   
 129  921 protected Printer eol() {
 130  921 out.println();
 131  921 return this;
 132    }
 133   
 134  167 protected void raiseIndent() {
 135  167 indentLevel++;
 136    }
 137   
 138  167 protected void lowerIndent() {
 139  167 indentLevel--;
 140    }
 141   
 142  1 public void visitMetrics(Collection<Metrics> metrics) {
 143  1 for (Metrics metric : metrics) {
 144  1 visitMetrics(metric);
 145    }
 146    }
 147   
 148    public abstract void visitMetrics(Metrics metrics);
 149   
 150  37 public void visitRatioMeasurement(RatioMeasurement measurement) {
 151  37 visitMeasurement(measurement);
 152    }
 153   
 154  3 public void visitNbSubMetricsMeasurement(NbSubMetricsMeasurement measurement) {
 155  3 visitMeasurement(measurement);
 156    }
 157   
 158  55 public void visitCounterMeasurement(CounterMeasurement measurement) {
 159  55 visitMeasurement(measurement);
 160    }
 161   
 162  0 public void visitContextAccumulatorMeasurement(ContextAccumulatorMeasurement measurement) {
 163  0 visitMeasurement(measurement);
 164    }
 165   
 166  0 public void visitNameListMeasurement(NameListMeasurement measurement) {
 167  0 visitMeasurement(measurement);
 168    }
 169   
 170  0 public void visitSubMetricsAccumulatorMeasurement(SubMetricsAccumulatorMeasurement measurement) {
 171  0 visitMeasurement(measurement);
 172    }
 173   
 174  1 public void visitSumMeasurement(SumMeasurement measurement) {
 175  1 visitMeasurement(measurement);
 176    }
 177   
 178    protected abstract void visitMeasurement(Measurement measurement);
 179    }