//clears all the neighbours for this given suffix node
        public void ClearNeigbours()
        {
            for (int i = 0; i < Neighbours.Length; i++)
                Neighbours[i] = null;       //any attatched object will be cleaned up by the garbage collecter

            LeafNode = null;
        }
        //removes a word and all its information from the suffix tree
        public void Remove(String word)
        {
            if (word.Length == 0)
            {
                LeafNode = null;
                return;
            }

            char c = Char.ToLower(word[0]);

            SuffixNode Node = Neighbours[MapToIndex(c)];
            if (Node == null)
                return;

            Node.Remove(word.Substring(1));     //continue trimming
        }
        //adds a word with document specific information
        public void Add(String word, DocumentIndex? index, int weight )
        {
            if (word.Length == 0)
            {
                if (LeafNode == null)
                    LeafNode = new SuffixLeafNode();

                if (index != null)
                    LeafNode.AddDocumentIndex(index.Value,weight);
                return;
            }

            char c = Char.ToLower(word[0]);

            SuffixNode node = Neighbours[SuffixNode.MapToIndex(c)];

            if (node == null)
            {
                Neighbours[SuffixNode.MapToIndex(c)] = new SuffixNode(c);
                node = Neighbours[SuffixNode.MapToIndex(c)];
            }

            node.Add(word.Substring(1),index,weight);
        }