コード例 #1
0
        public SortedIterator(BaseIterator iter) : base(iter.NamespaceManager)
        {
            this.list = new ArrayList();
            while (iter.MoveNext())
            {
                XPathNavigator xpathNavigator = iter.Current;
                this.list.Add(xpathNavigator.Clone());
            }
            if (this.list.Count == 0)
            {
                return;
            }
            XPathNavigator xpathNavigator2 = (XPathNavigator)this.list[0];

            this.list.Sort(XPathNavigatorComparer.Instance);
            for (int i = 1; i < this.list.Count; i++)
            {
                XPathNavigator xpathNavigator3 = (XPathNavigator)this.list[i];
                if (xpathNavigator2.IsSamePosition(xpathNavigator3))
                {
                    this.list.RemoveAt(i);
                    i--;
                }
                else
                {
                    xpathNavigator2 = xpathNavigator3;
                }
            }
        }
コード例 #2
0
 public static string ToString(object arg)
 {
     if (arg == null)
     {
         throw new ArgumentNullException();
     }
     if (arg is string)
     {
         return((string)arg);
     }
     if (arg is bool)
     {
         return(((bool)arg) ? "true" : "false");
     }
     if (arg is double)
     {
         return(ToString((double)arg));
     }
     if (arg is BaseIterator)
     {
         BaseIterator iter = (BaseIterator)arg;
         if (!iter.MoveNext())
         {
             return("");
         }
         return(iter.Current.Value);
     }
     if (arg is XPathNavigator)
     {
         return(((XPathNavigator)arg).Value);
     }
     throw new ArgumentException();
 }
コード例 #3
0
ファイル: Iterator.cs プロジェクト: xiaochuwang/mono
        public SortedIterator(BaseIterator iter) : base(iter.NamespaceManager)
        {
            list = new ArrayList();
            while (iter.MoveNext())
            {
                list.Add(iter.Current.Clone());
            }

            // sort
            if (list.Count == 0)
            {
                return;
            }
            XPathNavigator prev = (XPathNavigator)list [0];

            list.Sort(XPathNavigatorComparer.Instance);
            for (int i = 1; i < list.Count; i++)
            {
                XPathNavigator n = (XPathNavigator)list [i];
                if (prev.IsSamePosition(n))
                {
                    list.RemoveAt(i);
                    i--;
                }
                else
                {
                    prev = n;
                }
            }
        }
コード例 #4
0
        public override object Evaluate(BaseIterator iter)
        {
            String strArgs;
            object val = arg0.Evaluate(iter);

            BaseIterator valItr = val as BaseIterator;

            if (valItr != null)
            {
                strArgs = "";
                while (valItr.MoveNext())
                {
                    strArgs += valItr.Current.Value + " ";
                }
            }
            else
            {
                strArgs = XPathFunctions.ToString(val);
            }

            XPathNavigator n       = iter.Current.Clone();
            ArrayList      rgNodes = new ArrayList();

            string [] ids = strArgs.Split(rgchWhitespace);
            for (int i = 0; i < ids.Length; i++)
            {
                if (n.MoveToId(ids [i]))
                {
                    rgNodes.Add(n.Clone());
                }
            }

            rgNodes.Sort(XPathNavigatorComparer.Instance);
            return(new ListIterator(iter, rgNodes));
        }
コード例 #5
0
 public static bool ToBoolean(object arg)
 {
     if (arg == null)
     {
         throw new ArgumentNullException();
     }
     if (arg is bool)
     {
         return((bool)arg);
     }
     if (arg is double)
     {
         double dArg = (double)arg;
         return(dArg != 0.0 && !double.IsNaN(dArg));
     }
     if (arg is string)
     {
         return(((string)arg).Length != 0);
     }
     if (arg is BaseIterator)
     {
         BaseIterator iter = (BaseIterator)arg;
         return(iter.MoveNext());
     }
     if (arg is XPathNavigator)
     {
         return(ToBoolean(((XPathNavigator)arg).SelectChildren(XPathNodeType.All)));
     }
     throw new ArgumentException();
 }
