Clover coverage report - Dependency Finder
Coverage timestamp: Mon Nov 29 2010 15:00:50 PST
file stats: LOC: 130   Methods: 18
NCLOC: 76   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
PrinterBuffer.java 100% 100% 100% 100%
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.text;
 34   
 35    public class PrinterBuffer {
 36    public static final String DEFAULT_INDENT_TEXT = " ";
 37   
 38    private final static String EOL = System.getProperty("line.separator", "\n");
 39   
 40    private StringBuffer buffer = new StringBuffer();
 41    private String indentText = DEFAULT_INDENT_TEXT;
 42    private int indentLevel = 0;
 43   
 44  2494 public String getIndentText() {
 45  2494 return indentText;
 46    }
 47   
 48  8 public void setIndentText(String indentText) {
 49  8 this.indentText = indentText;
 50    }
 51   
 52  1 public PrinterBuffer append(boolean b) {
 53  1 buffer.append(b);
 54  1 return this;
 55    }
 56   
 57  1 public PrinterBuffer append(char c) {
 58  1 buffer.append(c);
 59  1 return this;
 60    }
 61   
 62  1 public PrinterBuffer append(char[] str, int offset, int len) {
 63  1 buffer.append(str, offset, len);
 64  1 return this;
 65    }
 66   
 67  1 public PrinterBuffer append(char[] s) {
 68  1 buffer.append(s);
 69  1 return this;
 70    }
 71   
 72  1 public PrinterBuffer append(double d) {
 73  1 buffer.append(d);
 74  1 return this;
 75    }
 76   
 77  2 public PrinterBuffer append(float f) {
 78  2 buffer.append(f);
 79  2 return this;
 80    }
 81   
 82  19 public PrinterBuffer append(int i) {
 83  19 buffer.append(i);
 84  19 return this;
 85    }
 86   
 87  1 public PrinterBuffer append(long l) {
 88  1 buffer.append(l);
 89  1 return this;
 90    }
 91   
 92  347 public PrinterBuffer append(Object obj) {
 93  347 buffer.append(obj);
 94  347 return this;
 95    }
 96   
 97  4125 public PrinterBuffer append(String s) {
 98  4125 buffer.append(s);
 99  4125 return this;
 100    }
 101   
 102  1122 public PrinterBuffer indent() {
 103  1122 for (int i=0; i< indentLevel; i++) {
 104  2488 buffer.append(getIndentText());
 105    }
 106   
 107  1122 return this;
 108    }
 109   
 110  1241 public PrinterBuffer eol() {
 111  1241 buffer.append(EOL);
 112  1241 return this;
 113    }
 114   
 115  322 public void raiseIndent() {
 116  322 indentLevel++;
 117    }
 118   
 119  301 public void lowerIndent() {
 120  301 indentLevel--;
 121    }
 122   
 123  18 public int length() {
 124  18 return buffer.length();
 125    }
 126   
 127  119 public String toString() {
 128  119 return buffer.toString();
 129    }
 130    }