コード例 #1
0
 //-------------------------------------------------
 public bool Reset(VisitationType VisitationType_in)
 {
     if
     (
         (VisitationType_in == VisitationType.NextNodes)
         | (VisitationType_in == VisitationType.NextSiblings)
         | (VisitationType_in == VisitationType.Children)
         | (VisitationType_in == VisitationType.DecendentsDepthFirst)
     )
     {
         this.TargetRoot       = new GenericNode <T>();
         this.TargetRoot.Key   = this.SourceRoot.Key;
         this.TargetRoot.Value = this.SourceRoot.Value;
         this._LastNode        = this.TargetRoot;
         return(true);
     }
     else
     {
         this.TargetRoot = null;
         this._LastNode  = null;
         return(false);
     }
 }
コード例 #2
0
 public bool Reset(VisitationType VisitationType_in)
 {
     this.FoundNode = null;
     this._Count    = 0;
     return(true);
 }
コード例 #3
0
 public bool Reset(VisitationType VisitationType_in)
 {
     this.List = new ArrayList();
     return(true);
 }
コード例 #4
0
 public bool Reset(VisitationType VisitationType_in)
 {
     this.Count = 0;
     return(true);
 }
コード例 #5
0
            //-------------------------------------------------
            public void VisitNodes(INodeVisitor Visitor_in, VisitationType VisitationType_in)
            {
                if (!Visitor_in.Reset(VisitationType_in))
                {
                    throw new ApplicationException("Unable to reset this visitor; possibly invalid visitation type for this visitor.");
                }
                if ((VisitationType_in == VisitationType.None))
                {
                }
                else if ((VisitationType_in == VisitationType.PreviousNodes))
                {
                    GenericNode <T> nodePrev = this.ParentNode;
                    while (true)
                    {
                        if ((nodePrev == null))
                        {
                            break;
                        }

                        if (!Visitor_in.VisitNode(nodePrev))
                        {
                            break;
                        }

                        nodePrev = nodePrev.ParentNode;
                    }
                }
                else if ((VisitationType_in == VisitationType.NextNodes))
                {
                    GenericNode <T> nodeNext = _NextNode;
                    while (true)
                    {
                        if ((nodeNext == null))
                        {
                            break;
                        }

                        if (!Visitor_in.VisitNode(nodeNext))
                        {
                            break;
                        }

                        nodeNext = nodeNext._NextNode;
                    }
                }
                else if ((VisitationType_in == VisitationType.Parents))
                {
                    GenericNode <T> nodePrev = this.ParentNode;
                    while (true)
                    {
                        if ((nodePrev == null))
                        {
                            break;
                        }

                        if (!Visitor_in.VisitNode(nodePrev))
                        {
                            break;
                        }

                        nodePrev = nodePrev.ParentNode;
                    }
                }
                else if ((VisitationType_in == VisitationType.PreviousSiblings))
                {
                    GenericNode <T> nodePrev = this.ParentNode;
                    while (true)
                    {
                        if ((nodePrev == null))
                        {
                            break;
                        }

                        if ((nodePrev._Indent < _Indent))
                        {
                            break;
                        }

                        if ((nodePrev._Indent == _Indent))
                        {
                            if (!Visitor_in.VisitNode(nodePrev))
                            {
                                break;
                            }
                        }
                        nodePrev = nodePrev.ParentNode;
                    }
                }
                else if ((VisitationType_in == VisitationType.NextSiblings))
                {
                    GenericNode <T> nodeNext = _NextNode;
                    while (true)
                    {
                        if ((nodeNext == null))
                        {
                            break;
                        }

                        if ((nodeNext._Indent < _Indent))
                        {
                            break;
                        }

                        if ((nodeNext._Indent == _Indent))
                        {
                            if (!Visitor_in.VisitNode(nodeNext))
                            {
                                break;
                            }
                        }
                        nodeNext = nodeNext._NextNode;
                    }
                }
                else if ((VisitationType_in == VisitationType.Children))
                {
                    GenericNode <T> nodeNext = _NextNode;
                    while (true)
                    {
                        if ((nodeNext == null))
                        {
                            break;
                        }

                        if ((nodeNext._Indent <= _Indent))
                        {
                            break;
                        }

                        if ((nodeNext._Indent == (_Indent + 1)))
                        {
                            if (!Visitor_in.VisitNode(nodeNext))
                            {
                                break;
                            }
                        }
                        nodeNext = nodeNext._NextNode;
                    }
                }
                else if ((VisitationType_in == VisitationType.DecendentsDepthFirst))
                {
                    GenericNode <T> nodeNext = _NextNode;
                    while (true)
                    {
                        if ((nodeNext == null))
                        {
                            break;
                        }

                        if ((nodeNext._Indent <= _Indent))
                        {
                            break;
                        }

                        if (!Visitor_in.VisitNode(nodeNext))
                        {
                            break;
                        }

                        nodeNext = nodeNext._NextNode;
                    }
                }
                else if ((VisitationType_in == VisitationType.DecendentsBreadthFirst))
                {
                    throw new NotImplementedException();
                }
                else
                {
                    throw new NotSupportedException();
                }
                return;
            }