Beispiel #1
0
    /**
     * Get a book from its name.
     *
     * @param find The string to identify
     * @param fuzzy Whether to also find bible books where only a substring matches
     * @return The BibleBook, On error null
     */
    BibleBook getBook(String find, boolean fuzzy) {
      String match = BookName.normalize(find, locale);

      BookName bookName = fullNT.get(match);
      if (bookName != null) {
        return bookName.getBook();
      }

      bookName = shortNT.get(match);
      if (bookName != null) {
        return bookName.getBook();
      }

      bookName = altNT.get(match);
      if (bookName != null) {
        return bookName.getBook();
      }

      bookName = fullOT.get(match);
      if (bookName != null) {
        return bookName.getBook();
      }

      bookName = shortOT.get(match);
      if (bookName != null) {
        return bookName.getBook();
      }

      bookName = altOT.get(match);
      if (bookName != null) {
        return bookName.getBook();
      }

      bookName = fullNC.get(match);
      if (bookName != null) {
        return bookName.getBook();
      }

      bookName = shortNC.get(match);
      if (bookName != null) {
        return bookName.getBook();
      }

      bookName = altNC.get(match);
      if (bookName != null) {
        return bookName.getBook();
      }

      if (!fuzzy) {
        return null;
      }

      for (BookName aBook : books.values()) {
        if (aBook.match(match)) {
          return aBook.getBook();
        }
      }

      return null;
    }