public IEnumerable <DocumentNodeMarkerSortedListBase.IntersectionResult> Intersect(DocumentNodeMarkerSortedListBase rhs, DocumentNodeMarkerSortedListBase.Flags flags) { int thisCur = 0; int rhsCur = 0; for (; thisCur < this.Count; ++thisCur) { while (rhsCur < rhs.Count && thisCur < this.Count && rhs.MarkerAt(rhsCur).CompareTo((object)this.MarkerAt(thisCur)) < 0) { bool wasContained = false; if ((flags & DocumentNodeMarkerSortedListBase.Flags.ContainedBy) != DocumentNodeMarkerSortedListBase.Flags.None) { int rhsLookahead; for (rhsLookahead = rhsCur; rhsLookahead < rhs.Count && rhs.MarkerAt(rhsLookahead).Contains(this.MarkerAt(thisCur)); ++rhsLookahead) { yield return(new DocumentNodeMarkerSortedListBase.IntersectionResult(thisCur, rhsLookahead, DocumentNodeMarkerSortedListBase.Flags.ContainedBy)); } if (rhsLookahead != rhsCur) { wasContained = true; } } if (wasContained) { ++thisCur; } else { ++rhsCur; } } if (rhsCur >= rhs.Count || thisCur >= this.Count) { break; } if ((flags & DocumentNodeMarkerSortedListBase.Flags.Equals) != DocumentNodeMarkerSortedListBase.Flags.None && rhs.MarkerAt(rhsCur).CompareTo((object)this.MarkerAt(thisCur)) == 0) { yield return(new DocumentNodeMarkerSortedListBase.IntersectionResult(thisCur, rhsCur, DocumentNodeMarkerSortedListBase.Flags.Equals)); } else if ((flags & DocumentNodeMarkerSortedListBase.Flags.Contains) != DocumentNodeMarkerSortedListBase.Flags.None) { for (int rhsLookahead = rhsCur; rhsLookahead < rhs.Count && this.MarkerAt(thisCur).Contains(rhs.MarkerAt(rhsLookahead)); ++rhsLookahead) { yield return(new DocumentNodeMarkerSortedListBase.IntersectionResult(thisCur, rhsLookahead, DocumentNodeMarkerSortedListBase.Flags.Contains)); } } } }
public IEnumerable <DocumentNodeMarkerSortedListBase.IntersectionResult> UnionIdentity(DocumentNodeMarkerSortedListBase rhs) { int thisCur = 0; int rhsCur = 0; for (; thisCur < this.Count; ++thisCur) { int currentResult = 1; for (; rhsCur < rhs.Count && (currentResult = rhs.MarkerAt(rhsCur).CompareTo((object)this.MarkerAt(thisCur))) < 0; ++rhsCur) { yield return(new DocumentNodeMarkerSortedListBase.IntersectionResult(-1, rhsCur, DocumentNodeMarkerSortedListBase.Flags.Equals)); } if (rhsCur < rhs.Count) { if (currentResult == 0) { yield return(new DocumentNodeMarkerSortedListBase.IntersectionResult(thisCur, rhsCur, DocumentNodeMarkerSortedListBase.Flags.Equals)); ++rhsCur; } else { yield return(new DocumentNodeMarkerSortedListBase.IntersectionResult(thisCur, -1, DocumentNodeMarkerSortedListBase.Flags.Equals)); } } else { yield return(new DocumentNodeMarkerSortedListBase.IntersectionResult(thisCur, -1, DocumentNodeMarkerSortedListBase.Flags.Equals)); } } for (; rhsCur < rhs.Count; ++rhsCur) { yield return(new DocumentNodeMarkerSortedListBase.IntersectionResult(-1, rhsCur, DocumentNodeMarkerSortedListBase.Flags.Equals)); } }
public IEnumerable <DocumentNodeMarkerSortedListBase.IntersectionResult> IntersectIdentity(DocumentNodeMarkerSortedListBase rhs) { int thisCur = 0; int rhsCur = 0; for (; thisCur < this.Count; ++thisCur) { if (rhs.MarkerAt(rhsCur).CompareTo((object)this.MarkerAt(thisCur)) <= 0) { rhsCur = rhs.FindNormalizedPosition(this.MarkerAt(thisCur)); if (rhsCur >= rhs.Count) { break; } if (rhs.MarkerAt(rhsCur) == this.MarkerAt(thisCur)) { yield return(new DocumentNodeMarkerSortedListBase.IntersectionResult(thisCur, rhsCur, DocumentNodeMarkerSortedListBase.Flags.Equals)); } } } }