コード例 #6
0
        public OrderedIterator(BaseIterator iter)
            : base(iter.NamespaceManager)
        {
//			if (iter.Ordered)
            if (false)
            {
                this.iter = iter;
            }
            else
            {
                list = new ArrayList();
                while (iter.MoveNext())
                {
                    list.Add(iter.Current);
                }
                list.Sort(XPathNavigatorComparer.Instance);
            }
        }
コード例 #7
0
 public OrderedIterator(BaseIterator iter) : base(iter.NamespaceManager)
 {
     this.list = new ArrayList();
     while (iter.MoveNext())
     {
         XPathNavigator value = iter.Current;
         this.list.Add(value);
     }
     this.list.Sort(XPathNavigatorComparer.Instance);
 }
コード例 #8
0
ファイル: Iterator.cs プロジェクト: xiaochuwang/mono
 public override bool MoveNextCore()
 {
     while (_iter.MoveNext())
     {
         if (_test.Match(NamespaceManager, _iter.Current))
         {
             return(true);
         }
     }
     return(false);
 }
コード例 #9
0
        public override object Evaluate(BaseIterator iter)
        {
            if (iter.CurrentPosition == 0)
            {
                iter = (BaseIterator)iter.Clone();
                iter.MoveNext();
            }
            XPathNavigator xpathNavigator = iter.Current.Clone();

            xpathNavigator.MoveToRoot();
            return(new SelfIterator(xpathNavigator, iter.NamespaceManager));
        }
コード例 #10
0
ファイル: Iterator.cs プロジェクト: xiaochuwang/mono
 public SimpleIterator(BaseIterator iter) : base(iter.NamespaceManager)
 {
     if (iter.CurrentPosition == 0)
     {
         skipfirst = true;
         iter.MoveNext();
     }
     if (iter.CurrentPosition > 0)
     {
         _nav = iter.Current.Clone();
     }
 }
コード例 #11
0
ファイル: Iterator.cs プロジェクト: xiaochuwang/mono
        public override bool MoveNextCore()
        {
            if (!keepLeft)
            {
                keepLeft = _left.MoveNext();
            }
            if (!keepRight)
            {
                keepRight = _right.MoveNext();
            }

            if (!keepLeft && !keepRight)
            {
                return(false);
            }

            if (!keepRight)
            {
                keepLeft = false;
                SetCurrent(_left);
                return(true);
            }
            else if (!keepLeft)
            {
                keepRight = false;
                SetCurrent(_right);
                return(true);
            }

            switch (_left.Current.ComparePosition(_right.Current))
            {
            case XmlNodeOrder.Same:
                // consume both. i.e. don't output duplicate result.
                keepLeft = keepRight = false;
                SetCurrent(_right);
                return(true);

            case XmlNodeOrder.Before:
            case XmlNodeOrder.Unknown:             // Maybe happen because of "document(a) | document(b)"
                keepLeft = false;
                SetCurrent(_left);
                return(true);

            case XmlNodeOrder.After:
                keepRight = false;
                SetCurrent(_right);
                return(true);

            default:
                throw new InvalidOperationException("Should not happen.");
            }
        }
コード例 #12
0
ファイル: Iterator.cs プロジェクト: xiaochuwang/mono
 public override bool MoveNextCore()
 {
     if (iter != null)
     {
         return(iter.MoveNext());
     }
     else if (index++ < list.Count)
     {
         return(true);
     }
     index--;
     return(false);
 }
コード例 #13
0
        public override object Evaluate(BaseIterator iter)
        {
            if (this.arg0 == null)
            {
                return(iter.Current.NamespaceURI);
            }
            BaseIterator baseIterator = this.arg0.EvaluateNodeSet(iter);

            if (baseIterator == null || !baseIterator.MoveNext())
            {
                return(string.Empty);
            }
            return(baseIterator.Current.NamespaceURI);
        }
