/// <summary> /// Initialize an existing shared information atom. This method should only be used by the XNodeInfoTable. /// </summary> public void Init(string localName, string namespaceUri, string prefix, string baseUri, XPathNode[] pageParent, XPathNode[] pageSibling, XPathNode[] pageSimilar, XPathDocument doc, int lineNumBase, int linePosBase) { Debug.Assert(localName != null && namespaceUri != null && prefix != null && doc != null); this.localName = localName; this.namespaceUri = namespaceUri; this.prefix = prefix; this.baseUri = baseUri; this.pageParent = pageParent; this.pageSibling = pageSibling; this.pageSimilar = pageSimilar; this.doc = doc; this.lineNumBase = lineNumBase; this.linePosBase = linePosBase; this.next = null; this.pageInfo = null; this.hashCode = 0; this.localNameHash = 0; for (int i = 0; i < this.localName.Length; i++) { this.localNameHash += (this.localNameHash << 7) ^ this.localName[i]; } }
public void Init(int initialPageSize) { this.pageSize = initialPageSize; this.page = new XPathNode[this.pageSize]; this.pageInfo = new XPathNodePageInfo(null, 1); this.page[0].Create(this.pageInfo); }
/// <summary> /// Initialize an existing shared information atom. This method should only be used by the XNodeInfoTable. /// </summary> public void Init(string localName, string namespaceUri, string prefix, string baseUri, XPathNode[] pageParent, XPathNode[] pageSibling, XPathNode[] pageSimilar, XPathDocument doc, int lineNumBase, int linePosBase) { Debug.Assert(localName != null && namespaceUri != null && prefix != null && doc != null); _localName = localName; _namespaceUri = namespaceUri; _prefix = prefix; _baseUri = baseUri; _pageParent = pageParent; _pageSibling = pageSibling; _pageSimilar = pageSimilar; _doc = doc; _lineNumBase = lineNumBase; _linePosBase = linePosBase; _next = null; _pageInfo = null; _hashCode = 0; _localNameHash = 0; for (int i = 0; i < _localName.Length; i++) { _localNameHash += (_localNameHash << 7) ^ _localName[i]; } }
/// <summary> /// Allocates and returns the initial node page. /// </summary> public void Init(int initialPageSize) { // 0th slot: Index 0 is reserved to mean "null node". Only use 0th slot to store PageInfo. _pageSize = initialPageSize; _page = new XPathNode[_pageSize]; _pageInfo = new XPathNodePageInfo(null, 1); _page[0].Create(_pageInfo); }
public void AllocateSlot(out XPathNode[] page, out int idx) { page = this.page; idx = this.pageInfo.NodeCount; if (++this.pageInfo.NodeCount >= this.page.Length) { if (this.pageSize < 0x10000) { this.pageSize *= 2; } this.page = new XPathNode[this.pageSize]; this.pageInfo.NextPage = this.page; this.pageInfo = new XPathNodePageInfo(page, this.pageInfo.PageNumber + 1); this.page[0].Create(this.pageInfo); } }
/// <summary> /// Allocate the next slot in the current node page. Return a reference to the page and the index /// of the allocated slot. /// </summary> public void AllocateSlot(out XPathNode[] page, out int idx) { page = _page; idx = _pageInfo.NodeCount; // Allocate new page if necessary if (++_pageInfo.NodeCount >= _page.Length) { if (_pageSize < (1 << 16)) { // New page shouldn't contain more slots than 16 bits can address _pageSize *= 2; } _page = new XPathNode[_pageSize]; _pageInfo.NextPage = _page; _pageInfo = new XPathNodePageInfo(page, _pageInfo.PageNumber + 1); _page[0].Create(_pageInfo); } }
public void Init(string localName, string namespaceUri, string prefix, string baseUri, XPathNode[] pageParent, XPathNode[] pageSibling, XPathNode[] pageSimilar, XPathDocument doc, int lineNumBase, int linePosBase) { this.localName = localName; this.namespaceUri = namespaceUri; this.prefix = prefix; this.baseUri = baseUri; this.pageParent = pageParent; this.pageSibling = pageSibling; this.pageSimilar = pageSimilar; this.doc = doc; this.lineNumBase = lineNumBase; this.linePosBase = linePosBase; this.next = null; this.pageInfo = null; this.hashCode = 0; this.localNameHash = 0; for (int i = 0; i < this.localName.Length; i++) { this.localNameHash += (this.localNameHash << 7) ^ this.localName[i]; } }
//----------------------------------------------- // Node construction //----------------------------------------------- /// <summary> /// Constructs the 0th XPathNode in each page, which contains only page information. /// </summary> public void Create(XPathNodePageInfo pageInfo) { this.info = new XPathNodeInfoAtom(pageInfo); }
/// <summary> /// Construct information for the 0th node in each page. The only field which is defined is this.pageInfo, /// and it contains information about that page (pageNum, nextPage, etc.). /// </summary> public XPathNodeInfoAtom(XPathNodePageInfo pageInfo) { this.pageInfo = pageInfo; }
/// <summary> /// Construct information for the 0th node in each page. The only field which is defined is this.pageInfo, /// and it contains information about that page (pageNum, nextPage, etc.). /// </summary> public XPathNodeInfoAtom(XPathNodePageInfo pageInfo) { _pageInfo = pageInfo; }
/// <summary> /// Initialize an existing shared information atom. This method should only be used by the XNodeInfoTable. /// </summary> public void Init(string localName, string namespaceUri, string prefix, string baseUri, XPathNode[] pageParent, XPathNode[] pageSibling, XPathNode[] pageSimilar, XPathDocument doc, int lineNumBase, int linePosBase) { Debug.Assert(localName != null && namespaceUri != null && prefix != null && doc != null); _localName = localName; _namespaceUri = namespaceUri; _prefix = prefix; _baseUri = baseUri; _pageParent = pageParent; _pageSibling = pageSibling; _pageSimilar = pageSimilar; _doc = doc; _lineNumBase = lineNumBase; _linePosBase = linePosBase; _next = null; _pageInfo = null; _hashCode = 0; _localNameHash = 0; for (int i = 0; i < _localName.Length; i++) _localNameHash += (_localNameHash << 7) ^ _localName[i]; }
//----------------------------------------------- // Node construction //----------------------------------------------- /// <summary> /// Constructs the 0th XPathNode in each page, which contains only page information. /// </summary> public void Create(XPathNodePageInfo pageInfo) { _info = new XPathNodeInfoAtom(pageInfo); }