예제 #1
0
 public void search(String keyword) {
   GenreNode curr = this.head;
   String cache = "";
   for (curr = this.head.getNextGenre(); curr != null; curr = curr.getNextGenre()) {
     for (TitleNode curr2nd = curr.getTitleHead().getNextTitle();
         curr2nd != null;
         curr2nd = curr2nd.getNextTitle()) {
       if (curr2nd.getTitleData().contains(keyword)) {
         System.out.println("(" + curr.getGenreData() + ", " + curr2nd.getTitleData() + ")");
         cache = "*";
       }
     }
   }
   if (cache.equals("")) {
     System.out.println("EMPTY");
   }
 }
예제 #2
0
 public TitleNode findTitleNode(String title) {
   TitleNode curr = this.getTitleHead();
   while (curr != null) {
     if (curr.getTitleData().equals(title)) {
       return curr;
     }
     curr = curr.getNextTitle();
   }
   return null;
 }
예제 #3
0
 public boolean isExistTitle(String title) {
   TitleNode curr = this.getTitleHead();
   while (curr != null) {
     if (curr.getTitleData().equals(title)) {
       return true;
     }
     curr = curr.getNextTitle();
   }
   return false;
 }
예제 #4
0
  public void printListAll(List printList) {
    GenreNode curr = printList.head;
    if (curr.getNextGenre() == null) {
      System.out.println("EMPTY");
    } else {
      for (curr = printList.head.getNextGenre(); curr != null; curr = curr.getNextGenre()) {

        for (TitleNode curr2nd = curr.getTitleHead().getNextTitle();
            curr2nd != null;
            curr2nd = curr2nd.getNextTitle()) {

          System.out.println("(" + curr.getGenreData() + ", " + curr2nd.getTitleData() + ")");
        }
      }
    }
  }