コード例 #14
0
        public override object Evaluate(BaseIterator iter)
        {
            if (arg0 == null)
            {
                return(iter.Current.Name);
            }

            BaseIterator argNs = arg0.EvaluateNodeSet(iter);

            if (argNs == null || !argNs.MoveNext())
            {
                return("");
            }
            return(argNs.Current.Name);
        }
コード例 #15
0
        public override bool MoveNextCore()
        {
            if (finished)
            {
                return(false);
            }
            while (_iter.MoveNext())
            {
                switch (resType)
                {
                case XPathResultType.Number:
                    if (_pred.EvaluateNumber(_iter) != _iter.ComparablePosition)
                    {
                        continue;
                    }
                    break;

                case XPathResultType.Any:
                {
                    object result = _pred.Evaluate(_iter);
                    if (result is double)
                    {
                        if ((double)result != _iter.ComparablePosition)
                        {
                            continue;
                        }
                    }
                    else if (!XPathFunctions.ToBoolean(result))
                    {
                        continue;
                    }
                }
                break;

                default:
                    if (!_pred.EvaluateBoolean(_iter))
                    {
                        continue;
                    }
                    break;
                }

                return(true);
            }
            finished = true;
            return(false);
        }
コード例 #16
0
        private ArrayList ToSortElementList(BaseIterator iter)
        {
            ArrayList arrayList = new ArrayList();
            int       count     = this._rgSorters.Count;

            while (iter.MoveNext())
            {
                XPathSortElement xpathSortElement = new XPathSortElement();
                xpathSortElement.Navigator = iter.Current.Clone();
                xpathSortElement.Values    = new object[count];
                for (int i = 0; i < this._rgSorters.Count; i++)
                {
                    XPathSorter xpathSorter = (XPathSorter)this._rgSorters[i];
                    xpathSortElement.Values[i] = xpathSorter.Evaluate(iter);
                }
                arrayList.Add(xpathSortElement);
            }
            return(arrayList);
        }
コード例 #17
0
 public override bool MoveNextCore()
 {
     while (_right == null || !_right.MoveNext())
     {
         if (!_left.MoveNext())
         {
             return(false);
         }
         _right = _expr.EvaluateNodeSet(_left);
     }
     if (_current == null)
     {
         _current = _right.Current.Clone();
     }
     else if (!_current.MoveTo(_right.Current))
     {
         _current = _right.Current.Clone();
     }
     return(true);
 }
コード例 #18
0
        public virtual string EvaluateString(BaseIterator iter)
        {
            object          obj        = this.Evaluate(iter);
            XPathResultType returnType = this.GetReturnType(iter);

            if (returnType == XPathResultType.Any)
            {
                returnType = Expression.GetReturnType(obj);
            }
            switch (returnType)
            {
            case XPathResultType.Number:
            {
                double d = (double)obj;
                return(XPathFunctions.ToString(d));
            }

            case XPathResultType.String:
                return((string)obj);

            case XPathResultType.Boolean:
                return((!(bool)obj) ? "false" : "true");

            case XPathResultType.NodeSet:
            {
                BaseIterator baseIterator = (BaseIterator)obj;
                if (baseIterator == null || !baseIterator.MoveNext())
                {
                    return(string.Empty);
                }
                return(baseIterator.Current.Value);
            }

            case XPathResultType.Navigator:
                return(((XPathNavigator)obj).Value);

            default:
                throw new XPathException("invalid node type");
            }
        }
