Esempio n. 1
0
        public static string Walk(PatriciaTrieNode node, int level)
        {
            if (node == null)
            {
                return(string.Empty);
            }

            var result = new StringBuilder();

            result.Append($"<'{node.Key}'");
            if (node.Value.HasValue)
            {
                result.Append($" {node.Value}");
            }
            result.Append(">");

            foreach (var child in node.Childs)
            {
                result.Append("\n");
                for (var i = 0; i < level; i++)
                {
                    result.Append("\t");
                }
                result.Append(Walk(child.Value, level + 1));
            }

            return(result.ToString());
        }
Esempio n. 2
0
        public static string Walk(PatriciaTrieNode node, int level)
        {
            if (node == null)
                return string.Empty;

            var result = new StringBuilder();

            result.Append($"<'{node.Key}'");
            if (node.Value.HasValue)
                result.Append($" {node.Value}");
            result.Append(">");

            foreach (var child in node.Childs)
            {
                result.Append("\n");
                for (var i = 0; i < level; i++)
                {
                    result.Append("\t");
                }
                result.Append(Walk(child.Value, level+1));
            }

            return result.ToString();
        }
Esempio n. 3
0
 public PatriciaTrie()
 {
     Root = new PatriciaTrieNode("");
 }
Esempio n. 4
0
 public PatriciaTrie()
 {
     Root = new PatriciaTrieNode("");
 }