private bool IsRelevant(Block block) { if (block.MultiBlockQuote == MultiBlockQuote.Continuation || block.MultiBlockQuote == MultiBlockQuote.ChangeOfDelivery) { return(false); } if ((Mode & BlocksToDisplay.ExcludeUserConfirmed) > 0 && block.UserConfirmed) { return(false); } if ((Mode & BlocksToDisplay.NeedAssignments) > 0) { return(block.UserConfirmed || block.CharacterIsUnclear()); } if ((Mode & BlocksToDisplay.AllExpectedQuotes) > 0) { if (!GetIsBlockScripture(block)) { return(false); } return(ControlCharacterVerseData.Singleton.GetCharacters(CurrentBookId, block.ChapterNumber, block.InitialStartVerseNumber, block.LastVerse, versification: Versification).Any(c => c.IsExpected)); } if ((Mode & BlocksToDisplay.MissingExpectedQuote) > 0) { if (block.IsQuote || CharacterVerseData.IsCharacterStandard(block.CharacterId, false)) { return(false); } IEnumerable <BCVRef> versesWithPotentialMissingQuote = ControlCharacterVerseData.Singleton.GetCharacters(CurrentBookId, block.ChapterNumber, block.InitialStartVerseNumber, block.LastVerse, versification: Versification).Where(c => c.IsExpected).Select(c => c.BcvRef); if (!versesWithPotentialMissingQuote.Any()) { return(false); } foreach (BCVRef verse in versesWithPotentialMissingQuote) { if (m_navigator.PeekBackwardWithinBookWhile(b => b.ChapterNumber == verse.Chapter && b.LastVerse == verse.Verse).All(b => !b.IsQuote) && m_navigator.PeekForwardWithinBookWhile(b => b.ChapterNumber == verse.Chapter && b.InitialStartVerseNumber == verse.Verse).All(b => !b.IsQuote)) { return(true); } } return(false); } if ((Mode & BlocksToDisplay.MoreQuotesThanExpectedSpeakers) > 0) { if (!block.IsQuote) { return(false); } var expectedSpeakers = ControlCharacterVerseData.Singleton.GetCharacters(CurrentBookId, block.ChapterNumber, block.InitialStartVerseNumber, block.InitialEndVerseNumber, versification: Versification).Distinct(new CharacterEqualityComparer()).Count(); var actualquotes = 1; // this is the quote represented by the given block. if (actualquotes > expectedSpeakers) { return(true); } // Check surrounding blocks to count quote blocks for same verse. actualquotes += m_navigator.PeekBackwardWithinBookWhile(b => b.ChapterNumber == block.ChapterNumber && b.InitialStartVerseNumber == block.InitialStartVerseNumber) .Count(b => b.IsQuote && (b.MultiBlockQuote == MultiBlockQuote.Start || b.MultiBlockQuote == MultiBlockQuote.None)); if (actualquotes > expectedSpeakers) { return(true); } actualquotes += m_navigator.PeekForwardWithinBookWhile(b => b.ChapterNumber == block.ChapterNumber && b.InitialStartVerseNumber == block.InitialStartVerseNumber) .Count(b => b.IsQuote && (b.MultiBlockQuote == MultiBlockQuote.Start || b.MultiBlockQuote == MultiBlockQuote.None)); return(actualquotes > expectedSpeakers); } if ((Mode & BlocksToDisplay.AllScripture) > 0) { return(GetIsBlockScripture(block)); } if ((Mode & BlocksToDisplay.AllQuotes) > 0) { return(block.IsQuote); } return(false); }
private bool IsRelevant(Block block, bool ignoreExcludeUserConfirmed = false) { if (block.MultiBlockQuote == MultiBlockQuote.Continuation || block.MultiBlockQuote == MultiBlockQuote.ChangeOfDelivery) { return(false); } if (!ignoreExcludeUserConfirmed && (Mode & BlocksToDisplay.ExcludeUserConfirmed) > 0 && block.UserConfirmed) { return(false); } if ((Mode & BlocksToDisplay.NeedAssignments) > 0) { return(BlockNeedsAssignment(block)); } if ((Mode & BlocksToDisplay.NotAlignedToReferenceText) > 0) { if (!block.IsScripture) { return(false); } if (s_lastMatchup == null || !s_lastMatchup.OriginalBlocks.Contains(block)) { s_lastMatchup = m_project.ReferenceText.GetBlocksForVerseMatchedToReferenceText(CurrentBook, m_navigator.GetIndicesOfSpecificBlock(block).BlockIndex, m_project.Versification); } return(s_lastMatchup.OriginalBlocks.Count() > 1 && !s_lastMatchup.CorrelatedBlocks.All(b => b.MatchesReferenceText)); } if ((Mode & BlocksToDisplay.AllExpectedQuotes) > 0) { return(IsBlockInVerseWithExpectedQuote(block)); } if ((Mode & BlocksToDisplay.MissingExpectedQuote) > 0) { if (CurrentBookIsSingleVoice) { return(false); } if (block.IsQuote || CharacterVerseData.IsCharacterExtraBiblical(block.CharacterId)) { return(false); } IEnumerable <BCVRef> versesWithPotentialMissingQuote = ControlCharacterVerseData.Singleton.GetCharacters(CurrentBookId, block.ChapterNumber, block.InitialStartVerseNumber, block.LastVerseNum, versification: Versification).Where(c => c.IsExpected).Select(c => c.BcvRef); var withPotentialMissingQuote = versesWithPotentialMissingQuote as IList <BCVRef> ?? versesWithPotentialMissingQuote.ToList(); if (!withPotentialMissingQuote.Any()) { return(false); } // REVIEW: This method peeks forward/backward from the *CURRENT* block, which might not be the block passed in to this method. return(CurrentBlockHasMissingExpectedQuote(withPotentialMissingQuote)); } if ((Mode & BlocksToDisplay.MoreQuotesThanExpectedSpeakers) > 0) { if (!block.IsQuote || CurrentBookIsSingleVoice) { return(false); } var expectedSpeakers = ControlCharacterVerseData.Singleton.GetCharacters(CurrentBookId, block.ChapterNumber, block.InitialStartVerseNumber, block.InitialEndVerseNumber, versification: Versification).Distinct(new CharacterEqualityComparer()).Count(); var actualquotes = 1; // this is the quote represented by the given block. if (actualquotes > expectedSpeakers) { return(true); } // REVIEW: This method peeks forward/backward from the *CURRENT* block, which might not be the block passed in to this method. // Check surrounding blocks to count quote blocks for same verse. actualquotes += m_navigator.PeekBackwardWithinBookWhile(b => b.ChapterNumber == block.ChapterNumber && b.InitialStartVerseNumber == block.InitialStartVerseNumber) .Count(b => b.IsQuote && (b.MultiBlockQuote == MultiBlockQuote.Start || b.MultiBlockQuote == MultiBlockQuote.None)); if (actualquotes > expectedSpeakers) { return(true); } actualquotes += m_navigator.PeekForwardWithinBookWhile(b => b.ChapterNumber == block.ChapterNumber && b.InitialStartVerseNumber == block.InitialStartVerseNumber) .Count(b => b.IsQuote && (b.MultiBlockQuote == MultiBlockQuote.Start || b.MultiBlockQuote == MultiBlockQuote.None)); return(actualquotes > expectedSpeakers); } if ((Mode & BlocksToDisplay.AllScripture) > 0) { return(block.IsScripture); } if ((Mode & BlocksToDisplay.AllQuotes) > 0) { return(block.IsQuote); } return(false); }