コード例 #19
0
        public virtual bool EvaluateBoolean(BaseIterator iter)
        {
            object          obj        = this.Evaluate(iter);
            XPathResultType returnType = this.GetReturnType(iter);

            if (returnType == XPathResultType.Any)
            {
                returnType = Expression.GetReturnType(obj);
            }
            switch (returnType)
            {
            case XPathResultType.Number:
            {
                double num = Convert.ToDouble(obj);
                return(num != 0.0 && num != -0.0 && !double.IsNaN(num));
            }

            case XPathResultType.String:
                return(((string)obj).Length != 0);

            case XPathResultType.Boolean:
                return((bool)obj);

            case XPathResultType.NodeSet:
            {
                BaseIterator baseIterator = (BaseIterator)obj;
                return(baseIterator != null && baseIterator.MoveNext());
            }

            case XPathResultType.Navigator:
                return(((XPathNavigator)obj).HasChildren);

            default:
                throw new XPathException("invalid node type");
            }
        }
コード例 #20
0
ファイル: Iterator.cs プロジェクト: cyplo/mono
		public OrderedIterator (BaseIterator iter)
			: base (iter.NamespaceManager)
		{
//			if (iter.Ordered)
//			if (false)
//				this.iter = iter;
//			else 
			{
				list = new ArrayList ();
				while (iter.MoveNext ())
					list.Add (iter.Current);
				list.Sort (XPathNavigatorComparer.Instance);
			}
		}
コード例 #21
0
 public static bool ToBoolean(BaseIterator iter)
 {
     return(iter != null && iter.MoveNext());
 }
コード例 #22
0
ファイル: DefaultContext.cs プロジェクト: nobled/mono
		public static bool ToBoolean (BaseIterator iter)
		{
			return iter != null && iter.MoveNext ();
		}
コード例 #23
0
        public override bool EvaluateBoolean(BaseIterator iter)
        {
            XPathResultType xpathResultType  = this._left.GetReturnType(iter);
            XPathResultType xpathResultType2 = this._right.GetReturnType(iter);

            if (xpathResultType == XPathResultType.Any)
            {
                xpathResultType = Expression.GetReturnType(this._left.Evaluate(iter));
            }
            if (xpathResultType2 == XPathResultType.Any)
            {
                xpathResultType2 = Expression.GetReturnType(this._right.Evaluate(iter));
            }
            if (xpathResultType == XPathResultType.Navigator)
            {
                xpathResultType = XPathResultType.String;
            }
            if (xpathResultType2 == XPathResultType.Navigator)
            {
                xpathResultType2 = XPathResultType.String;
            }
            if (xpathResultType == XPathResultType.NodeSet || xpathResultType2 == XPathResultType.NodeSet)
            {
                Expression expression;
                Expression expression2;
                if (xpathResultType != XPathResultType.NodeSet)
                {
                    expression  = this._right;
                    expression2 = this._left;
                    XPathResultType xpathResultType3 = xpathResultType;
                    xpathResultType2 = xpathResultType3;
                }
                else
                {
                    expression  = this._left;
                    expression2 = this._right;
                }
                if (xpathResultType2 == XPathResultType.Boolean)
                {
                    return(expression.EvaluateBoolean(iter) == expression2.EvaluateBoolean(iter) == this.trueVal);
                }
                BaseIterator baseIterator = expression.EvaluateNodeSet(iter);
                if (xpathResultType2 == XPathResultType.Number)
                {
                    double num = expression2.EvaluateNumber(iter);
                    while (baseIterator.MoveNext())
                    {
                        if (XPathFunctions.ToNumber(baseIterator.Current.Value) == num == this.trueVal)
                        {
                            return(true);
                        }
                    }
                }
                else if (xpathResultType2 == XPathResultType.String)
                {
                    string b = expression2.EvaluateString(iter);
                    while (baseIterator.MoveNext())
                    {
                        if (baseIterator.Current.Value == b == this.trueVal)
                        {
                            return(true);
                        }
                    }
                }
                else if (xpathResultType2 == XPathResultType.NodeSet)
                {
                    BaseIterator baseIterator2 = expression2.EvaluateNodeSet(iter);
                    ArrayList    arrayList     = new ArrayList();
                    while (baseIterator.MoveNext())
                    {
                        XPathNavigator xpathNavigator = baseIterator.Current;
                        arrayList.Add(XPathFunctions.ToString(xpathNavigator.Value));
                    }
                    while (baseIterator2.MoveNext())
                    {
                        XPathNavigator xpathNavigator2 = baseIterator2.Current;
                        string         a = XPathFunctions.ToString(xpathNavigator2.Value);
                        for (int i = 0; i < arrayList.Count; i++)
                        {
                            if (a == (string)arrayList[i] == this.trueVal)
                            {
                                return(true);
                            }
                        }
                    }
                }
                return(false);
            }
            else
            {
                if (xpathResultType == XPathResultType.Boolean || xpathResultType2 == XPathResultType.Boolean)
                {
                    return(this._left.EvaluateBoolean(iter) == this._right.EvaluateBoolean(iter) == this.trueVal);
                }
                if (xpathResultType == XPathResultType.Number || xpathResultType2 == XPathResultType.Number)
                {
                    return(this._left.EvaluateNumber(iter) == this._right.EvaluateNumber(iter) == this.trueVal);
                }
                return(this._left.EvaluateString(iter) == this._right.EvaluateString(iter) == this.trueVal);
            }
        }
