identifyReferenceType static method

ReferenceType? identifyReferenceType(
  1. dynamic book, [
  2. dynamic startChapter,
  3. dynamic startVerse,
  4. dynamic endChapter,
  5. dynamic endVerse,
])

Returns the ReferenceType based on the number of passed in arguments.

Implementation

static ReferenceType? identifyReferenceType(book,
    [startChapter, startVerse, endChapter, endVerse]) {
  if (startChapter == null && endChapter == null) {
    return ReferenceType.BOOK;
  } else if (startChapter != null &&
      endChapter != null &&
      startChapter != endChapter) {
    return ReferenceType.CHAPTER_RANGE;
  } else if (startChapter != null &&
      (endChapter == null || endChapter == startChapter) &&
      startVerse == null &&
      endVerse == null) {
    return ReferenceType.CHAPTER;
  } else if (startVerse != null && endVerse != null) {
    return ReferenceType.VERSE_RANGE;
  } else if (startVerse != null) {
    return ReferenceType.VERSE;
  }
  return null;
}