public FetcherImpl(IBrowser browser, InitialPageCallback initialPageCallback, Callable<Integer> counter) { this.browser = browser; this.counter = counter; this.initialPageCallback = initialPageCallback; this.pageSize = initialPageCallback.getPageSize(); }
private ResultPage fetchInitialPageIfNecessary() throws BrowseException { ResultPage result = null; if (! initialized) { DataResponse resp = initialPageCallback.fetchPage(); cookie = resp.getCookie(); if (resp.getEstimatedCount()>=0) { this.count = resp.getEstimatedCount(); } initialized = true; result = new ResultPageImpl(resp.getPage()); } return result; }
/** * Returns true iff initial page may match fetch request. * @param dir * @param limit * @param skip * @return */ private boolean initialPageMatchesFetchRequest(Page dir, int skip) { return pageSize==initialPageCallback.getPageSize() && skip==0 && (dir==Page.CURRENT || dir==Page.FIRST); }