コード例 #24
0
ファイル: Iterator.cs プロジェクト: xiaochuwang/mono
 public override bool MoveNextCore()
 {
     return(_iter.MoveNext());
 }
コード例 #25
0
ファイル: Iterator.cs プロジェクト: xiaochuwang/mono
        public override bool MoveNextCore()
        {
            if (_finished)
            {
                return(false);
            }

            if (_iterRight == null)               // First time
            {
                if (!_iterLeft.MoveNext())
                {
                    return(false);
                }
                _iterRight = _expr.EvaluateNodeSet(_iterLeft);
                _iterList  = new SortedList(XPathIteratorComparer.Instance);
            }

            while (true)
            {
                while (!_iterRight.MoveNext())
                {
                    if (_iterList.Count > 0)
                    {
                        int last = _iterList.Count - 1;
                        _iterRight = (BaseIterator)_iterList.GetByIndex(last);
                        _iterList.RemoveAt(last);
                        break;
                    }
                    else if (_nextIterRight != null)
                    {
                        _iterRight     = _nextIterRight;
                        _nextIterRight = null;
                        break;
                    }
                    else if (!_iterLeft.MoveNext())
                    {
                        _finished = true;
                        return(false);
                    }
                    else
                    {
                        _iterRight = _expr.EvaluateNodeSet(_iterLeft);
                    }
                }
                bool loop = true;
                while (loop)
                {
                    loop = false;
                    if (_nextIterRight == null)
                    {
                        bool noMoreNext = false;
                        while (_nextIterRight == null || !_nextIterRight.MoveNext())
                        {
                            if (_iterLeft.MoveNext())
                            {
                                _nextIterRight = _expr.EvaluateNodeSet(_iterLeft);
                            }
                            else
                            {
                                noMoreNext = true;
                                break;
                            }
                        }
                        if (noMoreNext)
                        {
                            _nextIterRight = null;                             // FIXME: More efficient code. Maybe making noMoreNext class scope would be better.
                        }
                    }
                    if (_nextIterRight != null)
                    {
                        switch (_iterRight.Current.ComparePosition(_nextIterRight.Current))
                        {
                        case XmlNodeOrder.After:
                            _iterList [_iterRight] = _iterRight;
                            _iterRight             = _nextIterRight;
                            _nextIterRight         = null;
                            loop = true;
                            break;

                        case XmlNodeOrder.Same:
                            if (!_nextIterRight.MoveNext())
                            {
                                _nextIterRight = null;
                            }

                            else
                            {
                                int last = _iterList.Count;
                                _iterList [_nextIterRight] = _nextIterRight;
                                if (last != _iterList.Count)
                                {
                                    _nextIterRight = (BaseIterator)_iterList.GetByIndex(last);
                                    _iterList.RemoveAt(last);
                                }
                            }

                            loop = true;
                            break;
                        }
                    }
                }
                return(true);
            }
        }
