Skip to content

Commit dd3e83f

Browse files
Wrote necessary plus some additional tests
1 parent cb55d2e commit dd3e83f

File tree

4 files changed

+580
-1235
lines changed

4 files changed

+580
-1235
lines changed
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
using System.Collections.Generic;
2+
3+
namespace SIL.Scripture.Extensions
4+
{
5+
public static class ScrVersExtensions
6+
{
7+
/// <summary>
8+
/// Gets a list of references (verse references) for the specified book.
9+
/// </summary>
10+
public static IEnumerable<VerseRef> GetReferencesForBook(this ScrVers scrVers, int bookNum)
11+
{
12+
List<VerseRef> references = new List<VerseRef>();
13+
int lastChapter = scrVers.GetLastChapter(bookNum);
14+
15+
for (int chapterNum = 1; chapterNum <= lastChapter; chapterNum++)
16+
{
17+
int lastVerse = scrVers.GetLastVerse(bookNum, chapterNum);
18+
19+
for (int verseNum = 1; verseNum <= lastVerse; verseNum++)
20+
{
21+
int bbbcccvvv = VerseRef.GetBBBCCCVVV(bookNum, chapterNum, verseNum);
22+
if (!scrVers.IsExcluded(bbbcccvvv))
23+
{
24+
references.Add(new VerseRef(bookNum, chapterNum, verseNum, scrVers));
25+
}
26+
}
27+
}
28+
29+
return references;
30+
}
31+
}
32+
}

0 commit comments

Comments
 (0)