SIL.FieldWorks.IText.InterlinDocForAnalysis.FindRealAnalysisInSegment C# (CSharp) Method

FindRealAnalysisInSegment() private method

Finds a real analysis in the segment from the indicated direction. When used just to check if there is an analysis, the direction doesn't matter.
private FindRealAnalysisInSegment ( ISegment seg, bool forward ) : SIL.FieldWorks.FDO.DomainServices.AnalysisOccurrence
seg ISegment The seg.
forward bool if set to true find a real analysis looking forward.
return SIL.FieldWorks.FDO.DomainServices.AnalysisOccurrence
		private AnalysisOccurrence FindRealAnalysisInSegment(ISegment seg, bool forward)
		{
			if (seg == null) return null;
			int index = -1;
			AnalysisOccurrence realAnalysis = null;
			bool found = false;
			for (int i = 0; i < seg.AnalysesRS.Count; i++)
			{	// need to count to create occurances
				index++;
				int ind = forward ? index : seg.AnalysesRS.Count - index;
				realAnalysis = new AnalysisOccurrence(seg, ind);
				if (m_vc.CanBeAnalyzed(realAnalysis))
				{
					found = true;
					break; // found the first or last real analysis
				}
			}
			return found ? realAnalysis : null;
		}
InterlinDocForAnalysis