public static CompareNodes ( |
||
l | ||
r | ||
리턴 | XmlNodeOrder |
private bool SiftItem(int item) { ResetableIterator iterator = this.arr[item]; while ((item + 1) < this.arr.Length) { XmlNodeOrder order = Query.CompareNodes(iterator.Current, this.arr[item + 1].Current); if (order == XmlNodeOrder.Before) { break; } if (order == XmlNodeOrder.After) { this.arr[item] = this.arr[item + 1]; item++; } else { this.arr[item] = iterator; if (!this.Advance(item)) { return(false); } iterator = this.arr[item]; } } this.arr[item] = iterator; return(true); }
// Invariant: a[i] < a[i+1] for i > item // returns flase is head of the list was moved & as a result consistancy of list depends on head consistancy. bool SiftItem(int item) { Debug.Assert(firstNotEmpty <= item && item < arr.Length); ResetableIterator it = arr[item]; while (item + 1 < arr.Length) { XmlNodeOrder order = Query.CompareNodes(it.Current, arr[item + 1].Current); if (order == XmlNodeOrder.Before) { break; } if (order == XmlNodeOrder.After) { arr[item] = arr[item + 1]; //arr[item + 1] = it; item++; } else // Same { arr[item] = it; if (!Advance(item)) { return(false); } it = arr[item]; } } arr[item] = it; return(true); }
public override XPathNavigator Advance() { XPathNavigator nextNode; XPathNavigator navigator2; XmlNodeOrder before = XmlNodeOrder.Before; if (this.advance1) { nextNode = this.qy1.Advance(); } else { nextNode = this.nextNode; } if (this.advance2) { navigator2 = this.qy2.Advance(); } else { navigator2 = this.nextNode; } if ((nextNode != null) && (navigator2 != null)) { before = Query.CompareNodes(nextNode, navigator2); } else { if (navigator2 == null) { this.advance1 = true; this.advance2 = false; this.currentNode = nextNode; this.nextNode = null; return(nextNode); } this.advance1 = false; this.advance2 = true; this.currentNode = navigator2; this.nextNode = null; return(navigator2); } switch (before) { case XmlNodeOrder.Before: return(this.ProcessBeforePosition(nextNode, navigator2)); case XmlNodeOrder.After: return(this.ProcessAfterPosition(nextNode, navigator2)); } return(this.ProcessSamePosition(nextNode)); }
private bool DecideNextNode() { this.nextInput = this.GetNextInput(); if ((this.nextInput != null) && (Query.CompareNodes(base.currentNode, this.nextInput) == XmlNodeOrder.After)) { this.elementStk.Push(base.currentNode); this.positionStk.Push(base.position); base.currentNode = this.nextInput; this.nextInput = null; if (!base.currentNode.MoveToFirstChild()) { return(false); } base.position = 0; } return(true); }