예제 #1
0
파일: HtmlNode.cs 프로젝트: Nouser/LolNotes
		/// <summary>
		/// This will insert a node at the given position
		/// </summary>
		/// <param name="index">The position at which to insert the node.</param>
		/// <param name="node">The node to insert.</param>
		public void Insert(int index,HtmlNode node)
		{
			if( mParent != null ) node.SetParent( mParent );
			base.InnerList.Insert( index , node );
		}
예제 #2
0
파일: HtmlNode.cs 프로젝트: Nouser/LolNotes
		/// <summary>
		/// This is used to identify the index of this node as it appears in the collection.
		/// </summary>
		/// <param name="node">The node to test</param>
		/// <returns>The index of the node, or -1 if it is not in this collection</returns>
		public int IndexOf(HtmlNode node)
		{
			return base.List.IndexOf( node );
		}
예제 #3
0
파일: HtmlNode.cs 프로젝트: Nouser/LolNotes
		/// <summary>
		/// This will add a node to the collection.
		/// </summary>
		/// <param name="node"></param>
		/// <returns></returns>
		public int Add(HtmlNode node)
		{
			if( mParent != null ) node.SetParent( mParent );
			return base.List.Add( node );
		}
예제 #4
0
파일: HtmlNode.cs 프로젝트: Nouser/LolNotes
		public HtmlNode GetCommonAncestor(HtmlNode node)
		{
			HtmlNode thisParent = this;
			while( thisParent != null )
			{
				HtmlNode thatParent = node;
				while( thatParent != null )
				{
					if( thisParent == thatParent )
					{
						return thisParent;
					}
					thatParent = thatParent.Parent;
				}
				thisParent = thisParent.Parent;
			}
			return null;
		}
예제 #5
0
파일: HtmlNode.cs 프로젝트: Nouser/LolNotes
		public bool IsAncestorOf(HtmlNode node)
		{
			return node.IsDescendentOf( this );
		}
예제 #6
0
파일: HtmlNode.cs 프로젝트: Nouser/LolNotes
		public bool IsDescendentOf(HtmlNode node)
		{
			HtmlNode parent = mParent;
			while( parent != null )
			{
				if( parent == node )
				{
					return true;
				}
				parent = parent.Parent;
			}
			return false;
		}