GetLocation() public static method

Return a location integer that can be easily compared with other locations from the same document in order to determine the relative document order of two nodes.
public static GetLocation ( XPathNode pageNode, int idxNode ) : int
pageNode XPathNode
idxNode int
return int
コード例 #1
0
        /// <summary>
        /// Construct a secondary location for this navigator.  This location should only be used if
        /// primary locations previously compared equal.
        /// </summary>
        private int GetSecondaryLocation()
        {
            // Is the current node virtualized?
            if (_idxParent == 0)
            {
                // No, so secondary location is int.MinValue (always first)
                return(int.MinValue);
            }

            // Yes, so secondary location should be derived from current node
            // This happens with attributes nodes, namespace nodes, collapsed text nodes, and atomic values
            switch (_pageCurrent[_idxCurrent].NodeType)
            {
            case XPathNodeType.Namespace:
                // Namespace nodes come first (make location negative, but greater than int.MinValue)
                return(int.MinValue + 1 + XPathNodeHelper.GetLocation(_pageCurrent, _idxCurrent));

            case XPathNodeType.Attribute:
                // Attribute nodes come next (location is always positive)
                return(XPathNodeHelper.GetLocation(_pageCurrent, _idxCurrent));

            default:
                // Collapsed text nodes are always last
                return(int.MaxValue);
            }
        }
コード例 #2
0
 private int GetPrimaryLocation()
 {
     if (this.idxParent == 0)
     {
         return(XPathNodeHelper.GetLocation(this.pageCurrent, this.idxCurrent));
     }
     return(XPathNodeHelper.GetLocation(this.pageParent, this.idxParent));
 }
コード例 #3
0
        /// <summary>
        /// Construct a primary location for this navigator.  The location is an integer that can be
        /// easily compared with other locations in the same document in order to determine the relative
        /// document order of two nodes.  If two locations compare equal, then secondary locations should
        /// be compared.
        /// </summary>
        private int GetPrimaryLocation()
        {
            // Is the current node virtualized?
            if (_idxParent == 0)
            {
                // No, so primary location should be derived from current node
                return(XPathNodeHelper.GetLocation(_pageCurrent, _idxCurrent));
            }

            // Yes, so primary location should be derived from parent node
            return(XPathNodeHelper.GetLocation(_pageParent, _idxParent));
        }
コード例 #4
0
        private int GetSecondaryLocation()
        {
            if (this.idxParent == 0)
            {
                return(-2147483648);
            }
            switch (this.pageCurrent[this.idxCurrent].NodeType)
            {
            case XPathNodeType.Attribute:
                return(XPathNodeHelper.GetLocation(this.pageCurrent, this.idxCurrent));

            case XPathNodeType.Namespace:
                return(-2147483647 + XPathNodeHelper.GetLocation(this.pageCurrent, this.idxCurrent));
            }
            return(0x7fffffff);
        }
コード例 #5
0
ファイル: XPathNode.cs プロジェクト: layomia/dotnet_runtime
 public override int GetHashCode()
 {
     return(XPathNodeHelper.GetLocation(_page, _idx));
 }