| 1 |  |  | 
        
| 2 |  |  | 
        
| 3 |  |  | 
        
| 4 |  |  | 
        
| 5 |  |  | 
        
| 6 |  |  | 
        
| 7 |  |  | 
        
| 8 |  |  | 
        
| 9 |  |  | 
        
| 10 |  |  | 
        
| 11 |  |  | 
        
| 12 |  |  | 
        
| 13 |  |  | 
        
| 14 |  |  | 
        
| 15 |  |  | 
        
| 16 |  |  | 
        
| 17 |  |  | 
        
| 18 |  |  | 
        
| 19 |  |  | 
        
| 20 |  |  | 
        
| 21 |  |  | 
        
| 22 |  |  | 
        
| 23 |  |  | 
        
| 24 |  | package net.smartlab.web.page; | 
        
| 25 |  |  | 
        
| 26 |  | import java.util.Collection; | 
        
| 27 |  | import java.util.Iterator; | 
        
| 28 |  |  | 
        
| 29 |  |  | 
        
| 30 |  |  | 
        
| 31 |  |  | 
        
| 32 |  | @author | 
        
| 33 |  |  | 
           
        |  |  | 
           
           |  | 0% | Uncovered Elements: 38 (38) | Complexity: 18 | Complexity Density: 0,86 |  | 
  
