public CorpusVerse( VerseReference reference, string arabicText) { this.Reference = reference; this.ArabicText = arabicText; this.WordsByIndex = new Dictionary <int, CorpusVerseWord>(); }
public TafsirComment CommentaryForVerse(int chapterIndex, int verseIndex) { TafsirComment commentary; var reference = new VerseReference( chapter: chapterIndex, verse: verseIndex ); CommentsByVerse.TryGetValue(reference, out commentary); return(commentary); }
public CorpusVerse this[int chapterIndex, int verseIndex] { get { var verseReference = new VerseReference( chapter: chapterIndex, verse: verseIndex ); return(_Verses[verseReference]); } }
public IEnumerable <Hadith> GetHadithsForVerse( int chapterIndex, int verseIndex) { List <Hadith> result; var verseReference = new VerseReference( chapter: chapterIndex, verse: verseIndex ); if (!HadithsByVerse.TryGetValue(verseReference, out result)) { return(new List <Hadith>()); } return(result.OrderBy(x => x.PrimaryReference)); }
public void AddComment(TafsirComment comment) { _Comments.Add(comment); FindCommentariesByChapterEntry(chapter: comment.VerseReference.Chapter, createIfNotExists: true).Add(comment); for (int verseIndex = comment.VerseReference.FirstVerse; verseIndex <= comment.VerseReference.LastVerse; verseIndex++) { var verseReference = new VerseReference( chapter: comment.VerseReference.Chapter, verse: verseIndex ); if (CommentsByVerse.ContainsKey(verseReference)) { Console.WriteLine("Duplicate {0} {1}", this.Code, verseReference); } CommentsByVerse[verseReference] = comment; } }
void AddHadithToIndividualVerses(Hadith hadith) { foreach (var verseRangeReference in hadith.VerseReferences) { for (int verseIndex = verseRangeReference.FirstVerse; verseIndex <= verseRangeReference.LastVerse; verseIndex++ ) { List <Hadith> hadiths; var verseReference = new VerseReference( chapter: verseRangeReference.Chapter, verse: verseIndex ); if (!HadithsByVerse.TryGetValue(verseReference, out hadiths)) { hadiths = new List <Hadith>(); HadithsByVerse[verseReference] = hadiths; } hadiths.Add(hadith); } } }