1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
package org.xwiki.tree; |
21 |
|
|
22 |
|
import java.util.Collections; |
23 |
|
import java.util.HashMap; |
24 |
|
import java.util.List; |
25 |
|
import java.util.Map; |
26 |
|
|
27 |
|
import javax.inject.Inject; |
28 |
|
|
29 |
|
import org.slf4j.Logger; |
30 |
|
import org.xwiki.stability.Unstable; |
31 |
|
|
32 |
|
|
33 |
|
|
34 |
|
|
35 |
|
@version |
36 |
|
@since |
37 |
|
@since |
38 |
|
|
39 |
|
@Unstable |
|
|
| 55.6% |
Uncovered Elements: 8 (18) |
Complexity: 7 |
Complexity Density: 0.7 |
|
40 |
|
public abstract class AbstractTreeNode implements TreeNode |
41 |
|
{ |
42 |
|
@Inject |
43 |
|
protected Logger logger; |
44 |
|
|
45 |
|
private final Map<String, Object> properties = new HashMap<String, Object>(); |
46 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
47 |
0 |
@Override... |
48 |
|
public List<String> getChildren(String nodeId, int offset, int limit) |
49 |
|
{ |
50 |
0 |
return Collections.emptyList(); |
51 |
|
} |
52 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
53 |
0 |
@Override... |
54 |
|
public int getChildCount(String nodeId) |
55 |
|
{ |
56 |
0 |
return 0; |
57 |
|
} |
58 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
59 |
0 |
@Override... |
60 |
|
public String getParent(String nodeId) |
61 |
|
{ |
62 |
0 |
return null; |
63 |
|
} |
64 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
65 |
984 |
@Override... |
66 |
|
public Map<String, Object> getProperties() |
67 |
|
{ |
68 |
984 |
return this.properties; |
69 |
|
} |
70 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
71 |
11 |
protected String getOrderBy()... |
72 |
|
{ |
73 |
11 |
return (String) getProperties().get(PROPERTY_ORDER_BY); |
74 |
|
} |
75 |
|
|
|
|
| 71.4% |
Uncovered Elements: 2 (7) |
Complexity: 2 |
Complexity Density: 0.4 |
|
76 |
1 |
protected <E> List<E> subList(List<E> list, int offset, int limit)... |
77 |
|
{ |
78 |
1 |
if (list == null) { |
79 |
0 |
return Collections.emptyList(); |
80 |
|
} |
81 |
|
|
82 |
1 |
int start = Math.min(Math.max(offset, 0), list.size()); |
83 |
1 |
int end = Math.max(Math.min(start + limit, list.size()), start); |
84 |
1 |
return list.subList(start, end); |
85 |
|
} |
86 |
|
} |