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

File CollectionIterableResult.java

 

Coverage histogram

../../../../../img/srcFileCovDistChart10.png
0% of files have more coverage

Code metrics

0
4
3
1
62
22
3
0.75
1.33
3
1

Classes

Class Line # Actions
CollectionIterableResult 32 4 0% 3 0
1.0100%
 

Contributing tests

This file is covered by 19 tests. .

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.extension.repository.result;
21   
22    import java.util.Collection;
23    import java.util.Iterator;
24   
25    /**
26    * A simple collection based {@link IterableResult}.
27    *
28    * @param <T> the type
29    * @version $Id: 9a5c9821d8d79b7cead8a15db63427d93e8e9e8f $
30    * @since 4.0M1
31    */
 
32    public class CollectionIterableResult<T> extends AbstractSearchResult<T>
33    {
34    /**
35    * The wrapped result.
36    */
37    private Collection<T> result;
38   
39    /**
40    * @param totalHits the total number of possible results without offset or maximum results limits
41    * @param offset the index in the total number of possible search result where this extract starts
42    * @param result the actual results
43    */
 
44  199 toggle public CollectionIterableResult(int totalHits, int offset, Collection<T> result)
45    {
46  199 super(totalHits, offset);
47   
48  199 this.result = result;
49    }
50   
 
51  187 toggle @Override
52    public Iterator<T> iterator()
53    {
54  187 return this.result.iterator();
55    }
56   
 
57  93 toggle @Override
58    public int getSize()
59    {
60  93 return this.result.size();
61    }
62    }