Need a unique gift idea?
A Pastebin account makes a great Christmas gift
SHARE
TWEET

Untitled

a guest Nov 18th, 2018 76 Never
Upgrade to PRO!
ENDING IN00days00hours00mins00secs
 
  1.  
  2. package simulator2;
  3. import java.util.*;
  4.  
  5. public class SpiderTest{
  6.    
  7.     public static void main(String[] args){
  8.  
  9.         Spider spider = new Spider();
  10.         SpiderLeg leg = new SpiderLeg();
  11.         Scanner in = new Scanner(System.in);
  12.  
  13.         System.out.println("Enter the URL to search (Start with http://): "); // Sorts the 30 urls and asks the user if he wants to search more words or not or not
  14.         do{
  15.             String s = in.nextLine();
  16.             System.out.println("Enter the keyword to search: ");
  17.             String s1 = in.nextLine();
  18.             spider.search(s, s1);
  19.             spider.theUrls.clear();
  20.             spider.pagesToVisit.clear();
  21.             spider.pagesVisited.clear();
  22.             System.out.println("\n\nEnter any number to proceed or enter another URL to search a keyword from: ");
  23.         }
  24.         while (!(in.hasNextInt()));
  25.            
  26.         spider.uniqueKeywords();
  27.         String s3  = spider.keywords.get(0); // gets the most searched word
  28.         Scanner in2 = new Scanner(System.in);
  29.         spider.search("https://en.wikipedia.org/wiki/Dog", s3); // searches the keyword again to perform the BST operations
  30.         BinarySearchTree bst = new BinarySearchTree();
  31.         spider.createTree(); // creates the tree
  32.        
  33.         System.out.println("\n\nSearching by the Page Rank: ");// Searching method of a URL by its Page Rank
  34.         System.out.println("Enter the Page Rank of the URL to search: ");
  35.         int s2;
  36.         do{
  37.             s2 = in2.nextInt();
  38.             System.out.println("\nThe URL with the entered Page Rank: ");
  39.             spider.SearchPageRank(s2);
  40.             System.out.println("\nEnter any number to proceed: ");
  41.         }
  42.         while (!(in2.hasNextInt()));
  43.        
  44.         Scanner in3 = new Scanner(System.in); // testing insertion of a url
  45.         System.out.println("\n\nInserting a node to the BST: ");
  46.         System.out.println("Enter the URL to add (Start with http://): ");
  47.         String s4;
  48.         do {
  49.             s4 = in3.nextLine();
  50.             System.out.println("Enter the score: ");
  51.             s2 = in3.nextInt();
  52.             System.out.println("Inserting... ");
  53.             spider.insertNode(s4, s2);
  54.             System.out.println("Enter the next URL to insert or Press any number to proceed: ");
  55.         }while (!(in3.hasNextInt()));
  56.        
  57.         Scanner in5 = new Scanner(System.in); // tests deletion of a url
  58.         System.out.println("finished inserting");
  59.         System.out.println("\n\n Deleting a node from the BST: ");
  60.         System.out.println("Enter the URL to delete (Start with http://): ");
  61.         do {
  62.             s4 = in5.nextLine();
  63.             spider.deleteNode(s4);
  64.             System.out.println("Enter the next URL to delete or Press any number to proceed:");
  65.         } while (!(in5.hasNextInt()));
  66.        
  67.         System.out.println("Finished deleting");
  68.         BucketSort b = new BucketSort();
  69.         b.domainify(spider.theUrls);
  70.         System.out.println("\n\n Starting bucket sort on the URLs with the most searched keyword: ");
  71.         b.bucketSort(b.bucketList);
  72.        
  73.     }
  74. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top