1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
package com.xpn.xwiki.render; |
21 |
|
|
22 |
|
import org.apache.oro.text.regex.MatchResult; |
23 |
|
import org.apache.oro.text.regex.Pattern; |
24 |
|
import org.apache.oro.text.regex.PatternMatcher; |
25 |
|
import org.apache.oro.text.regex.PatternMatcherInput; |
26 |
|
import org.apache.oro.text.regex.Perl5Matcher; |
27 |
|
import org.apache.oro.text.regex.Perl5Substitution; |
28 |
|
|
29 |
|
import com.xpn.xwiki.util.Util; |
30 |
|
|
|
|
| 0% |
Uncovered Elements: 34 (34) |
Complexity: 15 |
Complexity Density: 0.79 |
|
31 |
|
public class WikiSubstitution extends Perl5Substitution |
32 |
|
{ |
33 |
|
|
34 |
|
private Pattern pattern; |
35 |
|
|
36 |
|
private Util util; |
37 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
38 |
0 |
public WikiSubstitution(com.xpn.xwiki.util.Util util)... |
39 |
|
{ |
40 |
0 |
setUtil(util); |
41 |
0 |
setSubstitution("$&"); |
42 |
|
} |
43 |
|
|
|
|
| 0% |
Uncovered Elements: 3 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
44 |
0 |
public WikiSubstitution(Util util, String patternparam)... |
45 |
|
{ |
46 |
0 |
setUtil(util); |
47 |
0 |
setPattern(makePattern(patternparam)); |
48 |
0 |
setSubstitution("$&"); |
49 |
|
} |
50 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
51 |
0 |
public WikiSubstitution(Util util, String[] patternparam)... |
52 |
|
{ |
53 |
0 |
this.setPattern(Util.getPatterns().getPattern(makePattern(patternparam))); |
54 |
0 |
setSubstitution("$&"); |
55 |
|
} |
56 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
57 |
0 |
public void setPattern(String patternparam)... |
58 |
|
{ |
59 |
0 |
setPattern(Util.getPatterns().getPattern(makePattern(patternparam))); |
60 |
|
} |
61 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
62 |
0 |
public void setPattern(String patternparam, int options)... |
63 |
|
{ |
64 |
0 |
setPattern(Util.getPatterns().getPattern(makePattern(patternparam), options)); |
65 |
|
} |
66 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
67 |
0 |
public String makePattern(String patternparam)... |
68 |
|
{ |
69 |
0 |
return patternparam; |
70 |
|
} |
71 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
72 |
0 |
public String makePattern(String[] patternparam)... |
73 |
|
{ |
74 |
0 |
return patternparam.toString(); |
75 |
|
} |
76 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
77 |
0 |
public String substitute(String line)... |
78 |
|
{ |
79 |
0 |
return org.apache.oro.text.regex.Util.substitute(getMatcher(), getPattern(), this, line, |
80 |
|
org.apache.oro.text.regex.Util.SUBSTITUTE_ALL); |
81 |
|
} |
82 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
83 |
0 |
public Perl5Matcher getMatcher()... |
84 |
|
{ |
85 |
0 |
return this.util.getMatcher(); |
86 |
|
} |
87 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
88 |
0 |
public Pattern getPattern()... |
89 |
|
{ |
90 |
0 |
return this.pattern; |
91 |
|
} |
92 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
93 |
0 |
public void setPattern(Pattern pattern)... |
94 |
|
{ |
95 |
0 |
this.pattern = pattern; |
96 |
|
} |
97 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
98 |
0 |
@Override... |
99 |
|
public void appendSubstitution(StringBuffer stringBuffer, MatchResult matchResult, int i, |
100 |
|
PatternMatcherInput minput, PatternMatcher patternMatcher, Pattern pattern) |
101 |
|
{ |
102 |
0 |
prepareSubstitution(matchResult); |
103 |
0 |
super.appendSubstitution(stringBuffer, matchResult, i, minput, patternMatcher, pattern); |
104 |
|
} |
105 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
106 |
0 |
public void prepareSubstitution(MatchResult matchResult)... |
107 |
|
{ |
108 |
|
} |
109 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
110 |
0 |
public com.xpn.xwiki.util.Util getUtil()... |
111 |
|
{ |
112 |
0 |
return this.util; |
113 |
|
} |
114 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
115 |
0 |
public void setUtil(com.xpn.xwiki.util.Util util)... |
116 |
|
{ |
117 |
0 |
this.util = util; |
118 |
|
} |
119 |
|
} |