Ejemplo n.º 1
0
 public bool AddChild(Node node)
 {
     if (children.ContainsKey(node.c))    //node already present as child
         return false;
     children.Add(node.c, node);
     return true;
 }
Ejemplo n.º 2
0
 private string GetNodeText(Node n)
 {
     return new string(_baseString).Substring(n.StartIndex, ((n.EndIndex > _position + 1) ? (_position + 1) : n.EndIndex) - n.StartIndex);
 }
Ejemplo n.º 3
0
 //Add every substring found along the way to a hashset
 private void AddSubString(Node cur_node)
 {
     if (hs.Contains(cur_node.str))
     {
         if (cur_node.str.Length > LongestRepeatedStr.Length)
         {
             LongestRepeatedStr = cur_node.str;  //update if this is the max repeating substring
         }
     }
     else
         hs.Add(cur_node.str);
 }
Ejemplo n.º 4
0
 //Adds a node with the given indices to the node array. Returns the node as _currentNode.
 private int AddNode(int startIndex, int endIndex)
 {
     _nodes[++_currentNode] = new Node(startIndex, endIndex);
     return _currentNode;
 }