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

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

            if (this.root != null)
            {
                this.root = Delete(this.root, k);
            }
        }
예제 #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);
                }
            }
        }