Exemple #1
0
        public byte[] Get(byte[] key)
        {
            if (!HasRoot)
            {
                return(null);
            }

            return(Get(root, TrieKey.FromNormal(key)));
        }
Exemple #2
0
        public void Delete(byte[] key)
        {
            TrieKey k = TrieKey.FromNormal(key);

            if (this.root != null)
            {
                this.root = Delete(this.root, k);
            }
        }
Exemple #3
0
        public void Put(byte[] key, byte[] value)
        {
            TrieKey k = TrieKey.FromNormal(key);

            if (this.root == null)
            {
                if (value != null && value.Length > 0)
                {
                    this.root = new TrieNode(this, k, value);
                }
            }
            else
            {
                if (value == null || value.Length == 0)
                {
                    this.root = Delete(this.root, k);
                }
                else
                {
                    this.root = Insert(root, k, value);
                }
            }
        }