1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
package org.xwiki.rendering.xdomxml10.internal.renderer.parameter; |
21 |
|
|
22 |
|
import java.util.HashMap; |
23 |
|
import java.util.Map; |
24 |
|
|
25 |
|
import org.xwiki.rendering.listener.Format; |
26 |
|
|
|
|
| 69.2% |
Uncovered Elements: 8 (26) |
Complexity: 6 |
Complexity Density: 0.33 |
|
27 |
|
public class FormatConverter |
28 |
|
{ |
29 |
|
private static final Map<String, Format> STRINGTOFORMAT = new HashMap<String, Format>() |
30 |
|
{ |
|
|
| 100% |
Uncovered Elements: 0 (8) |
Complexity: 1 |
Complexity Density: 0.12 |
|
31 |
1 |
{... |
32 |
1 |
put("bold", Format.BOLD); |
33 |
1 |
put("italic", Format.ITALIC); |
34 |
1 |
put("underlined", Format.UNDERLINED); |
35 |
1 |
put("strikeout", Format.STRIKEDOUT); |
36 |
1 |
put("superscript", Format.SUPERSCRIPT); |
37 |
1 |
put("subscript", Format.SUBSCRIPT); |
38 |
1 |
put("monospace", Format.MONOSPACE); |
39 |
1 |
put("none", Format.NONE); |
40 |
|
} |
41 |
|
}; |
42 |
|
|
43 |
|
private static final Map<Format, String> FORMATTOSTRING = new HashMap<Format, String>() |
44 |
|
{ |
|
|
| 100% |
Uncovered Elements: 0 (8) |
Complexity: 1 |
Complexity Density: 0.12 |
|
45 |
1 |
{... |
46 |
1 |
put(Format.BOLD, "bold"); |
47 |
1 |
put(Format.ITALIC, "italic"); |
48 |
1 |
put(Format.UNDERLINED, "underlined"); |
49 |
1 |
put(Format.STRIKEDOUT, "strikeout"); |
50 |
1 |
put(Format.SUPERSCRIPT, "superscript"); |
51 |
1 |
put(Format.SUBSCRIPT, "subscript"); |
52 |
1 |
put(Format.MONOSPACE, "monospace"); |
53 |
1 |
put(Format.NONE, "none"); |
54 |
|
} |
55 |
|
}; |
56 |
|
|
|
|
| 0% |
Uncovered Elements: 3 (3) |
Complexity: 2 |
Complexity Density: 2 |
|
57 |
0 |
public Format toFormat(String str)... |
58 |
|
{ |
59 |
0 |
return STRINGTOFORMAT.containsKey(str) ? STRINGTOFORMAT.get(str) : Format.NONE; |
60 |
|
} |
61 |
|
|
|
|
| 0% |
Uncovered Elements: 3 (3) |
Complexity: 2 |
Complexity Density: 2 |
|
62 |
0 |
public String toString(Format format)... |
63 |
|
{ |
64 |
0 |
return FORMATTOSTRING.containsKey(format) ? FORMATTOSTRING.get(format) : FORMATTOSTRING.get(Format.NONE); |
65 |
|
} |
66 |
|
} |