Beispiel #1
0
 public CorpusVerse(
     VerseReference reference,
     string arabicText)
 {
     this.Reference    = reference;
     this.ArabicText   = arabicText;
     this.WordsByIndex = new Dictionary <int, CorpusVerseWord>();
 }
Beispiel #2
0
        public TafsirComment CommentaryForVerse(int chapterIndex, int verseIndex)
        {
            TafsirComment commentary;
            var           reference = new VerseReference(
                chapter: chapterIndex,
                verse: verseIndex
                );

            CommentsByVerse.TryGetValue(reference, out commentary);
            return(commentary);
        }
Beispiel #3
0
 public CorpusVerse this[int chapterIndex, int verseIndex]
 {
     get
     {
         var verseReference = new VerseReference(
             chapter: chapterIndex,
             verse: verseIndex
             );
         return(_Verses[verseReference]);
     }
 }
Beispiel #4
0
        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));
        }
Beispiel #5
0
 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;
     }
 }
Beispiel #6
0
 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);
         }
     }
 }