コード例 #1
0
            public void AddNewEdge()
            {
                _tree.SendMessage("Adding new edge to {0}", this);
                var edge = new Edge(_tree, this);

                Edges.Add(_tree.Word[_tree.CurrentSuffixEndIndex], edge);
                _tree.SendMessage(" => {0} --> {1}", this, edge);
            }
コード例 #2
0
            public Edge SplitAtIndex(int index)
            {
                _tree.SendMessage("Splitting edge {0} at index {1} ('{2}')", this, index, _tree.Word[index]);
                var newEdge = new Edge(_tree, Head);
                var newNode = new Node(_tree);

                newEdge.Tail       = newNode;
                newEdge.StartIndex = StartIndex;
                newEdge.EndIndex   = index - 1;
                Head       = newNode;
                StartIndex = index;
                newNode.Edges.Add(_tree.Word[StartIndex], this);
                newEdge.Head.Edges[_tree.Word[newEdge.StartIndex]] = newEdge;
                _tree.SendMessage(" => Hierarchy is now: {0} --> {1} --> {2} --> {3}", newEdge.Head, newEdge, newNode, this);
                return(newEdge);
            }