Exemplo n.º 1
0
        int IComparer.Compare(object o1, object o2)
        {
            XPathSortElement xpathSortElement  = (XPathSortElement)o1;
            XPathSortElement xpathSortElement2 = (XPathSortElement)o2;

            for (int i = 0; i < this._rgSorters.Count; i++)
            {
                XPathSorter xpathSorter = (XPathSorter)this._rgSorters[i];
                int         num         = xpathSorter.Compare(xpathSortElement.Values[i], xpathSortElement2.Values[i]);
                if (num != 0)
                {
                    return(num);
                }
            }
            XmlNodeOrder xmlNodeOrder = xpathSortElement.Navigator.ComparePosition(xpathSortElement2.Navigator);

            if (xmlNodeOrder == XmlNodeOrder.After)
            {
                return(1);
            }
            if (xmlNodeOrder != XmlNodeOrder.Same)
            {
                return(-1);
            }
            return(0);
        }
Exemplo n.º 2
0
 public XPathSorter(object expr, XmlSortOrder orderSort, XmlCaseOrder orderCase, string lang, XmlDataType dataType)
 {
     this._expr = XPathSorter.ExpressionFromObject(expr);
     this._type = dataType;
     if (dataType == XmlDataType.Number)
     {
         this._cmp = new XPathSorter.XPathNumberComparer(orderSort);
     }
     else
     {
         this._cmp = new XPathSorter.XPathTextComparer(orderSort, orderCase, lang);
     }
 }
Exemplo n.º 3
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);
        }
Exemplo n.º 4
0
 public XPathSorter(object expr, IComparer cmp)
 {
     this._expr = XPathSorter.ExpressionFromObject(expr);
     this._cmp  = cmp;
     this._type = XmlDataType.Text;
 }