| 34 |  | public class CollectionPaginator extends Paginator implements Collection { | 
        
| 35 |  |  | 
        
| 36 |  | private Collection collection; | 
        
| 37 |  |  | 
        
| 38 |  |  | 
        
| 39 |  |  | 
        
| 40 |  |  | 
        
| 41 |  | @param | 
        
| 42 |  |  | 
           
        |  |  | 
           
           |  | 0% | Uncovered Elements: 1 (1) | Complexity: 1 | Complexity Density: 1 |  | 
  
| 43 | 0 |  public CollectionPaginator(Collection collection) {... | 
        
| 44 | 0 | this(collection, 0); | 
        
| 45 |  | } | 
        
| 46 |  |  | 
        
| 47 |  |  | 
        
| 48 |  |  | 
        
| 49 |  |  | 
        
| 50 |  | @param | 
        
| 51 |  | @param | 
        
| 52 |  |  | 
           
        |  |  | 
           
           |  | 0% | Uncovered Elements: 1 (1) | Complexity: 1 | Complexity Density: 1 |  | 
  
| 53 | 0 |  public CollectionPaginator(Collection collection, int size) {... | 
        
| 54 | 0 | this(collection, size, Paginator.UNLIMITED_PAGES); | 
        
| 55 |  | } | 
        
| 56 |  |  | 
        
| 57 |  |  | 
        
| 58 |  |  | 
        
| 59 |  |  | 
        
| 60 |  | @param | 
        
| 61 |  | @param | 
        
| 62 |  | @param | 
        
| 63 |  |  | 
           
        |  |  | 
           
           |  | 0% | Uncovered Elements: 3 (3) | Complexity: 1 | Complexity Density: 0,33 |  | 
  
| 64 | 0 |  public CollectionPaginator(Collection collection, int size, int pages) {... | 
        
| 65 | 0 | super(size, pages); | 
        
| 66 | 0 | super.setCount(collection.size()); | 
        
| 67 | 0 | this.collection = collection; | 
        
| 68 |  | } | 
        
| 69 |  |  | 
        
| 70 |  |  | 
        
| 71 |  | @see | 
        
| 72 |  |  | 
           
        |  |  | 
           
           |  | 0% | Uncovered Elements: 3 (3) | Complexity: 2 | Complexity Density: 0,67 |  | 
  
| 73 | 0 |  protected void setArray() {... | 
        
| 74 | 0 | Object[] temp = collection.toArray(); | 
        
| 75 | 0 | try { | 
        
| 76 | 0 | java.lang.System.arraycopy(temp, (super.getPage() - 1) * array.length, array, 0, array.length); | 
        
| 77 |  | } catch (IndexOutOfBoundsException ioobe) { | 
        
| 78 |  | java.lang.System.arraycopy(temp, (super.getPage() - 1) * array.length, array, 0, collection.size() % array.length); | 
        
| 79 |  | array[collection.size() % array.length] = null; | 
        
| 80 |  | } | 
        
| 81 |  | } | 
        
| 82 |  |  | 
        
| 83 |  |  | 
        
| 84 |  | @see | 
        
| 85 |  |  | 
           
        |  |  | 
           
           |  | 0% | Uncovered Elements: 1 (1) | Complexity: 1 | Complexity Density: 1 |  | 
  
| 86 | 0 |  public int size() {... | 
        
| 87 | 0 | return collection.size(); | 
        
| 88 |  | } | 
        
| 89 |  |  | 
        
| 90 |  |  | 
        
| 91 |  | @see | 
        
| 92 |  |  | 
           
        |  |  | 
           
           |  | 0% | Uncovered Elements: 1 (1) | Complexity: 1 | Complexity Density: 1 |  | 
  
| 93 | 0 |  public void clear() {... | 
        
| 94 | 0 | collection.clear(); | 
        
| 95 |  | } | 
        
| 96 |  |  | 
        
| 97 |  |  | 
        
| 98 |  | @see | 
        
| 99 |  |  | 
           
        |  |  | 
           
           |  | 0% | Uncovered Elements: 1 (1) | Complexity: 1 | Complexity Density: 1 |  | 
  
| 100 | 0 |  public boolean isEmpty() {... | 
        
| 101 | 0 | return collection.isEmpty(); | 
        
| 102 |  | } | 
        
| 103 |  |  | 
        
| 104 |  |  | 
        
| 105 |  | @see | 
        
| 106 |  |  | 
           
        |  |  | 
           
           |  | 0% | Uncovered Elements: 1 (1) | Complexity: 1 | Complexity Density: 1 |  | 
  
| 107 | 0 |  public Object[] toArray() {... | 
        
| 108 | 0 | return this.array; | 
        
| 109 |  | } | 
        
| 110 |  |  | 
        
| 111 |  |  | 
        
| 112 |  | @see | 
        
| 113 |  |  | 
           
        |  |  | 
           
           |  | 0% | Uncovered Elements: 1 (1) | Complexity: 1 | Complexity Density: 1 |  | 
  
| 114 | 0 |  public boolean add(Object o) {... | 
        
| 115 | 0 | return collection.add(o); | 
        
| 116 |  | } | 
        
| 117 |  |  | 
        
| 118 |  |  | 
        
| 119 |  | @see | 
        
| 120 |  |  | 
           
        |  |  | 
           
           |  | 0% | Uncovered Elements: 1 (1) | Complexity: 1 | Complexity Density: 1 |  | 
  
| 121 | 0 |  public boolean contains(Object o) {... | 
        
| 122 | 0 | return collection.contains(o); | 
        
| 123 |  | } | 
        
| 124 |  |  | 
        
| 125 |  |  | 
        
| 126 |  | @see | 
        
| 127 |  |  | 
           
        |  |  | 
           
           |  | 0% | Uncovered Elements: 1 (1) | Complexity: 1 | Complexity Density: 1 |  | 
  
| 128 | 0 |  public boolean remove(Object o) {... | 
        
| 129 | 0 | return collection.remove(o); | 
        
| 130 |  | } | 
        
| 131 |  |  | 
        
| 132 |  |  | 
        
| 133 |  | @see | 
        
| 134 |  |  | 
           
        |  |  | 
           
           |  | 0% | Uncovered Elements: 1 (1) | Complexity: 1 | Complexity Density: 1 |  | 
  
| 135 | 0 |  public boolean addAll(Collection c) {... | 
        
| 136 | 0 | return collection.addAll(c); | 
        
| 137 |  | } | 
        
| 138 |  |  | 
        
| 139 |  |  | 
        
| 140 |  | @see | 
        
| 141 |  |  | 
           
        |  |  | 
           
           |  | 0% | Uncovered Elements: 1 (1) | Complexity: 1 | Complexity Density: 1 |  | 
  
| 142 | 0 |  public boolean containsAll(Collection c) {... | 
        
| 143 | 0 | return collection.containsAll(c); | 
        
| 144 |  | } | 
        
| 145 |  |  | 
        
| 146 |  |  | 
        
| 147 |  | @see | 
        
| 148 |  |  | 
           
        |  |  | 
           
           |  | 0% | Uncovered Elements: 1 (1) | Complexity: 1 | Complexity Density: 1 |  | 
  
| 149 | 0 |  public boolean removeAll(Collection c) {... | 
        
| 150 | 0 | return collection.removeAll(c); | 
        
| 151 |  | } | 
        
| 152 |  |  | 
        
| 153 |  |  | 
        
| 154 |  | @see | 
        
| 155 |  |  | 
           
        |  |  | 
           
           |  | 0% | Uncovered Elements: 1 (1) | Complexity: 1 | Complexity Density: 1 |  | 
  
| 156 | 0 |  public boolean retainAll(Collection c) {... | 
        
| 157 | 0 | return collection.retainAll(c); | 
        
| 158 |  | } | 
        
| 159 |  |  | 
        
| 160 |  |  | 
        
| 161 |  | @see | 
        
| 162 |  |  | 
           
        |  |  | 
           
           |  | 0% | Uncovered Elements: 1 (1) | Complexity: 1 | Complexity Density: 1 |  | 
  
| 163 | 0 |  public Iterator iterator() {... | 
        
| 164 | 0 | return this; | 
        
| 165 |  | } | 
        
| 166 |  |  | 
        
| 167 |  |  | 
        
| 168 |  | @see | 
        
| 169 |  |  | 
           
        |  |  | 
           
           |  | 0% | Uncovered Elements: 1 (1) | Complexity: 1 | Complexity Density: 1 |  | 
  
| 170 | 0 |  public Object[] toArray(Object[] a) {... | 
        
| 171 | 0 | throw new UnsupportedOperationException(); | 
        
| 172 |  | } | 
        
| 173 |  |  | 
        
| 174 |  | } |