コード例 #26
0
ファイル: Expression.cs プロジェクト: nobled/mono
		public override object Evaluate (BaseIterator iter)
		{
			if (iter.CurrentPosition == 0) {
				iter = (BaseIterator) iter.Clone ();
				iter.MoveNext ();
			}
			XPathNavigator navRoot = iter.Current.Clone ();
			navRoot.MoveToRoot ();
			return new SelfIterator (navRoot, iter.NamespaceManager);
		}
コード例 #27
0
ファイル: Expression.cs プロジェクト: nobled/mono
		ArrayList ToSortElementList (BaseIterator iter)
		{
			ArrayList rgElts = new ArrayList ();
			int cSorters = _rgSorters.Count;
			while (iter.MoveNext ())
			{
				XPathSortElement elt = new XPathSortElement ();
				elt.Navigator = iter.Current.Clone ();
				elt.Values = new object [cSorters];
				for (int iSorter = 0; iSorter < _rgSorters.Count; ++iSorter)
				{
					XPathSorter sorter = (XPathSorter) _rgSorters [iSorter];
					elt.Values [iSorter] = sorter.Evaluate (iter);
				}
				rgElts.Add (elt);
			}
			return rgElts;
		}
コード例 #28
0
        public override bool EvaluateBoolean(BaseIterator iter)
        {
            XPathResultType xpathResultType  = this._left.GetReturnType(iter);
            XPathResultType xpathResultType2 = this._right.GetReturnType(iter);

            if (xpathResultType == XPathResultType.Any)
            {
                xpathResultType = Expression.GetReturnType(this._left.Evaluate(iter));
            }
            if (xpathResultType2 == XPathResultType.Any)
            {
                xpathResultType2 = Expression.GetReturnType(this._right.Evaluate(iter));
            }
            if (xpathResultType == XPathResultType.Navigator)
            {
                xpathResultType = XPathResultType.String;
            }
            if (xpathResultType2 == XPathResultType.Navigator)
            {
                xpathResultType2 = XPathResultType.String;
            }
            if (xpathResultType != XPathResultType.NodeSet && xpathResultType2 != XPathResultType.NodeSet)
            {
                return(this.Compare(this._left.EvaluateNumber(iter), this._right.EvaluateNumber(iter)));
            }
            bool       fReverse = false;
            Expression expression;
            Expression expression2;

            if (xpathResultType != XPathResultType.NodeSet)
            {
                fReverse    = true;
                expression  = this._right;
                expression2 = this._left;
                XPathResultType xpathResultType3 = xpathResultType;
                xpathResultType2 = xpathResultType3;
            }
            else
            {
                expression  = this._left;
                expression2 = this._right;
            }
            if (xpathResultType2 == XPathResultType.Boolean)
            {
                bool value  = expression.EvaluateBoolean(iter);
                bool value2 = expression2.EvaluateBoolean(iter);
                return(this.Compare(Convert.ToDouble(value), Convert.ToDouble(value2), fReverse));
            }
            BaseIterator baseIterator = expression.EvaluateNodeSet(iter);

            if (xpathResultType2 == XPathResultType.Number || xpathResultType2 == XPathResultType.String)
            {
                double arg = expression2.EvaluateNumber(iter);
                while (baseIterator.MoveNext())
                {
                    if (this.Compare(XPathFunctions.ToNumber(baseIterator.Current.Value), arg, fReverse))
                    {
                        return(true);
                    }
                }
            }
            else if (xpathResultType2 == XPathResultType.NodeSet)
            {
                BaseIterator baseIterator2 = expression2.EvaluateNodeSet(iter);
                ArrayList    arrayList     = new ArrayList();
                while (baseIterator.MoveNext())
                {
                    XPathNavigator xpathNavigator = baseIterator.Current;
                    arrayList.Add(XPathFunctions.ToNumber(xpathNavigator.Value));
                }
                while (baseIterator2.MoveNext())
                {
                    XPathNavigator xpathNavigator2 = baseIterator2.Current;
                    double         arg2            = XPathFunctions.ToNumber(xpathNavigator2.Value);
                    for (int i = 0; i < arrayList.Count; i++)
                    {
                        if (this.Compare((double)arrayList[i], arg2))
                        {
                            return(true);
                        }
                    }
                }
            }
            return(false);
        }
