/// <summary> /// Return a list of the combined segments in the two lists, ordered by BeginOffset. /// </summary> /// <param name="cachedSegments"></param> /// <param name="paraSegments"></param> /// <returns></returns> private List<int> CombineSegs(List<int> first, List<int> second) { List<int> result = new List<int>(first.Count + second.Count); int index1 = 0; int index2 = 0; while (index1 < first.Count && index2 < second.Count) { if (first[index1] == second[index2]) { // same segment in both...transfer result.Add(first[index1]); index1++; index2++; continue; } int offset1 = m_cache.GetIntProperty(first[index1], (int) CmBaseAnnotation.CmBaseAnnotationTags.kflidBeginOffset); int offset2 = m_cache.GetIntProperty(second[index2], (int)CmBaseAnnotation.CmBaseAnnotationTags.kflidBeginOffset); if (offset1 < offset2) { result.Add(first[index1]); index1++; } else { result.Add(second[index2]); index2++; } } if (index1 < first.Count) result.AddRange(first.GetRange(index1, first.Count - index1)); else if (index2 < second.Count) result.AddRange(second.GetRange(index2, second.Count - index2)); return result; }