01 /**
02 * BSD-style license; for more info see http://pmd.sourceforge.net/license.html
03 */
04 package net.sourceforge.pmd.dcd.asm;
05
06 public class PrintVisitor {
07
08 private static final String INDENT = "\t";
09
10 private final int level;
11
12 public PrintVisitor() {
13 this(0);
14 }
15
16 public PrintVisitor(PrintVisitor parent) {
17 this(parent.level + 2);
18 }
19
20 public PrintVisitor(int level) {
21 this.level = level;
22 }
23
24 protected void println(String s) {
25 println(this.level, s);
26 }
27
28 protected void printlnIndent(String s) {
29 println(this.level + 1, s);
30 }
31
32 private void println(int level, String s) {
33 for (int i = 0; i < level; i++) {
34 System.out.print(INDENT);
35 }
36 System.out.println(s);
37 }
38 }
|