/// <summary> /// handles the processing based on the traversal method chosen /// and sends it to the contexts state /// </summary> /// <param name="states"></param> /// <param name="cache"></param> /// <param name="page"></param> /// <param name="links"></param> private void addWebpageUrlsToQueue(WebCache cache, WebPage page, Queue <string> webpageUrls, Queue <string> imageUrls) { bool isAddable = false; if (traversalStyle == TraversalStyle.STRICT_RELEVANCE_SEARCH) { if (page.getSearchPhraseCount() > 0 || page.getSearchTokensCount() > 0) { isAddable = true; } } else { isAddable = true; } if (isAddable) { // check that the urls have not been seen cache.tryDepositingUrlsToQueue(webpageUrls); // enqueue the non seen urls tryDepositingUrlsToQueue(cache.releaseUrlsToVisit()); // send images to ui tryEnqueueImagesToUI(imageUrls); } }
private void initQueue(WebCache cache, string url) { cache.tryAddingToQueue(url); sharedSearchContext.tryDepositingUrlsToQueue(cache.releaseUrlsToVisit()); }