public void Remove(TextLineGuid InLineGuid)
        {
            LinkedListNode <ParseTextLine> node = null;

            node = FindNode_Expected(InLineGuid);
            base.Remove(node);
        }
        public void ChangeTextLine(string InLineText, TextLineGuid InLineGuid)
        {
            LinkedListNode <ParseTextLine> node = null;

            node = FindNode_Expected(InLineGuid);
            node.Value.LineText = InLineText;
        }
        public LinkedListNode <ParseTextLine> AddBefore(
            ParseTextLine InTextLine, TextLineGuid InBefore)
        {
            LinkedListNode <ParseTextLine> node       = null;
            LinkedListNode <ParseTextLine> beforeNode = null;

            beforeNode = FindNode_Expected(InBefore);
            node       = base.AddBefore(beforeNode, InTextLine);
            return(node);
        }
        public LinkedListNode <ParseTextLine> AddAfter(
            ParseTextLine InTextLine, TextLineGuid InAfter)
        {
            LinkedListNode <ParseTextLine> node      = null;
            LinkedListNode <ParseTextLine> afterNode = null;

            afterNode = FindNode_Expected(InAfter);
            node      = base.AddAfter(afterNode, InTextLine);
            return(node);
        }
        public LinkedListNode <ParseTextLine> FindNode_Expected(TextLineGuid InLineGuid)
        {
            LinkedListNode <ParseTextLine> foundNode = null;

            foundNode = FindNode(InLineGuid);
            if (foundNode == null)
            {
                throw new ApplicationException("text line not found in list of ParseTextLine");
            }
            return(foundNode);
        }
        public LinkedListNode <ParseTextLine> FindNode(TextLineGuid InLineGuid)
        {
            LinkedListNode <ParseTextLine> node      = null;
            LinkedListNode <ParseTextLine> foundNode = null;

            foundNode = null;

            // search from LastFoundNode to end.
            if (mLastFoundNode != null)
            {
                node = mLastFoundNode;
                while (node != null)
                {
                    if (node.Value.LineGuid.ToString() == InLineGuid.ToString())
                    {
                        foundNode = node;
                        break;
                    }

                    node = node.Next;
                }
            }

            // search from the start to end.
            if (foundNode == null)
            {
                node = this.First;
                while (node != null)
                {
                    if (node.Value.LineGuid.ToString() == InLineGuid.ToString())
                    {
                        foundNode = node;
                        break;
                    }

                    node = node.Next;
                }
            }

            // update the globally used LastFoundNode value.
            if (foundNode != null)
            {
                mLastFoundNode = foundNode;
            }

            return(foundNode);
        }
Exemple #7
0
 public ParseTextLine(string InLineText, TextLineGuid InLineGuid)
 {
     mLineText = InLineText;
     mLineGuid = InLineGuid;
 }
 public TextLineGuid(TextLineGuid InLineGuid)
 {
     mLineGuid = InLineGuid.ToString();
 }