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"); } }
public TitleNode findTitleNode(String title) { TitleNode curr = this.getTitleHead(); while (curr != null) { if (curr.getTitleData().equals(title)) { return curr; } curr = curr.getNextTitle(); } return null; }
public boolean isExistTitle(String title) { TitleNode curr = this.getTitleHead(); while (curr != null) { if (curr.getTitleData().equals(title)) { return true; } curr = curr.getNextTitle(); } return false; }
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() + ")"); } } } }