1 28 29 package org.jruby.ast.visitor.rewriter.utils; 30 31 import java.io.PrintWriter ; 32 33 public class Indentor { 34 35 private int indentation; 36 37 private int indentationSteps; 38 39 private char indentationChar; 40 41 public Indentor(int indentationSteps, char indentationChar) { 42 this.indentationSteps = indentationSteps; 43 this.indentationChar = indentationChar; 44 } 45 46 public void indent() { 47 indentation += indentationSteps; 48 } 49 50 public void outdent() { 51 indentation -= indentationSteps; 52 } 53 54 public void printIndentation(PrintWriter out) { 55 for (int i = 0; i < indentation; i++) 56 out.print(indentationChar); 57 } 58 59 public char getIndentationChar() { 60 return indentationChar; 61 } 62 63 public void setIndentationChar(char indentationChar) { 64 this.indentationChar = indentationChar; 65 } 66 67 public int getIndentationSteps() { 68 return indentationSteps; 69 } 70 71 public void setIndentationSteps(int indentationSteps) { 72 this.indentationSteps = indentationSteps; 73 } 74 } | Popular Tags |