private void showMenu() {
   String input = "";
   do {
     Iterator<Artist> iter = currentArtists.iterator();
     // display all current results with an associated index number
     for (int j = 1; j <= currentArtists.size(); j++) {
       Artist a = iter.next();
       System.out.println("[" + j + "] " + a.getName());
     }
     System.out.println("-");
     System.out.println("[L] List traveled artists");
     System.out.println("[q] Quit program");
     // prompt
     System.out.println(separator);
     System.out.println("Which artist do you want to check out?");
     System.out.print("Enter his/her index number or enter 'q' to exit: ");
     System.out.flush();
     ArtistNode anode = null;
     try {
       input = in.readLine();
       int neuerIndex = Integer.parseInt(input);
       // if the index exceeds the array's bounds, prompt again
       if (neuerIndex > currentArtists.size() || neuerIndex < 1)
         System.out.println("There is no such index! Please re-try your request, would you?");
       else {
         // fetch the selected artist - it will become the new center
         Artist a = (Artist) ((ArrayList<Artist>) currentArtists).get(neuerIndex - 1);
         anode = ui.retrieveArtistInformation(a.getName());
         displayArtistInformation(anode);
         currentArtists = ui.findArtistsByName(a.getName());
         System.out.println(separator);
       }
     } catch (UnknownHostException e) {
       System.out.println(
           "You don't seem to have established a working internet "
               + "connection going on right now. Please fix that and try again.");
       System.exit(1);
     } catch (IOException e) {
       e.printStackTrace();
     } catch (NumberFormatException e) {
       if (input.equals("L")) {
         listTraveledArtists();
         System.out.println(separator);
       } else if (input.equals("q")) break;
       else
         System.out.println(
             "I believe you screwed up the index input (your input: "
                 + input
                 + ")"
                 + "\n Would you mind doing it again, please?");
     } catch (NoSuchEntryException e) {
       System.out.println("There was an entry retrieval error! The code is " + e.getMessage());
     }
   } while (!input.equals("q"));
 }
 private void showTagsPrompt() throws IOException {
   boolean fertig = false;
   do {
     System.out.print("Enter a genre that you want to listen to: ");
     String eingaben = in.readLine();
     System.out.println("Fetching artists that match your search (this may take a while)...");
     // separate the entry String and build a list of tags
     ArrayList<String> tags = Utils.chopTagsIntoList(eingaben);
     // fire a request towards the distribution layer with the tags & save results
     try {
       currentArtists = ui.findArtistsByTags(tags);
       if (currentArtists.size() > 0) {
         // start the menu loop if you found something
         fertig = true;
       } else {
         // if there were no matches, do it again
         System.out.println("We found no matching artist for your input! Please try again. :)");
       }
     } catch (NullPointerException e) {
       System.out.println("There was a problem during your request! Please try again.");
     } catch (NoSuchEntryException e) {
       System.out.println(
           "There is no tag called \"" + e.getMessage().substring(2) + "\"! Please try again.");
     }
   } while (!fertig);
 }
 private void listTraveledArtists() {
   ArrayList<ArtistNode> nodes = (ArrayList<ArtistNode>) ui.getTraveledArtists();
   if (nodes.size() == 0) {
     System.out.println("You have yet to discover artists!");
     return;
   }
   System.out.println("Your visited artists:");
   System.out.println(separator);
   for (int j = 1; j <= nodes.size(); j++) {
     ArtistNode a = nodes.get(j - 1);
     System.out.println(j + " : " + a.getName());
   }
 }
 private void showLoginPrompt() throws IOException {
   System.out.println("Do you wish to login with your last.fm name?");
   System.out.println("This is optional, but it optimizes the search algorithm");
   System.out.println("by erasing every artist from any search that you already know.");
   System.out.print("Enter your last.fm name or leave it blank to proceed: ");
   String username = in.readLine();
   if (!username.equals("")) {
     System.out.println("Fetching library (this might take a while)...");
     try {
       int libSize = ui.loginAndGetLibraryCount(username);
       if (libSize != -1)
         System.out.println("Fetching library: DONE! " + libSize + " artists found.");
       System.out.println(separator);
     } catch (NoSuchUserException e) {
       System.out.println(
           "Error! There is no such user as "
               + e.getMessage()
               + "! Proceeding without library...");
     }
   }
 }