コード例 #29
0
ファイル: Iterator.cs プロジェクト: cyplo/mono
		public override bool MoveNextCore ()
		{
			if (_finished)
				return false;

			if (_iterRight == null) { // First time
				if (!_iterLeft.MoveNext ())
					return false;
				_iterRight = _expr.EvaluateNodeSet (_iterLeft);
				_iterList = new SortedList (XPathIteratorComparer.Instance);
			}

			while (true) {
				while (!_iterRight.MoveNext ()) {
					if (_iterList.Count > 0) {
						int last = _iterList.Count - 1;
						_iterRight = (BaseIterator) _iterList.GetByIndex (last);
						_iterList.RemoveAt (last);
						break;
					} else if (_nextIterRight != null) {
						_iterRight = _nextIterRight;
						_nextIterRight = null;
						break;
					} else if (!_iterLeft.MoveNext ()) {
						_finished = true;
						return false;
					}
					else
						_iterRight = _expr.EvaluateNodeSet (_iterLeft);
				}
				bool loop = true;
				while (loop) {
					loop = false;
					if (_nextIterRight == null) {
						bool noMoreNext = false;
						while (_nextIterRight == null || !_nextIterRight.MoveNext ()) {
							if(_iterLeft.MoveNext ())
								_nextIterRight = _expr.EvaluateNodeSet (_iterLeft);
							else {
								noMoreNext = true;
								break;
							}
						}
						if (noMoreNext)
							_nextIterRight = null; // FIXME: More efficient code. Maybe making noMoreNext class scope would be better.
					}
					if (_nextIterRight != null) {
						switch (_iterRight.Current.ComparePosition (_nextIterRight.Current)) {
						case XmlNodeOrder.After:
							_iterList [_iterRight] = _iterRight;
							_iterRight = _nextIterRight;
							_nextIterRight = null;
							loop = true;
							break;
						case XmlNodeOrder.Same:
							if (!_nextIterRight.MoveNext ())
								_nextIterRight = null;

							else {
								int last = _iterList.Count;
								_iterList [_nextIterRight] = _nextIterRight;
								if (last != _iterList.Count) {
									_nextIterRight = (BaseIterator) _iterList.GetByIndex (last);
									_iterList.RemoveAt (last);
								}
							}

							loop = true;
							break;
						}
					}
				}
				return true;
			}
		}
コード例 #30
0
ファイル: Iterator.cs プロジェクト: cyplo/mono
		public SortedIterator (BaseIterator iter) : base (iter.NamespaceManager)
		{
			list = new ArrayList ();
			while (iter.MoveNext ())
				list.Add (iter.Current.Clone ());

			// sort
			if (list.Count == 0)
				return;
			XPathNavigator prev = (XPathNavigator) list [0];
			list.Sort (XPathNavigatorComparer.Instance);
			for (int i = 1; i < list.Count; i++) {
				XPathNavigator n = (XPathNavigator) list [i];
				if (prev.IsSamePosition (n)) {
					list.RemoveAt (i);
					i--;
				}
				else
					prev = n;
			}
		}
コード例 #31
0
ファイル: Iterator.cs プロジェクト: cyplo/mono
		public SimpleIterator (BaseIterator iter) : base (iter.NamespaceManager)
		{
			if (iter.CurrentPosition == 0) {
				skipfirst = true;
				iter.MoveNext ();
			}
			if (iter.CurrentPosition > 0)
				_nav = iter.Current.Clone ();
		}