X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=mcs%2Fclass%2FSystem.XML%2FSystem.Xml%2FXmlLinkedNode.cs;h=090bedcf6b924e0235ad7635a195c3284cbbc1e3;hb=d0cd6199a50148579b6755b641fc9c13bba93597;hp=55134cfbad0cdf9d0b69952205ae49cde619a604;hpb=227b56db7ac2ef653fe72e56d0a3147f8d5158d7;p=mono.git diff --git a/mcs/class/System.XML/System.Xml/XmlLinkedNode.cs b/mcs/class/System.XML/System.Xml/XmlLinkedNode.cs index 55134cfbad0..090bedcf6b9 100644 --- a/mcs/class/System.XML/System.Xml/XmlLinkedNode.cs +++ b/mcs/class/System.XML/System.Xml/XmlLinkedNode.cs @@ -1,52 +1,66 @@ -// System.Xml.XmlLinkedNode.cs -// -// Author: Daniel Weber (daniel-weber@austin.rr.com) -// -// Implementation of abstract Xml.XmlLinkedNode class +// +// System.Xml.XmlLinkedNode +// +// Authors: +// Jason Diamond +// Kral Ferch +// +// (C) 2002 Jason Diamond, Kral Ferch +// -using System; - -namespace System.Xml -{ - public abstract class XmlLinkedNode : XmlNode - { - private XmlNode _nextSibling; - private XmlNode _previousSibling; - - // ============ Properties ============================================ - //===================================================================== - /// - /// Get the node immediately following this node - /// - public override XmlNode NextSibling - { - get - { - return _nextSibling; - } - } - - /// - /// Get the node immediately previous to this node - /// - public override XmlNode PreviousSibling - { - get - { - return _previousSibling; - } - } - - // Internal accessor methods - //=========================================================================== - internal void setPreviousNode ( XmlNode previous ) - { - _previousSibling = previous; - } - - internal void setNextSibling ( XmlNode next ) - { - _nextSibling = next; - } - } -} \ No newline at end of file +using System; + +namespace System.Xml +{ + public abstract class XmlLinkedNode : XmlNode + { + #region Fields + + XmlLinkedNode nextSibling; + + #endregion + + #region Constructors + internal XmlLinkedNode(XmlDocument doc) : base(doc) { } + + #endregion + + #region Properties + + public override XmlNode NextSibling + { + get { + if (Object.ReferenceEquals(nextSibling, ParentNode.LastLinkedChild.NextLinkedSibling) == false) { + return nextSibling; + } + else { + return null; + } + } + } + + internal XmlLinkedNode NextLinkedSibling + { + get { return nextSibling; } + set { nextSibling = value; } + } + + public override XmlNode PreviousSibling + { + get { + if (ParentNode != null) { + XmlNode node = ParentNode.FirstChild; + if (node != this) { + do { + if (node.NextSibling == this) + return node; + } while ((node = node.NextSibling) != null); + } + } + return null; + } + } + + #endregion + } +}