Coverage Report - net.spy.digg.PagedItems
 
Classes in this File Line Coverage Branch Coverage Complexity
PagedItems
0%
0/15
N/A
0
 
 1  
 package net.spy.digg;
 2  
 
 3  
 import java.util.ArrayList;
 4  
 import java.util.Collection;
 5  
 
 6  
 import net.spy.digg.parsers.PagedItemParser;
 7  
 
 8  
 /**
 9  
  * A collection of paged items.
 10  
  *
 11  
  * @param <T> the type of item.
 12  
  */
 13  
 public class PagedItems<T> extends ArrayList<T> {
 14  
 
 15  
         private final long timestamp;
 16  
         private final int total;
 17  
         private final int offset;
 18  
         private final int count;
 19  
 
 20  
         PagedItems(PagedItemParser<T> p) {
 21  0
                 this(p.getItems(), p.getTimestamp(), p.getTotal(), p.getOffset(),
 22  
                         p.getCount());
 23  0
         }
 24  
 
 25  
         PagedItems(Collection<T> c) {
 26  0
                 this(c, 0, 0, 0, 0);
 27  0
         }
 28  
 
 29  
         PagedItems(Collection<T> c, long ts, int t, int o, int cnt) {
 30  0
                 super(c);
 31  0
                 timestamp=ts;
 32  0
                 total=t;
 33  0
                 offset=o;
 34  0
                 count=cnt;
 35  0
         }
 36  
 
 37  
         /**
 38  
          * Get the number of items returned.
 39  
          */
 40  
         public int getCount() {
 41  0
                 return count;
 42  
         }
 43  
         /**
 44  
          * Get the offset from which this PagedItems began.
 45  
          */
 46  
         public int getOffset() {
 47  0
                 return offset;
 48  
         }
 49  
         /**
 50  
          * Get the timestamp at which the results were created.
 51  
          */
 52  
         public long getTimestamp() {
 53  0
                 return timestamp;
 54  
         }
 55  
         /**
 56  
          * Get the total number of items for this search.
 57  
          */
 58  
         public int getTotal() {
 59  0
                 return total;
 60  
         }
 61  
 
 62  
         @Override
 63  
         public String toString() {
 64  0
                 return "{PagedItems total=" + total + " offset=" + offset + " "
 65  
                         + super.toString() + "}";
 66  
         }
 67  
 }