Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
FormatType |
|
| 1.6;1.6 |
1 | /** | |
2 | * Distribution License: | |
3 | * JSword is free software; you can redistribute it and/or modify it under | |
4 | * the terms of the GNU Lesser General Public License, version 2.1 or later | |
5 | * as published by the Free Software Foundation. This program is distributed | |
6 | * in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even | |
7 | * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | |
8 | * See the GNU Lesser General Public License for more details. | |
9 | * | |
10 | * The License is available on the internet at: | |
11 | * http://www.gnu.org/copyleft/lgpl.html | |
12 | * or by writing to: | |
13 | * Free Software Foundation, Inc. | |
14 | * 59 Temple Place - Suite 330 | |
15 | * Boston, MA 02111-1307, USA | |
16 | * | |
17 | * © CrossWire Bible Society, 2005 - 2016 | |
18 | * | |
19 | */ | |
20 | package org.crosswire.common.xml; | |
21 | ||
22 | /** | |
23 | * The PrettySerializingContentHandler uses a FormatType to control its output. | |
24 | * | |
25 | * @see gnu.lgpl.License The GNU Lesser General Public License for details. | |
26 | * @author DM Smith | |
27 | */ | |
28 | 0 | public enum FormatType { |
29 | 0 | AS_IS (false, false, false), |
30 | 0 | ANALYSIS (true, false, false), |
31 | 0 | CLASSIC (true, false, true), |
32 | 0 | ANALYSIS_INDENT (true, true, false), |
33 | 0 | CLASSIC_INDENT (true, true, true); |
34 | ||
35 | /** | |
36 | * Simple ctor | |
37 | */ | |
38 | 0 | FormatType(boolean displayNewlines, boolean doIndenting, boolean classicLines) { |
39 | 0 | multiline = displayNewlines; |
40 | // the following are true only if we add newlines. | |
41 | 0 | indented = doIndenting && multiline; |
42 | 0 | classic = classicLines && multiline; |
43 | 0 | analytic = !classicLines && multiline; |
44 | 0 | } |
45 | ||
46 | /** | |
47 | * Whether newlines are introduced into the document. | |
48 | * | |
49 | * @return true if newlines are added to the document | |
50 | */ | |
51 | public boolean isMultiline() { | |
52 | 0 | return multiline; |
53 | } | |
54 | ||
55 | /** | |
56 | * Whether indents are introduced into the document. | |
57 | * | |
58 | * @return true if indents are added to the document | |
59 | */ | |
60 | public boolean isIndented() { | |
61 | 0 | return indented; |
62 | } | |
63 | ||
64 | /** | |
65 | * Whether added whitespace is inside tags. Note, this does not change the | |
66 | * document. | |
67 | * | |
68 | * @return true if whitespace is added inside tags of document | |
69 | */ | |
70 | public boolean isAnalytic() { | |
71 | 0 | return analytic; |
72 | } | |
73 | ||
74 | /** | |
75 | * Whether added whitespace is between tags. Note, this does change the | |
76 | * document as whitespace is added to either side of existing text. | |
77 | * | |
78 | * @return true if whitespace is added inside tags of document | |
79 | */ | |
80 | public boolean isClassic() { | |
81 | 0 | return classic; |
82 | } | |
83 | ||
84 | private boolean indented; | |
85 | private boolean multiline; | |
86 | private boolean analytic; | |
87 | private boolean classic; | |
88 | } |