1 /*
2 Copyright (C) 2003 Together
3
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2.1 of the License, or (at your option) any later version.
8
9 This library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General Public
15 License along with this library; if not, write to the Free Software
16 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 */
18
19 package org.enhydra.xml;
20
21
22 /***
23 * @author Tweety
24 *
25 * A class that describes format of the output xml file.
26 *
27 * @version 1.0
28 */
29 public class Indent {
30
31 /***
32 * Default tab value.
33 */
34 public static String DEFAULT_TAB = " ";
35
36 /***
37 * Indent size.
38 */
39 private int indent;
40
41 /***
42 * Tab string, the value that is going to be treated as tab.
43 */
44 private String tab;
45
46
47
48 /***
49 * Constructs new <code>Indent</code> with the given size of indentation and the tab string.
50 *
51 * @param ind size of indentation.
52 * @param tab tab string.
53 */
54 public Indent(int ind, String tab) {
55 this.indent = ind;
56 this.tab = tab;
57 }
58
59
60 /***
61 * toString method
62 * @return string
63 */
64 public String toString() {
65 StringBuffer buff = new StringBuffer();
66 for (int i = 0; i < indent; i++)
67 buff.append(tab);
68 return buff.toString();
69 }
70
71
72 /***
73 * Increments the indentation size.
74 */
75 public void increment() {
76 indent++;
77 }
78
79
80 /***
81 * Decrements the indentation size.
82 */
83 public void decrement() {
84 indent--;
85 }
86
87
88 /***
89 * Returns the tab string.
90 * @return tab
91 */
92 public String getTab() {
93 return tab;
94 }
95
96 /***
97 * Sets the tab string.
98 * @param tab is tab
99 */
100 public void setTab(String tab) {
101 this.tab = tab;
102 }
103
104 }
This page was automatically generated by Maven