public IntersectionResult(int leftHandSideIndex, int rightHandSideIndex, DocumentNodeMarkerSortedListBase.Flags flags) { this.leftHandSideIndex = leftHandSideIndex; this.rightHandSideIndex = rightHandSideIndex; this.flags = flags; }
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)); } } } }