1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
package org.xwiki.rendering.syntax; |
21 |
|
|
22 |
|
import org.apache.commons.lang3.builder.CompareToBuilder; |
23 |
|
import org.apache.commons.lang3.builder.EqualsBuilder; |
24 |
|
import org.apache.commons.lang3.builder.HashCodeBuilder; |
25 |
|
|
26 |
|
|
27 |
|
|
28 |
|
|
29 |
|
|
30 |
|
|
31 |
|
@version |
32 |
|
@since |
33 |
|
|
|
|
| 78.4% |
Uncovered Elements: 8 (37) |
Complexity: 14 |
Complexity Density: 0.74 |
|
34 |
|
public class Syntax implements Comparable<Syntax> |
35 |
|
{ |
36 |
|
|
37 |
|
|
38 |
|
|
39 |
|
@since |
40 |
|
|
41 |
|
public static final Syntax HTML_5_0 = new Syntax(SyntaxType.HTML, "5.0"); |
42 |
|
|
43 |
|
public static final Syntax XHTML_1_0 = new Syntax(SyntaxType.XHTML, "1.0"); |
44 |
|
|
45 |
|
public static final Syntax HTML_4_01 = new Syntax(SyntaxType.HTML, "4.01"); |
46 |
|
|
47 |
|
|
48 |
|
@deprecated |
49 |
|
|
50 |
|
@Deprecated |
51 |
|
public static final Syntax XWIKI_1_0 = new Syntax(SyntaxType.XWIKI, "1.0"); |
52 |
|
|
53 |
|
public static final Syntax XWIKI_2_0 = new Syntax(SyntaxType.XWIKI, "2.0"); |
54 |
|
|
55 |
|
public static final Syntax XWIKI_2_1 = new Syntax(SyntaxType.XWIKI, "2.1"); |
56 |
|
|
57 |
|
public static final Syntax PLAIN_1_0 = new Syntax(SyntaxType.PLAIN, "1.0"); |
58 |
|
|
59 |
|
public static final Syntax EVENT_1_0 = new Syntax(SyntaxType.EVENT, "1.0"); |
60 |
|
|
61 |
|
public static final Syntax TEX_1_0 = new Syntax(SyntaxType.TEX, "1.0"); |
62 |
|
|
63 |
|
public static final Syntax CREOLE_1_0 = new Syntax(SyntaxType.CREOLE, "1.0"); |
64 |
|
|
65 |
|
public static final Syntax JSPWIKI_1_0 = new Syntax(SyntaxType.JSPWIKI, "1.0"); |
66 |
|
|
67 |
|
public static final Syntax MEDIAWIKI_1_0 = new Syntax(SyntaxType.MEDIAWIKI, "1.0"); |
68 |
|
|
69 |
|
public static final Syntax TWIKI_1_0 = new Syntax(SyntaxType.TWIKI, "1.0"); |
70 |
|
|
71 |
|
public static final Syntax DOCBOOK_4_4 = new Syntax(SyntaxType.DOCBOOK, "4.4"); |
72 |
|
|
73 |
|
|
74 |
|
|
75 |
|
|
76 |
|
public static final Syntax CONFLUENCE_1_0 = new Syntax(SyntaxType.CONFLUENCE, "1.0"); |
77 |
|
|
78 |
|
|
79 |
|
|
80 |
|
|
81 |
|
@since |
82 |
|
|
83 |
|
public static final Syntax CONFLUENCEXHTML_1_0 = new Syntax(SyntaxType.CONFLUENCEXHTML, "1.0"); |
84 |
|
|
85 |
|
|
86 |
|
@since |
87 |
|
|
88 |
|
public static final Syntax XDOMXML_CURRENT = new Syntax(SyntaxType.XDOMXML, "current"); |
89 |
|
|
90 |
|
|
91 |
|
@since |
92 |
|
|
93 |
|
public static final Syntax XDOMXML_1_0 = new Syntax(SyntaxType.XDOMXML, "1.0"); |
94 |
|
|
95 |
|
|
96 |
|
@since |
97 |
|
|
98 |
|
public static final Syntax MARKDOWN_1_0 = new Syntax(SyntaxType.MARKDOWN, "1.0"); |
99 |
|
|
100 |
|
|
101 |
|
@since |
102 |
|
|
103 |
|
public static final Syntax MARKDOWN_1_1 = new Syntax(SyntaxType.MARKDOWN, "1.1"); |
104 |
|
|
105 |
|
|
106 |
|
@since |
107 |
|
|
108 |
|
public static final Syntax APT_1_0 = new Syntax(SyntaxType.APT, "1.0"); |
109 |
|
|
110 |
|
|
111 |
|
|
112 |
|
|
113 |
|
|
114 |
|
public static final Syntax ANNOTATED_XHTML_1_0 = new Syntax(SyntaxType.ANNOTATED_XHTML, "1.0"); |
115 |
|
|
116 |
|
|
117 |
|
|
118 |
|
|
119 |
|
|
120 |
|
public static final Syntax ANNOTATED_HTML_5_0 = new Syntax(SyntaxType.ANNOTATED_HTML, "5.0"); |
121 |
|
|
122 |
|
private SyntaxType type; |
123 |
|
|
124 |
|
private String version; |
125 |
|
|
126 |
|
|
127 |
|
|
128 |
|
|
129 |
|
private String qualifier; |
130 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
131 |
39373 |
public Syntax(SyntaxType type, String version)... |
132 |
|
{ |
133 |
39367 |
this.type = type; |
134 |
39368 |
this.version = version; |
135 |
|
} |
136 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
137 |
0 |
public Syntax(SyntaxType type, String version, String qualifier)... |
138 |
|
{ |
139 |
0 |
this(type, version); |
140 |
0 |
this.qualifier = qualifier; |
141 |
|
} |
142 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
143 |
524118 |
public SyntaxType getType()... |
144 |
|
{ |
145 |
524120 |
return this.type; |
146 |
|
} |
147 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
148 |
465792 |
public String getVersion()... |
149 |
|
{ |
150 |
465793 |
return this.version; |
151 |
|
} |
152 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
153 |
20689 |
public String getQualifier()... |
154 |
|
{ |
155 |
20693 |
return this.qualifier; |
156 |
|
} |
157 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
158 |
444547 |
public String toIdString()... |
159 |
|
{ |
160 |
444551 |
return getType().getId() + "/" + getVersion().toLowerCase(); |
161 |
|
} |
162 |
|
|
|
|
| 66.7% |
Uncovered Elements: 1 (3) |
Complexity: 2 |
Complexity Density: 2 |
|
163 |
5455 |
@Override... |
164 |
|
public String toString() |
165 |
|
{ |
166 |
5455 |
return getType().toString() + " " + getVersion() + (getQualifier() != null ? " (" + getQualifier() + ")" : ""); |
167 |
|
} |
168 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
169 |
9 |
@Override... |
170 |
|
public int hashCode() |
171 |
|
{ |
172 |
9 |
return new HashCodeBuilder(5, 7) |
173 |
|
.append(getType()) |
174 |
|
.append(getVersion()) |
175 |
|
.append(getQualifier()) |
176 |
|
.toHashCode(); |
177 |
|
} |
178 |
|
|
|
|
| 71.4% |
Uncovered Elements: 4 (14) |
Complexity: 4 |
Complexity Density: 0.5 |
|
179 |
7697 |
@Override... |
180 |
|
public boolean equals(Object object) |
181 |
|
{ |
182 |
7697 |
if (object == null) { |
183 |
0 |
return false; |
184 |
|
} |
185 |
7697 |
if (object == this) { |
186 |
83 |
return true; |
187 |
|
} |
188 |
7616 |
if (object.getClass() != getClass()) { |
189 |
0 |
return false; |
190 |
|
} |
191 |
7616 |
Syntax rhs = (Syntax) object; |
192 |
7617 |
return new EqualsBuilder() |
193 |
|
.append(getType(), rhs.getType()) |
194 |
|
.append(getVersion(), rhs.getVersion()) |
195 |
|
.append(getQualifier(), rhs.getQualifier()) |
196 |
|
.isEquals(); |
197 |
|
} |
198 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
199 |
3 |
@Override... |
200 |
|
public int compareTo(Syntax syntax) |
201 |
|
{ |
202 |
3 |
return new CompareToBuilder() |
203 |
|
.append(getType(), syntax.getType()) |
204 |
|
|
205 |
|
.append(getVersion(), syntax.getVersion()) |
206 |
|
.toComparison(); |
207 |
|
} |
208 |
|
} |