01: /*
02: * @(#)HashMapNode.java 1.36 02/03/21
03: *
04: * Copyright 2002 Sun Microsystems, Inc. All rights reserved.
05: * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
06: */
07: package org.enhydra.xml;
08:
09: /**
10: * @author Tweety
11: *
12: * A class that describes format of the output xml file.
13: *
14: * @version 1.0
15: */
16: public class Indent {
17:
18: /**
19: * Default tab value.
20: */
21: public static String DEFAULT_TAB = " ";
22:
23: /**
24: * Indent size.
25: */
26: private int indent;
27:
28: /**
29: * Tab string, the value that is going to be treated as tab.
30: */
31: private String tab;
32:
33: /**
34: * Constructs new <code>Indent</code> with the given size of indentation and the tab string.
35: *
36: * @param ind size of indentation.
37: * @param tab tab string.
38: */
39: public Indent(int ind, String tab) {
40: this .indent = ind;
41: this .tab = tab;
42: }
43:
44: /**
45: * toString method
46: */
47: public String toString() {
48: StringBuffer buff = new StringBuffer();
49: for (int i = 0; i < indent; i++)
50: buff.append(tab);
51: return buff.toString();
52: }
53:
54: /**
55: * Increments the indentation size.
56: */
57: public void increment() {
58: indent++;
59: }
60:
61: /**
62: * Decrements the indentation size.
63: */
64: public void decrement() {
65: indent--;
66: }
67:
68: /**
69: * Returns the tab string.
70: */
71: public String getTab() {
72: return tab;
73: }
74:
75: /**
76: * Sets the tab string.
77: */
78: public void setTab(String tab) {
79: this.tab = tab;
80: }
81:
82: }
|