1 40 package org.dspace.browse; 41 42 import java.util.Collections ; 43 import java.util.List ; 44 45 import org.dspace.content.Item; 46 47 73 public class BrowseInfo 74 { 75 78 private List results; 79 80 84 private int overallPosition; 85 86 90 private int offset; 91 92 95 private int total; 96 97 100 private boolean cached; 101 102 114 public BrowseInfo(List results, int overallPosition, int total, int offset) 115 { 116 if (results == null) 117 { 118 throw new IllegalArgumentException ("Null result list not allowed"); 119 } 120 121 this.results = Collections.unmodifiableList(results); 122 this.overallPosition = overallPosition; 123 this.total = total; 124 this.offset = offset; 125 } 126 127 134 public List getResults() 135 { 136 return results; 137 } 138 139 144 public String [] getStringResults() 145 { 146 return (String []) results.toArray(new String [results.size()]); 147 } 148 149 154 public Item[] getItemResults() 155 { 156 return (Item[]) results.toArray(new Item[results.size()]); 157 } 158 159 164 public int getResultCount() 165 { 166 return results.size(); 167 } 168 169 175 public int getOverallPosition() 176 { 177 return overallPosition; 178 } 179 180 185 public int getTotal() 186 { 187 return total; 188 } 189 190 195 public int getOffset() 196 { 197 return offset; 198 } 199 200 205 public boolean isFirst() 206 { 207 return overallPosition == 0; 208 } 209 210 215 public boolean isLast() 216 { 217 return (overallPosition + getResultCount()) == total; 218 } 219 220 223 public boolean wasCached() 224 { 225 return cached; 226 } 227 228 231 void setCached(boolean cached) 232 { 233 this.cached = cached; 234 } 235 } 236 | Popular Tags |