1. Project Clover database Tue Dec 20 2016 21:24:09 CET
  2. Package org.xwiki.tree

File AbstractTreeNode.java

 

Coverage histogram

../../../img/srcFileCovDistChart6.png
69% of files have more coverage

Code metrics

2
10
6
1
86
48
7
0.7
1.67
6
1.17

Classes

Class Line # Actions
AbstractTreeNode 40 10 0% 7 8
0.555555655.6%
 

Contributing tests

No tests hitting this source file were found.

Source view

1    /*
2    * See the NOTICE file distributed with this work for additional
3    * information regarding copyright ownership.
4    *
5    * This is free software; you can redistribute it and/or modify it
6    * under the terms of the GNU Lesser General Public License as
7    * published by the Free Software Foundation; either version 2.1 of
8    * the License, or (at your option) any later version.
9    *
10    * This software is distributed in the hope that it will be useful,
11    * but WITHOUT ANY WARRANTY; without even the implied warranty of
12    * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13    * Lesser General Public License for more details.
14    *
15    * You should have received a copy of the GNU Lesser General Public
16    * License along with this software; if not, write to the Free
17    * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
18    * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
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    * Base class for representing a node in a tree structure.
34    *
35    * @version $Id: 0d6b8ecd9b4358b3f9b1dee909adcbf51d4cb5ed $
36    * @since 8.3M2
37    * @since 7.4.5
38    */
39    @Unstable
 
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   
 
47  0 toggle @Override
48    public List<String> getChildren(String nodeId, int offset, int limit)
49    {
50  0 return Collections.emptyList();
51    }
52   
 
53  0 toggle @Override
54    public int getChildCount(String nodeId)
55    {
56  0 return 0;
57    }
58   
 
59  0 toggle @Override
60    public String getParent(String nodeId)
61    {
62  0 return null;
63    }
64   
 
65  984 toggle @Override
66    public Map<String, Object> getProperties()
67    {
68  984 return this.properties;
69    }
70   
 
71  11 toggle protected String getOrderBy()
72    {
73  11 return (String) getProperties().get(PROPERTY_ORDER_BY);
74    }
75   
 
76  1 toggle 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    }