Example #1
0
 private bool ShouldAddLeafNode(ICmPossibility keyTerm, IFdoOwningSequence <ICmPossibility> subKeyTerms)
 {
     // if we have a book filter and the keyterm doesn't have subpossibilities (ie. it's a leaf node)
     // make sure this key term has an occurrence in the books specified by the book filter.
     if (subKeyTerms.Count == 0)
     {
         if (HasBookFilter)
         {
             IChkTerm chkTerm = (IChkTerm)keyTerm;
             foreach (IChkRef chkRef in chkTerm.OccurrencesOS)
             {
                 int bookIdOfOccurrence = ScrReference.GetBookFromBcv(chkRef.Ref);
                 if (FilteredBookIds.Contains(bookIdOfOccurrence))
                 {
                     // the reference is in one of our filtered books
                     // so add its key term to our tree.
                     return(true);
                 }
             }
         }
         else
         {
             // no book filter to apply, so add all the key terms.
             return(true);
         }
     }
     else
     {
         // return false. not a leaf-node.
     }
     return(false);
 }